andre arpin | 15 May 22:16
Favicon

saving the clipboard on exit (editor)

Adding this code to CloseWindow will save the text in the clipboard to the 
global clipboard. 

    local clipBoard = wx.wxClipboard.Get()
    local editor = GetEditor()
    if editor:CanPaste() and clipBoard and clipBoard:Open() then
        -- We are pasting into the current document but it will be thrown away
        editor:SelectAll();
        editor:Paste();
        clipBoard.Get():SetData(wx.wxTextDataObject(editor.Text))
        clipBoard.Get():Flush()
        clipBoard.Get():Close()
    end

Andre

PS: Tested only on window.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008. 
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
andre arpin | 16 May 01:20
Favicon

Re: saving the clipboard on exit (editor)

andre arpin <arpin@...> writes:

> 
> Adding this code to CloseWindow will save the text in the clipboard to the 
> global clipboard. 

should be (the get are not needed)
    local clipBoard = wx.wxClipboard.Get()
    local editor = GetEditor()
    if editor:CanPaste() and clipBoard and clipBoard:Open() then
        -- We are pasting into the current document but it will be thrown away
        editor:SelectAll();
        editor:Paste();
        clipBoard:SetData(wx.wxTextDataObject(editor.Text))
        clipBoard:Flush()
        clipBoard:Close()
    end

Andre

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008. 
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

Gmane