[wxruby-users] copy & paste event
Alex Fenton
alex at pressure.to
Fri Mar 7 06:48:47 EST 2008
Pat Kiatchaipipat wrote:
> tb.add_tool(ID_COPY, "Copy", ArtProvider::get_bitmap(ART_COPY))
> evt_tool(ID_COPY){|event| on_copy()}
>
> def on_copy()
> @textbox2.copy
> end
>
> then I copy it's ok but it can copy only @textbox2 and and I have many
> textbox. how can I use it to copy only selected text not dependent
> textbox? I have @textbox1, @textbox2 and @textbox3
>
IMHO it seems a confusing UI design to have a toolbar button that can
interact with one of several different widgets depending on
circumstances. Anyway, it's up to you to decide the logic by which one
of the text boxes is chosen to have its selection copied.
Perhaps, you could use evt_set_focus to track the most recently focussed
textbox, or perhaps you could test each textbox in turn with
get_selection to see if it has a selection.
Suggest you spend some time trying things out and working through the
wxruby samples and documentation to see what's possible.
alex
More information about the wxruby-users
mailing list