From: Piske, H. <Har...@bo...> - 2001-06-07 02:12:57
Attachments:
X.PL
|
Works with me ... I have two windows, one button in the first window brings the other to top. Complete code snippet attached for you to check if it works with you and figure out the differences to yours. Oh, and I only checked on Win2k. Have fun, Harald > -----Original Message----- > From: Glenn Linderman [mailto:Gle...@ne...] > Sent: Mittwoch, 6. Juni 2001 18:25 > To: Win32::GUI > Subject: [perl-win32-gui-users] BringWindowToTop doesn't > > > Hi, > > So I've got this code, and it doesn't bring the window to the top. I > can see that each time I click on the notify icon that the code gets > executed, both because the print statement fires, and the window > redraws. But the window stays behind other windows, in spite of the > BringWindowToTop call. It does that with or without the Hide/Show > sequence, and with or with a Disable/Enable sequence wrapped > around the > BringWindowToTop. ActivePerl 5.6.1 build 626, Win32::GUI > 0.0.558. What > trick am I missing? > > I'm quite willing to throw all this away, and use whatever > works... this > is just what sounded like should work from the documentation. > > I should note that $mw is using the "parent window" trick to > avoid being > on the task bar. I further note that sufficient Alt-Tab keystrokes do > eventually raise the window to the top. > > sub notify_icon_Click > { if ( $mw -> IsVisible ()) > { print "Bring Main to Top\n"; > $mw -> Hide (); > $mw -> BringWindowToTop (); > $mw -> Show (); > } > } > > -- > 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 > Per...@li... > http://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users > |
From: Peter E. <Pet...@at...> - 2001-06-07 15:51:06
|
I've used SetForegroundWindow() from a NotifyIcon and that works on NT4. sub ni_Click { if ($Window->IsVisible) { $Window->Hide(); } else { $Window->Show(); $Window->SetForegroundWindow(); } return 0; } > -----Original Message----- > From: Piske, Harald [mailto:Har...@bo...] > Sent: Wednesday, June 06, 2001 10:12 PM > To: 'per...@li...' > Subject: RE: [perl-win32-gui-users] BringWindowToTop doesn't > > > Works with me ... I have two windows, one button in the first > window brings > the other to top. Complete code snippet attached for you to > check if it > works with you and figure out the differences to yours. Oh, and I only > checked on Win2k. > > Have fun, > Harald > > > -----Original Message----- > > From: Glenn Linderman [mailto:Gle...@ne...] > > Sent: Mittwoch, 6. Juni 2001 18:25 > > To: Win32::GUI > > Subject: [perl-win32-gui-users] BringWindowToTop doesn't > > > > > > Hi, > > > > So I've got this code, and it doesn't bring the window to > the top. I > > can see that each time I click on the notify icon that the code gets > > executed, both because the print statement fires, and the window > > redraws. But the window stays behind other windows, in spite of the > > BringWindowToTop call. It does that with or without the Hide/Show > > sequence, and with or with a Disable/Enable sequence wrapped > > around the > > BringWindowToTop. ActivePerl 5.6.1 build 626, Win32::GUI > > 0.0.558. What > > trick am I missing? > > > > I'm quite willing to throw all this away, and use whatever > > works... this > > is just what sounded like should work from the documentation. > > > > I should note that $mw is using the "parent window" trick to > > avoid being > > on the task bar. I further note that sufficient Alt-Tab > keystrokes do > > eventually raise the window to the top. > > > > sub notify_icon_Click > > { if ( $mw -> IsVisible ()) > > { print "Bring Main to Top\n"; > > $mw -> Hide (); > > $mw -> BringWindowToTop (); > > $mw -> Show (); > > } > > } > > > > -- > > 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 > > Per...@li... > > http://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users > > > > |
From: Glenn L. <Gle...@ne...> - 2001-06-07 17:46:55
|
Thanks so much. That does it for me too. SetForegroundWindow is the key API for this functionality. Side note TWIMC: the Windows API is clearly too big, with too many ways to do the wrong thing, but that make it sound like it is the right thing. Focused searching can easily lead down the wrong trail, and there is insufficient cross-referencing among similar sounding topics. Not your fault, but sure doesn't make it easy to learn the Windows API. Peter Eisengrein wrote: > I've used SetForegroundWindow() from a NotifyIcon and that works on NT4. > > sub ni_Click > { > if ($Window->IsVisible) > { > $Window->Hide(); > } > else > { > $Window->Show(); > $Window->SetForegroundWindow(); > } > > return 0; > } > > > -----Original Message----- > > From: Piske, Harald [mailto:Har...@bo...] > > Sent: Wednesday, June 06, 2001 10:12 PM > > To: 'per...@li...' > > Subject: RE: [perl-win32-gui-users] BringWindowToTop doesn't > > > > > > Works with me ... I have two windows, one button in the first > > window brings > > the other to top. Complete code snippet attached for you to > > check if it > > works with you and figure out the differences to yours. Oh, and I only > > checked on Win2k. > > > > Have fun, > > Harald > > > > > -----Original Message----- > > > From: Glenn Linderman [mailto:Gle...@ne...] > > > Sent: Mittwoch, 6. Juni 2001 18:25 > > > To: Win32::GUI > > > Subject: [perl-win32-gui-users] BringWindowToTop doesn't > > > > > > > > > Hi, > > > > > > So I've got this code, and it doesn't bring the window to > > the top. I > > > can see that each time I click on the notify icon that the code gets > > > executed, both because the print statement fires, and the window > > > redraws. But the window stays behind other windows, in spite of the > > > BringWindowToTop call. It does that with or without the Hide/Show > > > sequence, and with or with a Disable/Enable sequence wrapped > > > around the > > > BringWindowToTop. ActivePerl 5.6.1 build 626, Win32::GUI > > > 0.0.558. What > > > trick am I missing? > > > > > > I'm quite willing to throw all this away, and use whatever > > > works... this > > > is just what sounded like should work from the documentation. > > > > > > I should note that $mw is using the "parent window" trick to > > > avoid being > > > on the task bar. I further note that sufficient Alt-Tab > > keystrokes do > > > eventually raise the window to the top. > > > > > > sub notify_icon_Click > > > { if ( $mw -> IsVisible ()) > > > { print "Bring Main to Top\n"; > > > $mw -> Hide (); > > > $mw -> BringWindowToTop (); > > > $mw -> Show (); > > > } > > > } > > > > > > -- > > > 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 > > > Per...@li... > > > http://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users > > > > > > > > > _______________________________________________ > Perl-Win32-GUI-Users mailing list > Per...@li... > 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. |
From: Glenn L. <Gle...@ne...> - 2001-06-08 00:30:09
|
Does anyone have sample code to create a pop-up menu for a Notify Icon's right click? That seems to be the current rage for System Tray icons? I've got a few other enhancements to make, and then I'll be looking that direction. I'm speculating that on click detection, you'd position and show a window that contains nothing but a menu item... but there's a lot of details to address to get that right, if it can even be done. Peter Eisengrein wrote: > I've used SetForegroundWindow() from a NotifyIcon and that works on NT4. > > sub ni_Click > { > if ($Window->IsVisible) > { > $Window->Hide(); > } > else > { > $Window->Show(); > $Window->SetForegroundWindow(); > } > > return 0; > } > > > -----Original Message----- > > From: Piske, Harald [mailto:Har...@bo...] > > Sent: Wednesday, June 06, 2001 10:12 PM > > To: 'per...@li...' > > Subject: RE: [perl-win32-gui-users] BringWindowToTop doesn't > > > > > > Works with me ... I have two windows, one button in the first > > window brings > > the other to top. Complete code snippet attached for you to > > check if it > > works with you and figure out the differences to yours. Oh, and I only > > checked on Win2k. > > > > Have fun, > > Harald > > > > > -----Original Message----- > > > From: Glenn Linderman [mailto:Gle...@ne...] > > > Sent: Mittwoch, 6. Juni 2001 18:25 > > > To: Win32::GUI > > > Subject: [perl-win32-gui-users] BringWindowToTop doesn't > > > > > > > > > Hi, > > > > > > So I've got this code, and it doesn't bring the window to > > the top. I > > > can see that each time I click on the notify icon that the code gets > > > executed, both because the print statement fires, and the window > > > redraws. But the window stays behind other windows, in spite of the > > > BringWindowToTop call. It does that with or without the Hide/Show > > > sequence, and with or with a Disable/Enable sequence wrapped > > > around the > > > BringWindowToTop. ActivePerl 5.6.1 build 626, Win32::GUI > > > 0.0.558. What > > > trick am I missing? > > > > > > I'm quite willing to throw all this away, and use whatever > > > works... this > > > is just what sounded like should work from the documentation. > > > > > > I should note that $mw is using the "parent window" trick to > > > avoid being > > > on the task bar. I further note that sufficient Alt-Tab > > keystrokes do > > > eventually raise the window to the top. > > > > > > sub notify_icon_Click > > > { if ( $mw -> IsVisible ()) > > > { print "Bring Main to Top\n"; > > > $mw -> Hide (); > > > $mw -> BringWindowToTop (); > > > $mw -> Show (); > > > } > > > } > > > > > > -- > > > 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 > > > Per...@li... > > > http://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users > > > > > > > > > _______________________________________________ > Perl-Win32-GUI-Users mailing list > Per...@li... > 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. |
From: Piske, H. <Har...@bo...> - 2001-06-07 18:05:07
|
Having been in on this trail before makes me feel entitled to contribute to this philosophical footnote as well: I certainly agree, although complexity seems to be unavoidable with flexibility. My approach is to really fight for the time to go over ALL the functions once briefly, so that when I need a certain functionality, I have a better chance to vaguely remember where there was something. MSDN itself takes some getting used to and the first few days I was simply drowning in information overload. But at the end of the day, all the information is in there and if you just took a walk through all of the garden, you might remember where you saw a particular flower before. On second thought, I'd like to speak of cacti rather than flowers ;-) -----Original Message----- From: Glenn Linderman [mailto:Gle...@ne...] Sent: Thursday, June 07, 2001 10:49 To: per...@li... Subject: Re: [perl-win32-gui-users] BringWindowToTop doesn't Thanks so much. That does it for me too. SetForegroundWindow is the key API for this functionality. Side note TWIMC: the Windows API is clearly too big, with too many ways to do the wrong thing, but that make it sound like it is the right thing. Focused searching can easily lead down the wrong trail, and there is insufficient cross-referencing among similar sounding topics. Not your fault, but sure doesn't make it easy to learn the Windows API. Peter Eisengrein wrote: > I've used SetForegroundWindow() from a NotifyIcon and that works on NT4. > > sub ni_Click > { > if ($Window->IsVisible) > { > $Window->Hide(); > } > else > { > $Window->Show(); > $Window->SetForegroundWindow(); > } > > return 0; > } > > > -----Original Message----- > > From: Piske, Harald [mailto:Har...@bo...] > > Sent: Wednesday, June 06, 2001 10:12 PM > > To: 'per...@li...' > > Subject: RE: [perl-win32-gui-users] BringWindowToTop doesn't > > > > > > Works with me ... I have two windows, one button in the first > > window brings > > the other to top. Complete code snippet attached for you to > > check if it > > works with you and figure out the differences to yours. Oh, and I only > > checked on Win2k. > > > > Have fun, > > Harald > > > > > -----Original Message----- > > > From: Glenn Linderman [mailto:Gle...@ne...] > > > Sent: Mittwoch, 6. Juni 2001 18:25 > > > To: Win32::GUI > > > Subject: [perl-win32-gui-users] BringWindowToTop doesn't > > > > > > > > > Hi, > > > > > > So I've got this code, and it doesn't bring the window to > > the top. I > > > can see that each time I click on the notify icon that the code gets > > > executed, both because the print statement fires, and the window > > > redraws. But the window stays behind other windows, in spite of the > > > BringWindowToTop call. It does that with or without the Hide/Show > > > sequence, and with or with a Disable/Enable sequence wrapped > > > around the > > > BringWindowToTop. ActivePerl 5.6.1 build 626, Win32::GUI > > > 0.0.558. What > > > trick am I missing? > > > > > > I'm quite willing to throw all this away, and use whatever > > > works... this > > > is just what sounded like should work from the documentation. > > > > > > I should note that $mw is using the "parent window" trick to > > > avoid being > > > on the task bar. I further note that sufficient Alt-Tab > > keystrokes do > > > eventually raise the window to the top. > > > > > > sub notify_icon_Click > > > { if ( $mw -> IsVisible ()) > > > { print "Bring Main to Top\n"; > > > $mw -> Hide (); > > > $mw -> BringWindowToTop (); > > > $mw -> Show (); > > > } > > > } > > > > > > -- > > > 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 > > > Per...@li... > > > http://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users > > > > > > > > > _______________________________________________ > Perl-Win32-GUI-Users mailing list > Per...@li... > 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 Per...@li... http://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users |
From: Glenn L. <Gle...@ne...> - 2001-06-07 18:52:57
|
"Piske, Harald" wrote: > I certainly agree, although complexity seems to be unavoidable with > flexibility. My approach is to really fight for the time to go over ALL the > functions once briefly, so that when I need a certain functionality, I have > a better chance to vaguely remember where there was something. Sure, if you can learn a little about everything, that's great. But a focused search leads to many dead ends. It would be extremely helpful, for example, if things like BringWindowToTop were documented to do only what they actually do, which appears to be to manipulate only windows within a particular application, rather than system wide. There is no cross-reference to the similar functions needed to do the equivalent system wide operation, and no clue that the operation only applies to a single application. Certainly flexibility results in complexity. But there could be one API for the functionality, with a flag to indicate if the operation pertains to the widgets in a window, the windows of an application, or the applications on the system. > MSDN itself > takes some getting used to and the first few days I was simply drowning in > information overload. But at the end of the day, all the information is in > there and if you just took a walk through all of the garden, you might > remember where you saw a particular flower before. It doesn't matter if all of the information is in there: if you can't find it using reasonable search methods, it isn't good enough. On the other hand, MSDN 6 is certainly a bit better than MSDN 5. I never could figure out enough from 5 to want to learn Windows, with 6, it started to seem possible, but there are still plenty of roadblocks. > On second thought, I'd like to speak of cacti rather than flowers ;-) Yes, stop and smell the cholla :) -- Glenn ===== Due to the current economic situation, the light at the end of the tunnel will be turned off until further notice. |
From: Marjolein K. <win...@ja...> - 2001-06-07 19:29:42
|
But of course they can have beautiful flowers, too - as well as delicious edible fruit ;-) At 11:04 2001-06-07 -0700, Piske, Harald wrote: >On second thought, I'd like to speak of cacti rather than flowers ;-) Cheers, Marjolein Katsma HomeSite Help - http://hshelp.com/ - Extensions, Tips and Tools |
From: Glenn L. <Gle...@ne...> - 2001-06-07 07:10:33
|
Thanks, Harald. Once again, you've busted me out of the mental box I was in. Your program so clearly works, one would wonder why mine doesn't. The difference is in the fact that I'm calling BringWindowToTop from a Notify icon click (which was clear from the sample code I provided), and you are not. Why this should be different is apparently due to the choice of the Windows designers in implementing the System Tray icon business. Clicking on a window, or a sub-item in a window, as is done to reach the Belly button in your code, "activates" your Main window, and gives it the keyboard focus. Then, with the application already being activated, the BringWindowToTop function is sufficient to raise the other window from whatever depths it is in! Clicking on a System Tray icon apparently doesn't activate the application windows, just passes the click message in to the app. So then, if the result of the click is that the application wants to come to the foreground, it has to activate itself! Seems Win32::GUI doesn't provide that capability: it documents GetFocus and GetActiveWindow, but doesn't document SetFocus or SetActiveWindow! Poking around in gui.xs reveals that it has a SetFocus, but not a SetActiveWindow. So I made a SetActiveWindow out of Win32::API. However, it still doesn't do the trick. Now, even though I SetFocus, SetActiveWindow, BringWindowToTop, and Show the window, it still doesn't come to the front when I click the Notify Icon. This is on NT 4 sp 6, by the way. "Piske, Harald" wrote: > Works with me ... I have two windows, one button in the first window brings > the other to top. Complete code snippet attached for you to check if it > works with you and figure out the differences to yours. Oh, and I only > checked on Win2k. > > Have fun, > Harald > > > -----Original Message----- > > From: Glenn Linderman [mailto:Gle...@ne...] > > Sent: Mittwoch, 6. Juni 2001 18:25 > > To: Win32::GUI > > Subject: [perl-win32-gui-users] BringWindowToTop doesn't > > > > > > Hi, > > > > So I've got this code, and it doesn't bring the window to the top. I > > can see that each time I click on the notify icon that the code gets > > executed, both because the print statement fires, and the window > > redraws. But the window stays behind other windows, in spite of the > > BringWindowToTop call. It does that with or without the Hide/Show > > sequence, and with or with a Disable/Enable sequence wrapped > > around the > > BringWindowToTop. ActivePerl 5.6.1 build 626, Win32::GUI > > 0.0.558. What > > trick am I missing? > > > > I'm quite willing to throw all this away, and use whatever > > works... this > > is just what sounded like should work from the documentation. > > > > I should note that $mw is using the "parent window" trick to > > avoid being > > on the task bar. I further note that sufficient Alt-Tab keystrokes do > > eventually raise the window to the top. > > > > sub notify_icon_Click > > { if ( $mw -> IsVisible ()) > > { print "Bring Main to Top\n"; > > $mw -> Hide (); > > $mw -> BringWindowToTop (); > > $mw -> Show (); > > } > > } > > > > -- > > 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 > > Per...@li... > > http://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users > > > > ------------------------------------------------------------------------ > > X.PLName: X.PL > Type: Perl Program (application/x-perl) -- Glenn ===== Due to the current economic situation, the light at the end of the tunnel will be turned off until further notice. |