Mercurial > dwindows
diff ios/dw.m @ 2602:cc5013e626f7
iOS: Code cleanup, make sure menu items are enabled on creation.
Add comment about storing menu IDs.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sun, 11 Jul 2021 21:41:44 +0000 |
parents | 3201f9e9067b |
children | 592f3003f853 |
line wrap: on
line diff
--- a/ios/dw.m Sun Jul 11 21:08:36 2021 +0000 +++ b/ios/dw.m Sun Jul 11 21:41:44 2021 +0000 @@ -2081,7 +2081,7 @@ _dw_event_handler(self, (id)params, 10); - if(window) + if(window && [window popupMenu]) { __block UIMenu *popupmenu = [[[window popupMenu] menu] retain]; config = [UIContextMenuConfiguration configurationWithIdentifier:nil @@ -7620,6 +7620,7 @@ item = [[DWMenuItem commandWithTitle:nstr image:nil action:@selector(menuHandler:) propertyList:nil] autorelease]; + /* Don't set the tag if the ID is 0 or -1 */ if(itemid != DW_MENU_AUTO && itemid != DW_MENU_POPUP) [item setTag:itemid]; [menu addItem:item]; @@ -7630,8 +7631,7 @@ if(flags & DW_MIS_CHECKED) [item setState:UIMenuElementStateOn]; } - if(flags & DW_MIS_DISABLED) - [item setEnabled:NO]; + [item setEnabled:(flags & DW_MIS_DISABLED ? NO : YES)]; if(submenux) {