02-23-2010 06:18 AM
I am using Object choice field and an image.
I want to open ObjectChoiceField choices on the navigationclick event of an image.
How can i achieve this? Plz help me.
Thanks and Regards
02-23-2010 11:02 PM
Please someone help...
02-23-2010 11:12 PM - edited 02-23-2010 11:12 PM
You have an image that when pressed (trackball or screen) will pop open an ObjectChoiceField for the user to choose an option.
You'd need to use a BitmapField and add it to your screen. On navigationClick event, you would then pop an ObjectChoiceField in a dialog (a dialog is, after all, just another screen with some extra options).
If you just need to select a choice, on the navigationClick just use Dialog.ask (simplest way).
02-24-2010 12:15 AM
I have not done it, but I think we can do it by on selection of the image we set focus on the objectchoicefield and with the help of Event Injection (EventInjector.TrackwheelEvent) you can apply THUMB_CLICK event to open this choice field.
Thanks & regards,
02-24-2010 03:23 AM - edited 02-24-2010 03:27 AM
Use ObjectChoiceFiled with one element providing the layout width & height as desired and background set using setBackground. When the element gets clicked, reset the list to the options as desired using setChoices.
02-24-2010 05:02 AM
If the Event Injector method does not work, or you don't want to ask the user for permission for Input Simulation, you might try this method which I remember seeing in a previous forum entry. I have not tried it myself.
Basically ask the ObjectChoiceField for its contextmenu.
ContextMenu cm = <objectChoiceField>,getContextMenu();
Then I think the default option in the Context menu is the one to 'Change Options',
MenuItem mi = cm.getDefaultmenu();
So you run the default menu item.
I would set Focus on the ObjectChoiceField first.
02-24-2010 05:52 AM
Hi all, Thanx for replying.
In this ALL is an objectChoiceField and arrow is a bitmapfield.
On click of an image, i want objectchoicefield to open.
I have tried the following code: But its not working as expected
objectSymbol = new ObjectChoiceField("",symbolStrings,0,Field.FIELD_L
protected void fieldChangeNotify(int context)
index = getSelectedIndex();
protected void layout(int width, int height)
width = SizeSpec.ChoiceWid;
height = SizeSpec.ChoiceHgt;
symbolImage = new BitmapField(downArrow.getBitmap(),BitmapField.FOCU
protected boolean navigationClick(int status,int time)
02-24-2010 06:23 AM
In future when you say "not working as expected" can you tell us what it is doing?
In this case I suspect nothing, because you have not used all the code I gave you.
I suggest you review my post again, looking at all the code.
But before your put the code in your program, look carefully at what is going on so you understand what the processing is actually doing. The code in your program should not be some magic incantation that you recite, You should understand it and what it is actually doing. If you don't understand it, you will never figure out what to do if it doesn't work or breaks will you!