Sorry to followup my own post, but here is a surprising symptom, and some thoughts on the matter.
During the debugging session described below, I discovered some unexpected behavior that meant that each time I Resized my windows, I wound up with the size of the window from the previous attempt to resize. So I was delayed by one Resize. By the nature of the application, this wasn't a problem, as I don't actually Resize often, and usually the actual size stays the same. But I fixed it anyway, and then got a modified behavior from my windows. With the debugging code disabled, and a lot of stuff done while the window is not visible before calling Win32::GUI::Dialog, when my main window now "appears" for the first time, it is missing its menu. In its place is the leftovers from whatever is behind the menu; the menu doesn't get drawn, and the area where the menu should be doesn't get drawn! The really bizarre effect came into play when I attempted (on Win9x, this all works fine on NT, remember) to use the application. I clicked a button in my script that launched a program, and a menu got drawn on my window!!!! But the really, really strange part was that it was the menu from the program I launched (not written using perl or Win32::GUI), not the menu that should belong to the window. This makes me speculate that perhaps menus are handled in some bizarre global manner on Win9x, and that the sequence of things is very important, and that Win32::GUI gets it slightly wrong??? I have two windows in my application, and when I started playing with menus, I only added menus to the main window (so far), and not to the other window. But the sequence of events in my program is to initialize a junk window (which goes away, to avoid my main window being in the task bar), then to initialize the main window (with the junk window as a parent), then to discard the junk window, then to add all the widgets to the main window, then to resize and move it to where it belongs, to display it briefly, and then to hide and disable it while I initialize a dialog window, add lots of widgets to it, resize and move it, display it briefly, and then hide it. Then I enable the main window, show it, and call Win32::GUI::Dialog. However, in debugging, I was able to produce the same effect without even creating the dialog window, but otherwise following the same sequence. While I'm not ready to share this code with the world, if any one would like to look at it that has more Windows knowledge than I, I could share it with a few. The next time the window is moved or resized by the user to a different location or size, the window will redraw, repositioning everything as if the window never had a menu, which was the state I used to initially see due to the above mentioned unexpected resize behavior... thus making me think the menu had never shown up, when it fact it had, and then had been deleted (behind my back as far as I can tell), and everything moved up a few pixels (yes, it was blank at the bottom). So why is my menu disappearing? I suppose I could try putting it back, with AddMenu? I haven't found an example of that, does it work? But while that might work around the problem, I must still wonder what memory gets corrupted when the menu disappears, and what negative effects that might have on the stability of Win9x (since that isn't very stable in the first place, I don't want to make it worse with my program). === Original message === That was a good clue, Andrew, and I've done some more analysis. Indeed, if I throw in some $mw -> Show (), and some Win32::GUI::DoEvents () into my initialization routines, I get some extra interesting data. I'm not sure yet what all it means, or why it happens. Here's my added knowledge: Indeed, the menu shows up when initially created. Then I add a bunch of widgets, and it takes more space than my initial size. So I Resize and Move the window. This seems to work fine. Then I Hide and Disable the window, do lots of other setup (theoretically, none of it applies to the main window, but an alternate window gets fully initialized, displayed briefly, and then Hide and Disable. Then, eventually, back to the main window, and we Enable and Show it, and when we do, in the next of my debug Show calls, the menu doesn't get redrawn--the area where the menu should be is left with the desktop displayed there. That's kind of like a hole in the window. Then, because I'm afraid some user might have adjusted the toolbars to cover part of my window, I recheck that, to potentially change the postition. So I go through the motions of a Resize and Move again, and on the next Show after the Resize, the hole where the menu should have been gets filled in with the stuff that should be below the menu... i.e. that stuff gets "moved up", apparently because the menu is now gone. The real question is, Where, oh where did my menu go? Oh where, oh where can it be? I guess I'll be debugging by removing code until I can make the behavior disappear, if I can. Any clues would be appreciated. Andrew Kincaid wrote: > Using your exact code on a Windows 95B and a Windows 98SE machine running > Activestate Perl v.5.6.1.626 and Win32::GUI 0.0.558, I added the following > lines to the end of your code: > > $W = new Win32::GUI::Window( > -title => "Title Here", > -left => 100, > -top => 100, > -width => 400, > -height => 400, > -style => WS_OVERLAPPEDWINDOW, > -menu => $mmenu, > -name => "Window", > ); > $W->Show(); > Win32::GUI::Dialog(); > > and it ran fine. I also used -menu => $smenu and it worked fine as well. > I'm not sure what to say unless you want to send more or all of your code. > > Andrew Kincaid > Lead PC Systems Specialist, IS&T > Georgia State University > [EMAIL PROTECTED] > > >>> [EMAIL PROTECTED] 06/19/01 09:07PM >>> > Hi, > > Is there a difference between Win 9x and NT for putting a menu on a > window using Win32::GUI? > > I added a bunch of menus to my application, and they show up fine on NT, > but they don't appear at all on Win 98. In fact, at first they caused > perl to crash on Win 98... but upgrading to build 626 seems to have > cured the bad memory reference, but the menus don't appear. > > Curiously, the floating menu that I added to my NotifyIcon does appear > on Win98. > > Here's my menu definition, in case there is something obviously wrong > with it.... > > my $mmenu = new Win32::GUI::Menu ( > "&File" => "FileMenu", > ">New &Location" => "NewLoc", > ">New &ISP" => "NewISP", > ">New &Phone Number" => "NewNum", > ">-" => 0, > ">E&xit" => "ExitNow", > "&Edit" => "EditMenu", > ">Edit Selected &Location" => "EditLoc", > ">Edit Selected &ISP" => "EditISP", > ">Edit Selected &Phone Number" => "EditNum", > "&Options" => "OptMenu", > "&Dialing" => "DialMenu", > ">&Dial" => "DialNow", > ">&Hangup" => "HangupNow", > ">&Launch Email" => "LaunchNow", > "&Help" => "HelpMenu", > ">&Help Text" => "HelpNow", > ">&About" => "AboutNow", > ">-" => 0, > ">Show &Debug Window" => "DebugNow", > ); > > $smenu = new Win32::GUI::Menu ( > "&Dialing" => "sDialMenu", > ">&Dial" => "sDialNow", > ">&Hangup" => "sHangupNow", > ">&Launch Email" => "sLaunchNow", > ">-" => 0, > ">&Bring to Front" => "sForeground", > ); > > -- > Glenn > ===== > Due to the current economic situation, the light at the > end of the tunnel will be turned off until further notice. > > _______________________________________________ > Perl-Win32-GUI-Users mailing list > Perl-Win32-GUI-Users@lists.sourceforge.net > http://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users > > _______________________________________________ > Perl-Win32-GUI-Users mailing list > Perl-Win32-GUI-Users@lists.sourceforge.net > http://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users -- Glenn ===== Due to the current economic situation, the light at the end of the tunnel will be turned off until further notice. _______________________________________________ Perl-Win32-GUI-Users mailing list Perl-Win32-GUI-Users@lists.sourceforge.net http://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users