try this
BaseItem[] biMenu = menu.getItems();
for (int i = 0; i < biMenu.length; i++) {
CheckMenuItem menuItem = (CheckMenuItem
)menu.getItem(biMenu[i].getId());
}
PD: I dont know if this will return a BaseItem like getItems().
Regards,
_____________________
Ing. Gabriel Gutiérrez
On Thu, May 28, 2009 at 11:16 AM, Patrizio De Michele
<[email protected]>wrote:
> Hi,
> it's the second time i meet a strange (for me) problem using Menu.
> i have a ToolBarMenuButton with attached a Menu, this menu
> contains various CheckMenuItems.....
> When i call menu.getItems() it returns an array of BaseItem and not
> CheckItem so i can't call item.isChecked() to control if is checked or not.
> Did someone encountered the same problem?
> Did you know a solution/trickaround?
> Is it my fault assuming that getItems() should return CheckItem instead of
> BaseMenuItem?
>
> Source Code Follows:
> .
> .
> .
> .
> final ToolbarMenuButton toolbarMenuCCButton = new
> ToolbarMenuButton("CODES");
> //menu creation
> final Menu menu = new Menu();
> int i=0;
> for (Iterator<String> iterator = codes.iterator(); iterator.hasNext(); ++i)
> {
> final CheckItem checkItem = new CheckItem(iterator.next());
> menu.addItem(checkItem);
> }
> toolbarMenuCCButton.setMenu(menu);
>
> //item retrieving
> BaseItem[] biMenu = menu.getItems();
> for (int i = 0; i < biMenu.length; i++) {
> if (((CheckItem)biMenu[i]).isChecked()) {//this doesn't work because
> isn't a CheckItem but a BaseItem
> choosedCcodes.add(biMenu[i].getTitle());
> }
> }
> .
> .
> .
>
> I hope someone could help me,
> bye Patrizio
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"GWT-Ext Developer Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/gwt-ext?hl=en
-~----------~----~----~----~------~----~------~--~---