07-27-2012 10:04 AM
I want an ApplicationMenuItemRepository.MENUITEM_SYSTEM to check that some text has been selected i.e. when user clicks menu button and then start selection, get the text before starting my application.
My question is how do I detect a selection has been made and how do I get the text?
07-27-2012 10:19 AM
07-27-2012 11:56 AM
Never done this in practice, but this is how I would try to do it.
I think the first thing you are going to have to do is find out what Field has focus
<screen>.getLeafWithFocus() will get you the Field that has focus.
Now you want to check that the user is actually selecting in that Field
<field>isSelecting() && <field>.isSelectionCopyable()
if so, the copy to the Clipboard:
and pick up what you want from the Clipboard.
Alternatively, just make sure there is something in the Clipboard and use that, tell the use to put something these if not.