1. Creating popup menu with sub menus causes crash
- Posted by wynco Dec 13, 2010
- 1245 views
I have a program that uses popup menus with sub menus. the sub menus work fine, but when I mouse over the last menu item I get the following error.
c:\euphoria\win32lib\include\Win32Lib.ew:23698 in function fDoMENUSELECT()
subscript value 11 is out of bounds, reading from a sequence of length 7
The code causing this error follows
I tried several ways to create the popup. If the sub menu's parent is the popup itself it wont show, if you try to assign a popup as a sub menu I get
Error Code 441
AppendMenu in createMenu failed.
Also interesting is if I add 4 seperator lines to the end of the menu, it won't crash, but looks unprofessional. It seems that the sub menus add a working line to the menu, but not to the structure in some way. Any idea what is wrong and how to fix it.
constant OTP = createEx(Popup, "Main", Window1, 0, 0, 0, 0, 0, 0) constant OTP_SelectItem = createEx(MenuItem, "Expand Item", OTP, 0, 0, 0, 0, 0, 0) constant OTP_Space1 = createEx(MenuItem, "-", OTP, 0, 0, 0, 0, 0, 0) constant OTP_AddToProjectMenu = createEx(Menu, "Add to Project", OTP_Space1, 0, 0, 0, 0, 0, 0) constant OTP_AddAll = createEx(MenuItem, "All Files in Folder", OTP_AddToProjectMenu, 0, 0, 0, 0, 0, 0) constant OTP_AddAllPlus = createEx(MenuItem, "All Files in Folder and Subfolders", OTP_AddToProjectMenu, 0, 0, 0, 0, 0, 0) constant OTP_RemoveFromProjectMenu = createEx(Menu, "Remove From Project", OTP_SelectItem, 0, 0, 0, 0, 0, 0) constant OTP_RemoveAll = createEx(MenuItem, "All Files in Folder", OTP_RemoveFromProjectMenu, 0, 0, 0, 0, 0, 0) constant OTP_RemoveAllPlus = createEx(MenuItem, "All Files in Folder and Subfolders", OTP_RemoveFromProjectMenu, 0, 0, 0, 0, 0, 0) constant OTP_Space2 = createEx(MenuItem, "-", OTP, 0, 0, 0, 0, 0, 0) constant OTP_Copy = createEx(MenuItem, "Copy to Destination", OTP, 0, 0, 0, 0, 0, 0) constant OTP_Move = createEx(MenuItem, "Move to Destination", OTP, 0, 0, 0, 0, 0, 0) constant OTP_Rename = createEx(MenuItem, "Rename...", OTP, 0, 0, 0, 0, 0, 0) constant OTP_DeleteMenu = createEx(Menu, "Delete", OTP_Rename, 0, 0, 0, 0, 0, 0) constant OTP_QuickDelete = createEx(MenuItem, "Quick", OTP_DeleteMenu, 0, 0, 0, 0, 0, 0) constant OTP_SecureDelete = createEx(MenuItem, "Secure", OTP_DeleteMenu, 0, 0, 0, 0, 0, 0) constant OTP_Space3 = createEx(MenuItem, "-", OTP, 0, 0, 0, 0, 0, 0) constant OTP_NewFolder = createEx(MenuItem, "New Folder...", OTP, 0, 0, 0, 0, 0, 0) constant OTP_Space4 = createEx(MenuItem, "-", OTP, 0, 0, 0, 0, 0, 0) constant OTP_HelpMenu = createEx(Menu, "Help", OTP_Space4, 0, 0, 0, 0, 0, 0) constant OTP_HelpTree = createEx(MenuItem, "Origin Tree", OTP_HelpMenu, 0, 0, 0, 0, 0, 0) constant OTP_HelpThis = createEx(MenuItem, "This Menu", OTP_HelpMenu, 0, 0, 0, 0, 0, 0)
2. Re: Creating popup menu with sub menus causes crash
- Posted by wynco Dec 24, 2010
- 1199 views
I have a program that uses popup menus with sub menus. the sub menus work fine, but when I mouse over the last menu item I get the following error.
c:\euphoria\win32lib\include\Win32Lib.ew:23698 in function fDoMENUSELECT()
subscript value 11 is out of bounds, reading from a sequence of length 7
The code causing this error follows
I tried several ways to create the popup. If the sub menu's parent is the popup itself it wont show, if you try to assign a popup as a sub menu I get
Error Code 441
AppendMenu in createMenu failed.
Also interesting is if I add 4 seperator lines to the end of the menu, it won't crash, but looks unprofessional. It seems that the sub menus add a working line to the menu, but not to the structure in some way. Any idea what is wrong and how to fix it.
constant OTP = createEx(Popup, "Main", Window1, 0, 0, 0, 0, 0, 0) constant OTP_SelectItem = createEx(MenuItem, "Expand Item", OTP, 0, 0, 0, 0, 0, 0) constant OTP_Space1 = createEx(MenuItem, "-", OTP, 0, 0, 0, 0, 0, 0) constant OTP_AddToProjectMenu = createEx(Menu, "Add to Project", OTP_Space1, 0, 0, 0, 0, 0, 0) constant OTP_AddAll = createEx(MenuItem, "All Files in Folder", OTP_AddToProjectMenu, 0, 0, 0, 0, 0, 0) constant OTP_AddAllPlus = createEx(MenuItem, "All Files in Folder and Subfolders", OTP_AddToProjectMenu, 0, 0, 0, 0, 0, 0) constant OTP_RemoveFromProjectMenu = createEx(Menu, "Remove From Project", OTP_SelectItem, 0, 0, 0, 0, 0, 0) constant OTP_RemoveAll = createEx(MenuItem, "All Files in Folder", OTP_RemoveFromProjectMenu, 0, 0, 0, 0, 0, 0) constant OTP_RemoveAllPlus = createEx(MenuItem, "All Files in Folder and Subfolders", OTP_RemoveFromProjectMenu, 0, 0, 0, 0, 0, 0) constant OTP_Space2 = createEx(MenuItem, "-", OTP, 0, 0, 0, 0, 0, 0) constant OTP_Copy = createEx(MenuItem, "Copy to Destination", OTP, 0, 0, 0, 0, 0, 0) constant OTP_Move = createEx(MenuItem, "Move to Destination", OTP, 0, 0, 0, 0, 0, 0) constant OTP_Rename = createEx(MenuItem, "Rename...", OTP, 0, 0, 0, 0, 0, 0) constant OTP_DeleteMenu = createEx(Menu, "Delete", OTP_Rename, 0, 0, 0, 0, 0, 0) constant OTP_QuickDelete = createEx(MenuItem, "Quick", OTP_DeleteMenu, 0, 0, 0, 0, 0, 0) constant OTP_SecureDelete = createEx(MenuItem, "Secure", OTP_DeleteMenu, 0, 0, 0, 0, 0, 0) constant OTP_Space3 = createEx(MenuItem, "-", OTP, 0, 0, 0, 0, 0, 0) constant OTP_NewFolder = createEx(MenuItem, "New Folder...", OTP, 0, 0, 0, 0, 0, 0) constant OTP_Space4 = createEx(MenuItem, "-", OTP, 0, 0, 0, 0, 0, 0) constant OTP_HelpMenu = createEx(Menu, "Help", OTP_Space4, 0, 0, 0, 0, 0, 0) constant OTP_HelpTree = createEx(MenuItem, "Origin Tree", OTP_HelpMenu, 0, 0, 0, 0, 0, 0) constant OTP_HelpThis = createEx(MenuItem, "This Menu", OTP_HelpMenu, 0, 0, 0, 0, 0, 0)
I stumbled on a fix
if I change the first line to the following it works perfectly
it seems that not supplying a name for the menu will keep it from showing up in the menu bar but I can still 'Popup' the menu where I need it.
Made my day!
constant OTP = createEx(Menu, "", CryptemMainWindow, 0, 0, 0, 0, 0, 0)