This is only happened if the window is invisible while I'm creating the menu and only at menuItem "copy".
The count of menuItems is 1 this means the separator and the item "Special Characters…" isn't count.
Any idea why this is happened?
How can I remove this item?
Code: Select all
Global Window_0
ImportC ""
sel_registerName(MethodName.P-ASCII)
EndImport
Procedure OpenWindow_0(x = 0, y = 0, width = 450, height = 160)
Window_0 = OpenWindow(#PB_Any, x, y, width, height, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_Invisible)
CreateMenu(0, WindowID(Window_0))
If MenuTitle("Edit")
MenuArray = MenuID(0)
MenuTitle = CocoaMessage(0, MenuArray, "objectAtIndex:",0)
CocoaMessage(0, MenuTitle, "addItemWithTitle:$", @"Copy", "action:", sel_registerName("copy:"), "keyEquivalent:$", @"c")
; CocoaMessage(0, MenuTitle, "addItemWithTitle:$", @"Paste", "action:", sel_registerName("paste:"), "keyEquivalent:$", @"v")
Debug "count of menuItems " +CocoaMessage(0, MenuTitle, "numberOfItems")
EndIf
HideWindow(Window_0, #False)
EndProcedure
Procedure Window_0_Events(event)
Select event
Case #PB_Event_CloseWindow
ProcedureReturn #False
Case #PB_Event_Menu
Select EventMenu()
Case #PB_Menu_Quit
ProcedureReturn #False
EndSelect
Case #PB_Event_Gadget
Select EventGadget()
EndSelect
EndSelect
ProcedureReturn #True
EndProcedure
OpenWindow_0()
Repeat
event = WaitWindowEvent()
Until Window_0_Events(event) = #False