Cross Platform Cut / Paste

BlitzMax Forums/BlitzMax GUI Programming/Cross Platform Cut / Paste

Hi All,

Is there a cross platform method of getting / setting text on the clipboard knocking around anywhere?

I've seen one floating around for windows, but I'd like one that works on the others too. (Set/GetClipboardText should be a part of MaxGUI really if it's really cross platform! (mumble mumble))

It's for the custom Text edit control I am doing, as it needs some way to be platform independant to be useful.

Evem just the Mac one would be a start.

GadgetCopy + GadgetPaste, you can make a hidden textarea and use those.

Yeah, I was thinking about that, but hoping not to have to do it with other gadgets.

Still it seems like the most likely candidate..

Maybe you could look at the GadgetCut/GadgetPaste code and cut out the parts you need?

So I just tried fredborg's suggestion, and it works under Windows anyway:

Global dummyWindow:TGadget = CreateWindow("dummyWindow", 0, 0, 0, 0) 
Global clipBoard:TGadget = CreateTextArea(0, 0, 0, 0, dummyWindow) 
HideGadget dummyWindow

Function getClipboardText:String() 
    SetTextAreaText(clipBoard, "") 
    GadgetPaste(clipBoard) 
    Return TextAreaText(clipBoard) 
End Function


However -- doing this automatically seems to give the textfield gadget focus.

As it happens, I need to do this with a non-GUI app (meaning a regular Graphics window, not a canvas), and cross-platform. How do I give the graphics window focus again?