1. RE: Menu needs coaxing
- Posted by "Greg Haberek" <ghaberek at gmail.com> Dec 12, 2007
- 552 views
I've used the IDE for quite some time now, and I've never seen this happen. What version of Windows are you running? Care to post the code (exw file) generated by the IDE? -Greg -----Original Message----- From: Mike777 [mailto:guest at RapidEuphoria.com] Sent: Wednesday, December 12, 2007 4:31 AM To: EUforum at topica.com Subject: Menu needs coaxing posted by: Mike777 <anon4321 at gm??l.com> I have a pretty standard window that I've created with a few controls using the Enhanced IDE, win32lib (the one you get with downloading the enhanced IDE). When the window is initially loaded and anytime I shift focus to another window (or program) and then back to my initial window, the menu bar isn't visible. This is going to sound weird, but..... it really is there. If I use the keyboard and key in alt-x where x is an accelerator key for the menu item, then the menu shows up. Or, at least, that portion of the menu. Once I'm focused on the menu bar, I can use the left and right arrows to "reveal" the other menu items. So what I'm looking for is a way to get the menu bars to show up without having the user "just know" that they are there and be forced to use an accelerator key. My guess is that I'm doing something pretty silly to cause this, but I don't have a clue what that might be. If anybody has any guesses, I'd appreciate hearing them. Thanks Mike
2. RE: Menu needs coaxing
- Posted by Mike777 <anon4321 at ?mail.c?m> Dec 12, 2007
- 542 views
Mike777 wrote: > > > I've used the IDE for quite some time now, and I've never seen this happen. > What version of Windows are you running? Care to post the code (exw file) > generated by the IDE? > > -Greg Greg, Sure. Here it is. There are two windows. The first is nothing more than a gateway to the second. If you run the code as shown and then click the SUBMIT button the "real" window opens up without the tool bar visible. It is there, just hit alt-F to prove it. Alt-F-X is the only way to exit the program, too as the "X" in the upper right isn't disabled, but still doesn't function. Change the last line to WinMain( Window2,Normal ) and re-run and the window opens just fine, along with the tool bar. Obviously, there are some formatting defaults of Window1 which carry over to Window2. Mike
-- code generated by Win32Lib IDE v1.0.2 Build Oct-09-2007 constant TheProgramType="exw" constant TheTitle = "Mike Test Program " constant TheAuthor = "Mike" constant TheVersion = "0.0.0.1" constant TheDate = "12/9/2007" constant TheWinlibVersion = "n/a" --Description: -- This program does very little --Comment: -- This is my first test include Win32Lib.ew without warning -------------------------------------------------------------------------------- -- Window Window2 global constant Window2 = createEx( Window, "Rxxxx v0.1alpha", 0, Default, Default, 1129, 734, 0, 0 ) constant mnu_File = createEx( Menu, "&File", Window2, 0, 0, 0, 0, 0, 0 ) constant mnu_File_New = createEx( MenuItem, "&New", mnu_File, 0, 0, 0, 0, 0, 0 ) constant mnu_File_Open = createEx( MenuItem, "&Open", mnu_File, 0, 0, 0, 0, 0, 0 ) constant mnu_File_Close = createEx( MenuItem, "&Close", mnu_File, 0, 0, 0, 0, 0, 0 ) constant mnu_File_Separator1 = createEx( MenuItem, "-----------", mnu_File, 0, 0, 0, 0, 0, 0 ) constant MenuItem_101 = createEx( MenuItem, "Menu Item101", mnu_File, 0, 0, 0, 0, 0, 0 ) constant Level2Menu_102 = createEx( Menu, "Level2Menu 102", mnu_File, 0, 0, 0, 0, 0, 0 ) constant Level2MenuItem_103 = createEx( MenuItem, "Level2Menu Item103", Level2Menu_102, 0, 0, 0, 0, 0, 0 ) constant mnu_File_Save = createEx( MenuItem, "&Save", mnu_File, 0, 0, 0, 0, 0, 0 ) constant mnu_File_SaveAs = createEx( MenuItem, "Save &As", mnu_File, 0, 0, 0, 0, 0, 0 ) constant mnu_File_Separator2 = createEx( MenuItem, "----------------", mnu_File, 0, 0, 0, 0, 0, 0 ) constant mnu_File_Exit = createEx( MenuItem, "E&xit", mnu_File, 0, 0, 0, 0, 0, 0 ) constant mnu_Edit = createEx( Menu, "&Edit", Window2, 0, 0, 0, 0, 0, 0 ) constant mnu_Edit_Cut = createEx( MenuItem, "Cu&t", mnu_Edit, 0, 0, 0, 0, 0, 0 ) constant mnu_Edit_Copy = createEx( MenuItem, "&Copy", mnu_Edit, 0, 0, 0, 0, 0, 0 ) constant mnu_Edit_Paste = createEx( MenuItem, "&Paste", mnu_Edit, 0, 0, 0, 0, 0, 0 ) constant mnu_Help = createEx( Menu, "&Help", Window2, 0, 0, 0, 0, 0, 0 ) constant mnu_Help_Help = createEx( MenuItem, "&Help", mnu_Help, 0, 0, 0, 0, 0, 0 ) constant mnu_Help_About = createEx( MenuItem, "&About", mnu_Help, 0, 0, 0, 0, 0, 0 ) constant CWindow13 = createEx( Window, "CWindow13", Window2, 728, 392, 200, 100, w32or_all({WS_CHILD}), 0 ) openWindow(CWindow13, Normal) constant StatusBar74 = createEx( StatusBar, "StatusBar74", Window2, 0, 0, 0, 0, 0, 0 ) global constant TreeView2 = createEx( TreeView, "TreeView2", Window2, 8, 28, 304, 620, w32or_all({TVS_HASLINES,TVS_LINESATROOT,TVS_HASBUTTONS,TVS_SHOWSELALWAYS}), 0 ) constant closefolder = addIcon( extractIcon("clsdfold.ico") ) constant openfolder = addIcon( extractIcon("openfold.ico") ) constant lblMainWindow = createEx( CText, "SYSTEM", Window2, 405, 32, 624, 32, 0, 0 ) setFont( lblMainWindow,"Arial",15,Italic+Bold+Underline) global constant cboGroupName = createEx( Combo, "", Window2, 432, 76, 588, 28*6, PBS_VERTICAL+LBS_NOINTEGRALHEIGHT, 0 ) setFont( cboGroupName,"Arial",12,Normal+Bold) addItem(cboGroupName, "AAAAA") addItem(cboGroupName, "BCA") addItem(cboGroupName, "MFA") constant lblGroupName = createEx( LText, "Group Name:", Window2, 328, 80, 104, 24, 0, 0 ) setFont( lblGroupName,"Arial",11,Normal+Bold) global constant cboSponsor = createEx( Combo, "", Window2, 432, 108, 588, 30*6, LBS_NOINTEGRALHEIGHT, 0 ) setFont( cboSponsor,"Arial",12,Normal+Bold) addItem(cboSponsor, "ABC, Inc.") addItem(cboSponsor, "XYZ, LLC") constant lblSponsor = createEx( LText, "Sponsor:", Window2, 328, 112, 104, 24, 0, 0 ) setFont( lblSponsor,"Arial",11,Normal+Bold) setHint( TreeView2,"This is the treeview control!") setHint( cboGroupName,"Enter the group name here") --------------------------------------------------------- -------------------------------------------------------------------------------- -- Window Window1 sequence IDEFlags IDEFlags = classDefaults(Window, { {1, {WS_SYSMENU}},{2, {WS_EX_DLGMODALFRAME}} } ) constant Window1 = createEx( Window, "Rxxxx v0.1alpha", 0, Center, Center, 586, 296, {WS_DLGFRAME, WS_SYSMENU, WS_MINIMIZEBOX}, {WS_EX_DLGMODALFRAME} ) constant lblPasswordScreen = createEx( LText, "Welcome to the System", Window1, 12, 4, 552, 32, 0, 0 ) setFont( lblPasswordScreen,"Trebuchet MS",14,Normal+Bold) constant grp_Login = createEx( Group, "Login", Window1, 132, 52, 304, 140, 0, 0 ) constant txt_UserName = createEx( EditText, "", grp_Login, 100, 16, 168, 28, 0, 0 ) constant lbl_UserName = createEx( LText, "User Name:", grp_Login, 36, 20, 64, 20, 0, 0 ) constant txtPassword = createEx( EditText, "", grp_Login, 100, 52, 168, 28, w32or_all({ES_PASSWORD}), 0 ) constant lbl_Password = createEx( LText, "Password:", grp_Login, 40, 56, 60, 20, 0, 0 ) constant btn_UserPassword = createEx( PushButton, "Submit", grp_Login, 180, 96, 88, 28, 0, 0 ) --------------------------------------------------------- -------------------------------------------------------------------------------- IDEFlags = classDefaults( Window, {{CCwinstyle,{0}}}) --------------------------------------------------------- -------------------------------------------------------------------------------- -- This is where the "General" code goes -------------------------------------------------------------------------------- procedure mnu_File_Exit_onClick (integer self, integer event, sequence params)--params is () closeApp() end procedure setHandler( mnu_File_Exit, w32HClick, routine_id("mnu_File_Exit_onClick")) -------------------------------------------------------------------------------- procedure mnu_Help_About_onClick (integer self, integer event, sequence params)--params is () integer MsgBox MsgBox = message_box("Created by Mike","", #40) end procedure setHandler( mnu_Help_About, w32HClick, routine_id("mnu_Help_About_onClick")) -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- procedure Window1_onOpen (integer self, integer event, sequence params)--params is () setFocus(txt_UserName) end procedure setHandler( Window1, w32HOpen, routine_id("Window1_onOpen")) -------------------------------------------------------------------------------- procedure Window1_onActivate (integer self, integer event, sequence params)--params is () setFocus(txt_UserName) end procedure setHandler( Window1, w32HActivate, routine_id("Window1_onActivate")) -------------------------------------------------------------------------------- procedure btn_UserPassword_onClick (integer self, integer event, sequence params)--params is () -- VOID = message_box("Bypassing user logic for now","USER AND PASSWORD INFORMATION",0) setFocus(txt_UserName) setVisible(Window2,1) setVisible(Window1,0) end procedure setHandler( btn_UserPassword, w32HClick, routine_id("btn_UserPassword_onClick")) -------------------------------------------------------------------------------- procedure btn_UserPassword_onKeyPress (integer self, integer event, sequence params)--params is ( int keyCode, int shift ) -- VOID = message_box("params[1]=["¶ms[1]&"]"&"params[2]"¶ms[2]&"]","",0) if params[1] = VK_ENTER then -- VOID = message_box("vkenter=["¶ms[1]&"]"&"params[2]"¶ms[2]&"]","",0) btn_UserPassword_onClick(self,event,params) end if end procedure setHandler( btn_UserPassword, w32HKeyPress, routine_id("btn_UserPassword_onKeyPress")) --------------------------------------------------------- WinMain( Window1,Normal )
3. RE: Menu needs coaxing
- Posted by "Greg Haberek" <ghaberek at gmail.com> Dec 12, 2007
- 524 views
- Last edited Dec 13, 2007
After perusing around the code, I'm gonna say this is less a Win32Lib bug and more a lack of understanding or just plain old poor coding (no offense). Win32Lib assumes that the first window you create will be the main Window. So when you call WinMain() with the second window you created (Window1 in this case), things got really screwed up. Here's a simple example of how to implement a login box like you want. I hope my comments help explain how things happen the way they do.
include Win32Lib.ew without warning -- this is the main window, with a file menu constant Window1 = createEx( Window, "Main Window", 0, Default, Default, 640, 480, 0, 0 ) constant MenuFile = createEx( Menu, "&File", Window1, 0, 0, 0, 0, 0, 0 ) constant FileNone = createEx( MenuItem, "Do &Nothing...", MenuFile, 0, 0, 0, 0, 0, 0 ) constant FileSep = createEx( MenuItem, "-", MenuFile, 0, 0, 0, 0, 0, 0 ) constant FileExit = createEx( MenuItem, "E&xit", MenuFile, 0, 0, 0, 0, w32AUTOCLOSE, 0 ) -- this is the login dialog box constant Window2 = createEx( Window, "Login", 0, Center, Center, 320, 180, {WS_DLGFRAME}, 0 ) constant Username = createEx( EditText, "Username", Window2, 10, 10, 290, 20, 0, 0 ) constant Password = createEx( EditText, "Password", Window2, 10, 40, 290, 20, ES_PASSWORD, 0 ) constant Button1 = createEx( DefPushButton, "Login", Window2, 65, 100, 90, 30, 0, 0 ) constant Button2 = createEx( PushButton, "Don't Login", Window2, 165, 100, 90, 30, 0, 0 ) -- here's our login flag integer login_success -- assume the user hasn't logged in yet login_success = w32False procedure Window1_onOpen( integer self, integer event, sequence params ) -- this event triggers before the window becomes visible -- (w32HActivate triggers afterwards) -- openDialog does not return -- until the window is closed openDialog( Window2 ) -- if the login failed, -- don't let the window open if not login_success then -- let the user know they -- did something wrong VOID = message_box( "Login failed!", "Message Box", MB_ICONEXCLAMATION ) -- returning -1 prevents the -- window from loading any further returnValue( -1 ) end if end procedure setHandler( Window1, w32HOpen, routine_id("Window1_onOpen") ) procedure Button1_onClick( integer self, integer event, sequence params ) if self = Button1 then -- user clicked the 'Login' button -- here we should validate their information login_success = w32True elsif self = Button2 then -- user clicked the 'Don't Login' button -- maybe do some sort of cleanup here end if -- either way, close the window closeWindow( Window2 ) end procedure setHandler( {Button1, Button2}, w32HClick, routine_id("Button1_onClick") ) WinMain( Window1, Normal )
Hope this helps! -Greg -----Original Message----- From: Mike777 [mailto:guest at RapidEuphoria.com] Sent: Wednesday, December 12, 2007 1:35 PM To: EUforum at topica.com Subject: RE: Menu needs coaxing posted by: Mike777 <anon4321 at ?mail.c?m> Mike777 wrote: > > > I've used the IDE for quite some time now, and I've never seen this happen. > What version of Windows are you running? Care to post the code (exw > file) generated by the IDE? > > -Greg Greg, Sure. Here it is. There are two windows. The first is nothing more than a gateway to the second. If you run the code as shown and then click the SUBMIT button the "real" window opens up without the tool bar visible. It is there, just hit alt-F to prove it. Alt-F-X is the only way to exit the program, too as the "X" in the upper right isn't disabled, but still doesn't function. Change the last line to WinMain( Window2,Normal ) and re-run and the window opens just fine, along with the tool bar. Obviously, there are some formatting defaults of Window1 which carry over to Window2. Mike
-- code generated by Win32Lib IDE v1.0.2 Build Oct-09-2007 constant TheProgramType="exw" constant TheTitle = "Mike Test Program " constant TheAuthor = "Mike" constant TheVersion = "0.0.0.1" constant TheDate = "12/9/2007" constant TheWinlibVersion = "n/a" --Description: -- This program does very little --Comment: -- This is my first test include Win32Lib.ew without warning ---------------------------------------------------------------------------- ---- -- Window Window2 global constant Window2 = createEx( Window, "Rxxxx v0.1alpha", 0, Default, Default, 1129, 734, 0, 0 ) constant mnu_File = createEx( Menu, "&File", Window2, 0, 0, 0, 0, 0, 0 ) constant mnu_File_New = createEx( MenuItem, "&New", mnu_File, 0, 0, 0, 0, 0, 0 ) constant mnu_File_Open = createEx( MenuItem, "&Open", mnu_File, 0, 0, 0, 0, 0, 0 ) constant mnu_File_Close = createEx( MenuItem, "&Close", mnu_File, 0, 0, 0, 0, 0, 0 ) constant mnu_File_Separator1 = createEx( MenuItem, "-----------", mnu_File, 0, 0, 0, 0, 0, 0 ) constant MenuItem_101 = createEx( MenuItem, "Menu Item101", mnu_File, 0, 0, 0, 0, 0, 0 ) constant Level2Menu_102 = createEx( Menu, "Level2Menu 102", mnu_File, 0, 0, 0, 0, 0, 0 ) constant Level2MenuItem_103 = createEx( MenuItem, "Level2Menu Item103", Level2Menu_102, 0, 0, 0, 0, 0, 0 ) constant mnu_File_Save = createEx( MenuItem, "&Save", mnu_File, 0, 0, 0, 0, 0, 0 ) constant mnu_File_SaveAs = createEx( MenuItem, "Save &As", mnu_File, 0, 0, 0, 0, 0, 0 ) constant mnu_File_Separator2 = createEx( MenuItem, "----------------", mnu_File, 0, 0, 0, 0, 0, 0 ) constant mnu_File_Exit = createEx( MenuItem, "E&xit", mnu_File, 0, 0, 0, 0, 0, 0 ) constant mnu_Edit = createEx( Menu, "&Edit", Window2, 0, 0, 0, 0, 0, 0 ) constant mnu_Edit_Cut = createEx( MenuItem, "Cu&t", mnu_Edit, 0, 0, 0, 0, 0, 0 ) constant mnu_Edit_Copy = createEx( MenuItem, "&Copy", mnu_Edit, 0, 0, 0, 0, 0, 0 ) constant mnu_Edit_Paste = createEx( MenuItem, "&Paste", mnu_Edit, 0, 0, 0, 0, 0, 0 ) constant mnu_Help = createEx( Menu, "&Help", Window2, 0, 0, 0, 0, 0, 0 ) constant mnu_Help_Help = createEx( MenuItem, "&Help", mnu_Help, 0, 0, 0, 0, 0, 0 ) constant mnu_Help_About = createEx( MenuItem, "&About", mnu_Help, 0, 0, 0, 0, 0, 0 ) constant CWindow13 = createEx( Window, "CWindow13", Window2, 728, 392, 200, 100, w32or_all({WS_CHILD}), 0 ) openWindow(CWindow13, Normal) constant StatusBar74 = createEx( StatusBar, "StatusBar74", Window2, 0, 0, 0, 0, 0, 0 ) global constant TreeView2 = createEx( TreeView, "TreeView2", Window2, 8, 28, 304, 620, w32or_all({TVS_HASLINES,TVS_LINESATROOT,TVS_HASBUTTONS,TVS_SHOWSELALWAYS}), 0 ) constant closefolder = addIcon( extractIcon("clsdfold.ico") ) constant openfolder = addIcon( extractIcon("openfold.ico") ) constant lblMainWindow = createEx( CText, "SYSTEM", Window2, 405, 32, 624, 32, 0, 0 ) setFont( lblMainWindow,"Arial",15,Italic+Bold+Underline) global constant cboGroupName = createEx( Combo, "", Window2, 432, 76, 588, 28*6, PBS_VERTICAL+LBS_NOINTEGRALHEIGHT, 0 ) setFont( cboGroupName,"Arial",12,Normal+Bold) addItem(cboGroupName, "AAAAA") addItem(cboGroupName, "BCA") addItem(cboGroupName, "MFA") constant lblGroupName = createEx( LText, "Group Name:", Window2, 328, 80, 104, 24, 0, 0 ) setFont( lblGroupName,"Arial",11,Normal+Bold) global constant cboSponsor = createEx( Combo, "", Window2, 432, 108, 588, 30*6, LBS_NOINTEGRALHEIGHT, 0 ) setFont( cboSponsor,"Arial",12,Normal+Bold) addItem(cboSponsor, "ABC, Inc.") addItem(cboSponsor, "XYZ, LLC") constant lblSponsor = createEx( LText, "Sponsor:", Window2, 328, 112, 104, 24, 0, 0 ) setFont( lblSponsor,"Arial",11,Normal+Bold) setHint( TreeView2,"This is the treeview control!") setHint( cboGroupName,"Enter the group name here") --------------------------------------------------------- ---------------------------------------------------------------------------- ---- -- Window Window1 sequence IDEFlags IDEFlags = classDefaults(Window, { {1, {WS_SYSMENU}},{2, {WS_EX_DLGMODALFRAME}} } ) constant Window1 = createEx( Window, "Rxxxx v0.1alpha", 0, Center, Center, 586, 296, {WS_DLGFRAME, WS_SYSMENU, WS_MINIMIZEBOX}, {WS_EX_DLGMODALFRAME} ) constant lblPasswordScreen = createEx( LText, "Welcome to the System", Window1, 12, 4, 552, 32, 0, 0 ) setFont( lblPasswordScreen,"Trebuchet MS",14,Normal+Bold) constant grp_Login = createEx( Group, "Login", Window1, 132, 52, 304, 140, 0, 0 ) constant txt_UserName = createEx( EditText, "", grp_Login, 100, 16, 168, 28, 0, 0 ) constant lbl_UserName = createEx( LText, "User Name:", grp_Login, 36, 20, 64, 20, 0, 0 ) constant txtPassword = createEx( EditText, "", grp_Login, 100, 52, 168, 28, w32or_all({ES_PASSWORD}), 0 ) constant lbl_Password = createEx( LText, "Password:", grp_Login, 40, 56, 60, 20, 0, 0 ) constant btn_UserPassword = createEx( PushButton, "Submit", grp_Login, 180, 96, 88, 28, 0, 0 ) --------------------------------------------------------- ---------------------------------------------------------------------------- ---- IDEFlags = classDefaults( Window, {{CCwinstyle,{0}}}) --------------------------------------------------------- ---------------------------------------------------------------------------- ---- -- This is where the "General" code goes ---------------------------------------------------------------------------- ---- procedure mnu_File_Exit_onClick (integer self, integer event, sequence params)--params is () closeApp() end procedure setHandler( mnu_File_Exit, w32HClick, routine_id("mnu_File_Exit_onClick")) ---------------------------------------------------------------------------- ---- procedure mnu_Help_About_onClick (integer self, integer event, sequence params)--params is () integer MsgBox MsgBox = message_box("Created by Mike","", #40) end procedure setHandler( mnu_Help_About, w32HClick, routine_id("mnu_Help_About_onClick")) ---------------------------------------------------------------------------- ---- ---------------------------------------------------------------------------- ---- ---------------------------------------------------------------------------- ---- ---------------------------------------------------------------------------- ---- procedure Window1_onOpen (integer self, integer event, sequence params)--params is () setFocus(txt_UserName) end procedure setHandler( Window1, w32HOpen, routine_id("Window1_onOpen")) ---------------------------------------------------------------------------- ---- procedure Window1_onActivate (integer self, integer event, sequence params)--params is () setFocus(txt_UserName) end procedure setHandler( Window1, w32HActivate, routine_id("Window1_onActivate")) ---------------------------------------------------------------------------- ---- procedure btn_UserPassword_onClick (integer self, integer event, sequence params)--params is () -- VOID = message_box("Bypassing user logic for now","USER AND PASSWORD INFORMATION",0) setFocus(txt_UserName) setVisible(Window2,1) setVisible(Window1,0) end procedure setHandler( btn_UserPassword, w32HClick, routine_id("btn_UserPassword_onClick")) ---------------------------------------------------------------------------- ---- procedure btn_UserPassword_onKeyPress (integer self, integer event, sequence params)--params is ( int keyCode, int shift ) -- VOID = message_box("params[1]=["¶ms[1]&"]"&"params[2]"¶ms[2]&"]","",0) if params[1] = VK_ENTER then -- VOID = message_box("vkenter=["¶ms[1]&"]"&"params[2]"¶ms[2]&"]","",0) btn_UserPassword_onClick(self,event,params) end if end procedure setHandler( btn_UserPassword, w32HKeyPress, routine_id("btn_UserPassword_onKeyPress")) WinMain( Window1,Normal )
4. RE: Menu needs coaxing
- Posted by Mike777 <anon4321 at gma?l.com> Dec 12, 2007
- 515 views
- Last edited Dec 13, 2007
Greg Haberek wrote: > > > After perusing around the code, I'm gonna say this is less a Win32Lib bug > and more a lack of understanding or just plain old poor coding (no offense). None taken. I'll cop to both, even though I'm trying to use the IDE to generate the code, I understand I have to do things in the right order, too. > Win32Lib assumes that the first window you create will be the main Window. > So when you call WinMain() with the second window you created (Window1 in > this case), things got really screwed up. Here's a simple example of how to > implement a login box like you want. I hope my comments help explain how > things happen the way they do. They do and I'll make the changes you describe later, one at a time, to make sure I understand. Many thanks. Mike