You can subscribe to this list here.
2001 |
Jan
(226) |
Feb
(139) |
Mar
(156) |
Apr
(95) |
May
(181) |
Jun
(166) |
Jul
(80) |
Aug
(59) |
Sep
(69) |
Oct
(83) |
Nov
(142) |
Dec
(33) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(42) |
Feb
(91) |
Mar
(76) |
Apr
(113) |
May
(67) |
Jun
(68) |
Jul
(37) |
Aug
(41) |
Sep
(16) |
Oct
(135) |
Nov
(51) |
Dec
(21) |
2003 |
Jan
(37) |
Feb
(36) |
Mar
(37) |
Apr
(103) |
May
(68) |
Jun
(70) |
Jul
(77) |
Aug
(12) |
Sep
(9) |
Oct
(53) |
Nov
(88) |
Dec
(63) |
2004 |
Jan
(263) |
Feb
(106) |
Mar
(36) |
Apr
(21) |
May
(21) |
Jun
(34) |
Jul
(33) |
Aug
(34) |
Sep
(35) |
Oct
(21) |
Nov
(43) |
Dec
(63) |
2005 |
Jan
(28) |
Feb
(42) |
Mar
(29) |
Apr
(14) |
May
(41) |
Jun
(20) |
Jul
(65) |
Aug
(136) |
Sep
(41) |
Oct
(74) |
Nov
(34) |
Dec
(94) |
2006 |
Jan
(85) |
Feb
(94) |
Mar
(68) |
Apr
(103) |
May
(66) |
Jun
(51) |
Jul
(24) |
Aug
(56) |
Sep
(57) |
Oct
(85) |
Nov
(73) |
Dec
(68) |
2007 |
Jan
(59) |
Feb
(32) |
Mar
(13) |
Apr
(32) |
May
(36) |
Jun
(36) |
Jul
(64) |
Aug
(35) |
Sep
(19) |
Oct
(10) |
Nov
(13) |
Dec
(20) |
2008 |
Jan
(26) |
Feb
(41) |
Mar
(19) |
Apr
(24) |
May
(16) |
Jun
(33) |
Jul
(34) |
Aug
(4) |
Sep
(11) |
Oct
|
Nov
(26) |
Dec
(23) |
2009 |
Jan
(5) |
Feb
(2) |
Mar
(21) |
Apr
(16) |
May
(13) |
Jun
(6) |
Jul
(34) |
Aug
(2) |
Sep
(1) |
Oct
(7) |
Nov
(5) |
Dec
(24) |
2010 |
Jan
(3) |
Feb
(5) |
Mar
(6) |
Apr
(6) |
May
(14) |
Jun
(6) |
Jul
(1) |
Aug
(12) |
Sep
(10) |
Oct
(9) |
Nov
|
Dec
(2) |
2011 |
Jan
(4) |
Feb
(5) |
Mar
(30) |
Apr
(1) |
May
(2) |
Jun
(5) |
Jul
(3) |
Aug
(2) |
Sep
(3) |
Oct
|
Nov
(6) |
Dec
|
2012 |
Jan
|
Feb
(10) |
Mar
|
Apr
|
May
(1) |
Jun
(3) |
Jul
(1) |
Aug
|
Sep
(2) |
Oct
|
Nov
(2) |
Dec
(4) |
2013 |
Jan
(5) |
Feb
(3) |
Mar
|
Apr
(3) |
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
(2) |
Feb
|
Mar
|
Apr
(1) |
May
(3) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(9) |
Nov
(7) |
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(4) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2017 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
(5) |
Dec
|
2019 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
|
From: Peter E. <Pet...@at...> - 2001-07-10 12:57:08
|
Is there a Kill or other such event if a GUI app crashes or killed? Or should that just be handled with %SIG it would be awfully convenient if you could do something like: sub Exit { return -1; } sub Window_Terminate { print "App closed gracefully.\n"; &Exit(); } sub Window_Kill { print "Ack! My process just died!\n"; &Exit(); } |
From: Piske, H. <Har...@bo...> - 2001-07-05 19:25:57
|
Basically, what you want is Win32::GUI::SetCursor () the tricky thing is to get the standard resource of the hourglass. Feel free to use my perl module http://www.fairymails.com/perl/WinStRes.pm for exactly this: Win32::GUI::SetCursor (WinCursor (WAIT)); # hourglass ... Win32::GUI::SetCursor (WinCursor ()); # ... and back What this module does is $LoadImage = new Win32::API ('user32', 'LoadImage', [N,N,I,I,I,I], N) or die 'can\'t find LoadImage function'; ... %cursors = ( 'NORMAL' => 32512, 'IBEAM' => 32513, 'WAIT' => 32514, ... sub WinCursor { local $_ = $cursors{$_[0]} or $cursors{'NORMAL'}; return $LoadImage->Call (0, $_, 2, 0, 0, 0x8040); } Have fun, Harald > -----Original Message----- > From: Felix Gaehler [mailto:fe...@fr...] > Sent: Mittwoch, 4. Juli 2001 13:18 > To: per...@li... > Subject: [perl-win32-gui-users] Change cursor to "hourglass" and back? > > > Hi > I have a Win32-GUI application in which a query to a website is > executed and the results are displayed afterwards. This can take > several seconds. > > To signal to the user that his query is being processed and he should > wait, I would like to display the mouse cursor in the form of an > hourglass while the query is processed, and turn it back to the > original arrow form afterwards. > > Who can help me with this? > > Best Regards, > Felix Gaehler > > > > _______________________________________________ > Perl-Win32-GUI-Users mailing list > Per...@li... > http://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users > |
From: Peter E. <Pet...@at...> - 2001-07-05 18:51:01
|
Win32::GUI::Cursor should do it (though I've never used it) > -----Original Message----- > From: Felix Gaehler [mailto:fe...@fr...] > Sent: Wednesday, July 04, 2001 4:18 PM > To: per...@li... > Subject: [perl-win32-gui-users] Change cursor to "hourglass" and back? > > > Hi > I have a Win32-GUI application in which a query to a website is > executed and the results are displayed afterwards. This can take > several seconds. > > To signal to the user that his query is being processed and he should > wait, I would like to display the mouse cursor in the form of an > hourglass while the query is processed, and turn it back to the > original arrow form afterwards. > > Who can help me with this? > > Best Regards, > Felix Gaehler > > > > _______________________________________________ > Perl-Win32-GUI-Users mailing list > Per...@li... > http://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users > |
From: Piske, H. <Har...@bo...> - 2001-07-05 17:57:05
|
Sorry if this appears twice - I posted it yesterday and got a delivery warning. Since it hasn't showed up yet and other postings seem to get thru, I try again: ------------------- Basically, what you want is Win32::GUI::SetCursor () the tricky thing is to get the standard resource of the hourglass. Feel free to use my perl module http://www.fairymails.com/perl/WinStRes.pm for exactly this: Win32::GUI::SetCursor (WinCursor (WAIT)); # hourglass ... Win32::GUI::SetCursor (WinCursor ()); # ... and back What this module does is $LoadImage = new Win32::API ('user32', 'LoadImage', [N,N,I,I,I,I], N) or die 'can\'t find LoadImage function'; ... %cursors = ( 'NORMAL' => 32512, 'IBEAM' => 32513, 'WAIT' => 32514, ... sub WinCursor { local $_ = $cursors{$_[0]} or $cursors{'NORMAL'}; return $LoadImage->Call (0, $_, 2, 0, 0, 0x8040); } Have fun, Harald > -----Original Message----- > From: Felix Gaehler [mailto:fe...@fr...] > Sent: Mittwoch, 4. Juli 2001 13:18 > To: per...@li... > Subject: [perl-win32-gui-users] Change cursor to "hourglass" and back? > > > Hi > I have a Win32-GUI application in which a query to a website is > executed and the results are displayed afterwards. This can take > several seconds. > > To signal to the user that his query is being processed and he should > wait, I would like to display the mouse cursor in the form of an > hourglass while the query is processed, and turn it back to the > original arrow form afterwards. > > Who can help me with this? > > Best Regards, > Felix Gaehler > > > > _______________________________________________ > Perl-Win32-GUI-Users mailing list > Per...@li... > http://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users > |
From: Peter E. <Pet...@at...> - 2001-07-05 17:20:15
|
doing some digging I found that you use it as follows: my $C = new Win32::GUI::Cursor(filename); ### assuming your window is $Window $Window->ChangeCursor($C); ### YOu also may have to do a ChangeCursor for other widgets like so: ### (assuming a button name of Button and a Label name of Label) $Window->Button->ChangeCursor($C); $Window->Label->ChangeCursor($C); > -----Original Message----- > From: Peter Eisengrein > Sent: Thursday, July 05, 2001 9:07 AM > To: 'per...@li...' > Subject: RE: [perl-win32-gui-users] Change cursor to "hourglass" and > back? > > > Win32::GUI::Cursor should do it (though I've never used it) > > > -----Original Message----- > > From: Felix Gaehler [mailto:fe...@fr...] > > Sent: Wednesday, July 04, 2001 4:18 PM > > To: per...@li... > > Subject: [perl-win32-gui-users] Change cursor to > "hourglass" and back? > > > > > > Hi > > I have a Win32-GUI application in which a query to a website is > > executed and the results are displayed afterwards. This can take > > several seconds. > > > > To signal to the user that his query is being processed and > he should > > wait, I would like to display the mouse cursor in the form of an > > hourglass while the query is processed, and turn it back to the > > original arrow form afterwards. > > > > Who can help me with this? > > > > Best Regards, > > Felix Gaehler > > > > > > > > _______________________________________________ > > Perl-Win32-GUI-Users mailing list > > Per...@li... > > http://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users > > > |
From: Felix G. <fe...@fr...> - 2001-07-04 20:16:11
|
Hi I have a Win32-GUI application in which a query to a website is executed and the results are displayed afterwards. This can take several seconds. To signal to the user that his query is being processed and he should wait, I would like to display the mouse cursor in the form of an hourglass while the query is processed, and turn it back to the original arrow form afterwards. Who can help me with this? Best Regards, Felix Gaehler |
From: Johan L. <jo...@ba...> - 2001-07-04 15:16:15
|
3-2-1 * ignition * I just found this thread at PerlMonks: <http://www.perlmonks.org/index.pl?node_id=9724&lastnode_id=20339> Haven't read & understood, but it seems relevant to a recent conversation here. /J ------ ---- --- -- -- -- - - - - - Johan Lindström Boss Casinos Sourcerer jo...@ba... http://www.bahnhof.se/~johanl/ If the only tool you have is a hammer, everything tends to look like a nail |
From: Piske, H. <Har...@bo...> - 2001-07-03 21:30:02
|
There is a SetCharFormat method to the RichEdit control. $Rich->Select ($from_here, $to_there); $Rich->SetCharFormat (-color => $flashy_pink) Look up http://www.jeb.ca/ for tons of information and knowledge (-> Win32-GUI -> FAQ), also contains links to Aldo's documentation http://dada.perl.it/gui_docs/gui.html, or see wex.pl @ http://www.fairymails.com/perl/ for an example in action. |
From: Peter E. <Pet...@at...> - 2001-07-03 21:25:57
|
I've never had any success changing it once it is created, but to set the font at the beginning you can use: my $Font = new Win32::GUI::Font( -name => "Courier New", -height => 16, -bold => 0, ); ### or the font/style of your choice... ### and then in your AddRichEdit use -font => $Font > -----Original Message----- > From: pau...@or... [mailto:pau...@or...] > Sent: Tuesday, July 03, 2001 5:25 PM > To: per...@li... > Subject: [perl-win32-gui-users] Formatting of text in a RichEdit > > > > Hi All > > I'm currently playing with a RichEdit to display the output > of a report. Does > anyone have any experience setting formatting inside a RichEdit ? > > I guess I should be able to use Bold / Italics / Color but am > having problems > working out how. I looked on MSDN and I think I may have to > use SendMessage to > send a EM_SETCHARFORMAT message to the RichEdit ? (I may be > well off track > here.) > > Any ideas ? > > I'd like to maybe print column headings in bold in a larger > typeface than the > body. > > All help greatly appreciated. > > Cheers > > Paul > > > > ************************************************************** > ***************** > Important. This E-mail is intended for the above named person > and may be > confidential and/or legally privileged. If this has come to > you in error you > must take no action based on it, nor must you copy or show it > to anyone; please > inform the sender immediately. > ************************************************************** > ***************** > > > _______________________________________________ > Perl-Win32-GUI-Users mailing list > Per...@li... > http://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users > |
From: <pau...@or...> - 2001-07-03 21:17:34
|
Hi All I'm currently playing with a RichEdit to display the output of a report. Does anyone have any experience setting formatting inside a RichEdit ? I guess I should be able to use Bold / Italics / Color but am having problems working out how. I looked on MSDN and I think I may have to use SendMessage to send a EM_SETCHARFORMAT message to the RichEdit ? (I may be well off track here.) Any ideas ? I'd like to maybe print column headings in bold in a larger typeface than the body. All help greatly appreciated. Cheers Paul ******************************************************************************* Important. This E-mail is intended for the above named person and may be confidential and/or legally privileged. If this has come to you in error you must take no action based on it, nor must you copy or show it to anyone; please inform the sender immediately. ******************************************************************************* |
From: Piske, H. <Har...@bo...> - 2001-07-03 20:30:14
|
I'm just guessing, I don't really know it: maybe you need to make sure that your sub Text_KeyPress returns 1. If it returns 0, the default action (which is typing into the field) would not get carried out. Btw, if it returns -1, the Dialog() call would return and the script would continue after that point. That goes for all event subs. > -----Original Message----- ... > sub Text_KeyPress { > > my($key) = @_; > > if ($key == 1) { > $button->SetFocus(); > } elsif ($key == 3) { > $button->SetFocus(); > } return 1; > } |
From: Andrea M. <mae...@fr...> - 2001-07-03 20:04:03
|
Hello! A space appear before the prompt in the Textfield when I use some fonts and disappear in Textfield without fonts... Could you tell me why!?! Thanks! Andrea Maestrutti ####### # SPACE ####### use Win32::GUI; my $win = new Win32::GUI::Window( -title => "Space before text", -left => 100, -top => 20, -width => 250, -height => 100, -name => "Window", ); my $Font = new Win32::GUI::Font( -name => "Arial", -size => 16, ); my $txt= $win->AddTextfield( -name => "textfield", -font => $Font, -left => 35, -top => 30, -height => 25, -width => 130, -text => "Space before me", ); sub Window_Terminate { return -1; } $win->Show; Win32::GUI::Dialog(); ########## # NO SPACE ########## use Win32::GUI; my $win = new Win32::GUI::Window( -title => "NO space before text", -left => 100, -top => 20, -width => 250, -height => 100, -name => "Window", ); my $txt= $win->AddTextfield( -name => "textfield", -font => $Font, -left => 35, -top => 30, -height => 25, -width => 135, -text => "NO space before me", ); sub Window_Terminate { return -1; } $win->Show; Win32::GUI::Dialog(); |
From: Andrea M. <mae...@fr...> - 2001-07-03 20:02:44
|
Hi all! With this code I want to paste the clipboard content in the RichEdit when I click the button. Also I want to prevent CTRL-A and CTRL-C press in the RicheEdit from the user (i.e. I redirect the focus to the button ... not very elegant but works) [The really problem is: after some manipolation of the text on the RichEdit by my program, a CTRL-A & CTRL-C press makes a "Error: Runtime exception", so I had to "redirect" CTRL-A] This works but now I can not type in the RichEdit, only paste the clipboard content. I'd like type normally in the RichEdit. What's happend? Thanks! :) Andrea Maestrutti ################################################## use Win32::GUI; use Win32::Clipboard; my $clip = Win32::Clipboard; my $TextClass = new Win32::GUI::Class( -name => "_Editor", -extends => "RichEdit", -widget => "RichEdit", ); $win = new Win32::GUI::Window( -name => "Window", -text => "Test", -width => 520, -height => 410, -left => 100, -top => 100, -minsize => [520, 410], ); $Textbox = $win->AddRichEdit( -class => $TextClass, -name => "Text", -left => 10, -top => 10, -multiline=> 1, -width => $win->ScaleWidth-20, -height => $win->ScaleHeight-150, -exstyle => WS_EX_CLIENTEDGE, -style => WS_CHILD | WS_VISIBLE | WS_VSCROLL | ES_LEFT | ES_MULTILINE | ES_AUTOVSCROLL, ); $button=$win->AddButton ( -name => "button", -text => "Paste", -left => 175, -top => 310, -width => 137, -height => 30, ); sub Text_KeyPress { my($key) = @_; if ($key == 1) { $button->SetFocus(); } elsif ($key == 3) { $button->SetFocus(); } } sub button_Click { my $clip_content=$clip->GetText(); $Textbox->Text("$clip_content"); } sub Window_Terminate { return -1; } $win->Show(); Win32::GUI::Dialog(); |
From: Johan L. <jo...@ba...> - 2001-07-03 06:47:51
|
Morbus wrote: > - do you see any Window related handles that I've missed? > I'd much rather define every single possible event than miss > some and hope that the code figures it out. Does my code > always bring the Window to the top (in practice, sometimes > it does, sometimes it doesn't)? Just looking at the code, I would make sure the event handlers always return exactly what I think they should: >sub _Window_Minimize { ¬e("Minimizing window."); $window->Hide(); } Return 1 explicitly to avoid surprises. /J ------ ---- --- -- -- -- - - - - - Johan Lindström Boss Casinos Sourcerer jo...@ba... http://www.bahnhof.se/~johanl/ If the only tool you have is a hammer, everything tends to look like a nail |
From: Erick B. <er...@je...> - 2001-07-03 03:06:28
|
On Mon, 02 Jul 2001 17:13:55 -0700, Jeremy Aiyadurai said: .. ~snip~ | push(@messageInfoList,%messageInfo); # pushing hash into the array. | } Instead of putting the hash into the array, try inserting a reference to it. That is, push(@messageInfoList, \%messageInfo); Then you can access the info by doing the following: foreach (@messageInfoList) { print "From: $_->{From}\n"; ... } Hope that helps. regards, erick |
From: Jeremy A. <bc...@te...> - 2001-07-03 00:16:45
|
hi thanks for all your help in the past how do i go about creating an array of hashes eg. suppose i want to get information about email messages, and each message has a subject, date, from etc. i want to store the following in a hash. But there are more than one messages, therefore, i have to create an array of hashes. eg hash holds information about each email message. please take a look at the following code....I am probably doing something wrong. thankyou your help is always appreciated. Jeremy A. sub messageInfo ($) { my @messageStatList = @_[0]; foreach (@messageStatList) { my %messageInfo; # creating my hash $pop3C->send("TOP $_{Number} 1\n"); while (($response = <$pop3C>) && ($response !~ /^\./)) { if ($response =~ /From:\s([^\n]*)/) { $response =~ /From:\s([^\n]*)/; $messageInfo{From} = $1; # print "$1\n"; } if ($response =~ /Subject:\s([^\n]*)/) { $response =~ /Subject:\s([^\n]*)/; $messageInfo{Subject} = $1; # print "$1\n"; } $messageInfo->{Size} = $_->{Size}; #c $messageInfo->{Number} = $_->{Number}; if ($response =~ /Date:\s([^\n]*)/) { $response =~ /Date:\s([^\n]*)/; $messageInfo{Date} = $1; # print "$1\n"; } } push(@messageInfoList,%messageInfo); # pushing hash into the array. } foreach (@messageInfoList) { print "$_{From}\n"; print "$_{Subject}\n"; print "$_{Size}\n"; print "$_{Date}\n"; print "$_{Number}\n"; } return @messageInfoList; } |
From: Piske, H. <Har...@bo...> - 2001-07-02 23:23:16
|
The infamous 0.99 build ... Go to either Activestate or dada.perl.it and find the latest version. Sadly, the version number 0.99 looks newer to the Activestate ppm installer than the current version 0.0.558, so it will refuse to update it. Instead, do - ppm remove Win32-GUI - ppm install Win32-GUI.ppd - ppm query in the directory where you placed the contents of the zipfile. If you have trouble finding / downloading it, contact me off-list and I'll mail it to you. BTW, depending on which OS you run, you might also want to update your Activestate Perl to something like 5.6.0 build 618 or whatever is newest. Welcome to GUI and have fun, Harald -----Original Message----- From: John Watson [mailto:jo...@il...] Sent: Monday, July 02, 2001 15:50 To: per...@li... Subject: [perl-win32-gui-users] NewbieWin32::GUI Dialog() Question Hi, This is part of my first Win32-Gui program that has been converted from a non-gui program. When I run it, I get a couple of the following error messages that point to the Win32:::GUI::Dialog() line. I also get the message whenever the cursor touches the window. But other than that, it runs fine. Use of uninitialized value at C:\perl522\dev\pdfexporter.pl line XX. I am running Activestate 522 with Win32-GUI build .99 Any help would be appreciated. Thanks John Watson snip ------------------------- my $t1 = $main->AddTimer('T1', $sleeptime); Win32::GUI::Dialog(); sub Main_Terminate { return -1; } sub T1_Timer { for (my $i=1; $i <= $number_directories; $i++) { &exportpdf($impdir[$i], $outdir[$i], $errdir[$i]); } $main->DoEvents(); } ------------------------ snip |
From: John W. <jo...@il...> - 2001-07-02 22:51:07
|
Hi, This is part of my first Win32-Gui program that has been converted from = a non-gui program. When I run it, I get a couple of the following error messages that point = to the Win32:::GUI::Dialog() line. I also get the message whenever the cursor touches the window. But = other than that, it runs fine. Use of uninitialized value at C:\perl522\dev\pdfexporter.pl line XX. I am running Activestate 522 with Win32-GUI build .99 Any help would be appreciated. Thanks John Watson snip ------------------------- my $t1 =3D $main->AddTimer('T1', $sleeptime); Win32::GUI::Dialog(); sub Main_Terminate { return -1; } sub T1_Timer { for (my $i=3D1; $i <=3D $number_directories; $i++) { &exportpdf($impdir[$i], $outdir[$i], $errdir[$i]); } $main->DoEvents(); } ------------------------ snip |
From: Morbus I. <mo...@di...> - 2001-07-02 21:20:27
|
>* The $SETTINGS global hash ref isn't documented anywhere and could >probably be passed to the various subs instead. Globals config variables >has always bitten me sooner or later in the past :/ Point taken - in this case, it's part of the much larger AmphetaDesk project (at http://www.disobey.com/amphetadesk/), where it's documented in the main program file (amphetadesk.pl). Generically speaking, in my scripts, I use $CAPITALS for variables that are global to the whole program, and then small's for variables that should remain in the library or package. >* In open_url: > use Win32::API; > my $ShellExecute = new Win32::API("shell32", "ShellExecuteA", >['N','P', 'P', 'P', 'P', 'I'], 'N'); > >I would create the API object once at compile time (outside the sub) and >check for success (or die("something")). That way you will have a safe >state when the application starts--no surprises in the middle of everything >you have to recover from. Ah. Point taken, and a good one. I'll fix this in a later release. >* What does > > $logbox->SendMessage(0x301,0,0); > >mean? You won't remember in two weeks either. Encapsulate in a generic and >well-named sub that gives away what it is doing. Beats a comment any day >(not that you shouldn't document the sub :) In this case, I'm thinking that the sub name is fine: sub _EditCopy_Click The fact that it's the Copy command from the Edit menu, and that the user has "Click"ed on it, and that's the only line in the routine works good enough to tell me that "this esoteric command means to copy whatever's selected). >* sub _OpenWindow_Click { > >What happens if open_url takes a long time and the user double clicks? Set >the "$already_called = 1;" immediately after checking it, making it as >atomic as possible. Hmm. I wonder if that had anything to do with some of the slowdown I experienced before. I'll be sure to check into that. More questions: - do you see any Window related handles that I've missed? I'd much rather define every single possible event than miss some and hope that the code figures it out. Does my code always bring the Window to the top (in practice, sometimes it does, sometimes it doesn't)? -- Morbus Iff ( .sig on other machine. ) http://www.disobey.com/ && http://www.gamegrene.com/ "where's there's a will, there's a morbus ready to collect!" |
From: Johan L. <jo...@ba...> - 2001-07-02 21:00:16
|
Morbus wrote: >I'm looking for a code review of the below - mainly in the realms of >Windows correctness, and what I'm missing, and so forth. The code below is >a drop-able library into my AmphetaDesk >(http://www.disobey.com/amphetadesk/), but could work for some other >programs as well. Basically I would say it looks fine. I'm a bit curious about that double-event-thingy though, sounds a little odd. Ok, the code review, here goes : * The $SETTINGS global hash ref isn't documented anywhere and could probably be passed to the various subs instead. Globals config variables has always bitten me sooner or later in the past :/ * In open_url: use Win32::API; my $ShellExecute = new Win32::API("shell32", "ShellExecuteA", ['N','P', 'P', 'P', 'P', 'I'], 'N'); I would create the API object once at compile time (outside the sub) and check for success (or die("something")). That way you will have a safe state when the application starts--no surprises in the middle of everything you have to recover from. * What does $logbox->SendMessage(0x301,0,0); mean? You won't remember in two weeks either. Encapsulate in a generic and well-named sub that gives away what it is doing. Beats a comment any day (not that you shouldn't document the sub :) * sub _OpenWindow_Click { What happens if open_url takes a long time and the user double clicks? Set the "$already_called = 1;" immediately after checking it, making it as atomic as possible. As a personaly coding style, when I have a global variable ($already_called) which is in effect only a static variable (only used in that sub), I declare it in close proximity to the sub, i.e. just before the sub, and make sure it gets initialized with something useful. Readability and maintainability reasons. [oops, saw that you used it in many subs now :) the point is still valid in that context though] /J ------ ---- --- -- -- -- - - - - - Johan Lindström Boss Casinos Sourcerer jo...@ba... http://www.bahnhof.se/~johanl/ If the only tool you have is a hammer, everything tends to look like a nail |
From: Johan L. <jo...@ba...> - 2001-07-02 18:50:09
|
Pete wrote: >I know you can check to see if a window is shown or hidden via >$Window->IsVisible but can't seem to find something similar to check if it >is minimized or maximized. "The IsZoomed and IsIconic functions determine whether a given window is maximized or minimized, respectively. The GetWindowPlacement function retrieves the minimized, maximized, and restored positions for the window, and also determines the window's show state." IsZoomed and IsIconic are implemented in Win32::GUI and documented in the HTML file Win32_GUI.html /J ------ ---- --- -- -- -- - - - - - Johan Lindström Boss Casinos Sourcerer jo...@ba... http://www.bahnhof.se/~johanl/ If the only tool you have is a hammer, everything tends to look like a nail |
From: Peter E. <Pet...@at...> - 2001-07-02 18:32:32
|
I know you can check to see if a window is shown or hidden via $Window->IsVisible but can't seem to find something similar to check if it is minimized or maximized. Thanks, Pete |
From: Louis B. <lb...@li...> - 2001-07-02 14:22:23
|
Did not help me... Darn it... Louis At 04:11 PM 7/2/2001 +0200, Johan Lindstrom wrote: >Louis wrote: >>It works but still gives an error when I exit using the exe=20 >>version. Maybe I should give up on the exit thing and let people click=20 >>on the windows X to exit. > >Try not calling exit(0). Long shot but it might work. > > >/J > >------ ---- --- -- -- -- - - - - - >Johan Lindstr=F6m Boss Casinos >Sourcerer jo...@ba... > http://www.bahnhof.se/~johanl/ >If the only tool you have is a hammer, >everything tends to look >like a nail > > >_______________________________________________ >Perl-Win32-GUI-Users mailing list >Per...@li... >http://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users -- =A4=A4=BA=B0`=B0=BA=A4=F8,=B8=B8,=F8=A4=BA=B0`=B0=BA=A4=F8=F8=A4=BA=B0`=B0= =BA=A4=F8,=B8=B8,=F8=A4=BA=B0`=B0=BA=A4=F8=F8=A4=BA=B0`=B0=BA=A4 =A4=B0`=B0Lightbridge, Inc =A4=B0`=B067 South Bedford St. =A4=B0`=B0Burlington MA 01832 =A4=B0`=B0781.359.4795 mailto:lb...@li... =A4=B0`=B0http://www.lightbridge.com =A4=A4=BA=B0`=B0=BA=A4=F8,=B8=B8,=F8=A4=BA=B0`=B0=BA=A4=F8=F8=A4=BA=B0`=B0= =BA=A4=F8,=B8=B8,=F8=A4=BA=B0`=B0=BA=A4=F8=F8=A4=BA=B0`=B0=BA=A4 |
From: Morbus I. <mo...@di...> - 2001-07-02 14:14:13
|
I'm looking for a code review of the below - mainly in the realms of Windows correctness, and what I'm missing, and so forth. The code below is a drop-able library into my AmphetaDesk (http://www.disobey.com/amphetadesk/), but could work for some other programs as well. As it stands right now, I'm getting some minor reports of weirdness in Window minimization - when people click the taskbar button, nothing happens (only sometimes), when people click it again, it minimizes, and so forth. In some cases, I think I'm not properly "bringing Window to front". Anyways, please look at the code below and let me know where it can be improved (note if your email window is set for anything less than 80 characters, then you're gonna see some ugly wrapping): ############################################################################### # LIST OF ROUTINES BELOW: # ############################################################################### # gui_init() - start the gui and display the window # # gui_listen() - listen for window events for our gui # # gui_note() - send a note to our gui window # # open_url() - open a url in the system's default browser # # _things() - various routines that control the gui and should be private # ############################################################################### # these variables are global for # the Windows gui - they just keep # track of various things that listen # and notes need to know about. my ($hwnd, $icon, $hwnd_class, $window, $menu_bar); my ($img, $systray_icon, $systray_menu, $font, $logbox); # used to circumvent a bug that the popup menu functions # get called twice. A temp fix, while I look for the problem. my $already_called = 0; # remember the process id. my $fork_id_path; ############################################################################### # gui_init() - start the gui and display the window # ############################################################################### # USAGE: # # &gui_init; # # # # NOTES: # # This routine loads specific libraries specific to the OS and attempts to # # do everything necessary to start up a GUI window and start listening for # # events. Further down in this file, you should see supplementary GUI # # routines (starting with _) that are part of the GUI happenings this # # routine inits. # # # # Most of the code within this routine is thanks to David Berube. # # # # RETURNS: # # 1; this routine always returns happily. # ############################################################################### sub gui_init { use Win32::GUI; # hwnd is a handle to a window - basically, window's # way of keeping track of it's program windows... $hwnd = GUI::GetPerlWindow(); # comment this to see error messages in a dos window # otherwise, this will hide the blasted thing... GUI::Hide($hwnd); # get the width and height of the user's system. my $screen_width = Win32::GUI::GetSystemMetrics(0); my $screen_height = Win32::GUI::GetSystemMetrics(1); # create the icon handler. $icon = new Win32::GUI::Icon($SETTINGS->{files}->{gui_win_icon}); # create a window class for our window. $hwnd_class = new Win32::GUI::Class( -name => "$SETTINGS->{app}->{name} Class", -icon => $icon ); # set up our menu bar. these point to various # routines defined later on in this file, as # well as set up key commands for the items. $menu_bar = new Win32::GUI::Menu( "&File" => "File", " > E&xit" => "_FileExit", "&Edit" => "Edit", " > &Copy Ctrl+C" => "_EditCopy", " > Select &All Ctrl+A" => "_EditSelectAll" ); # creates the main window. notice that we use a generic # "Name" parameter, which is used for events, which must # have the format Name_EventName. $window = new Win32::GUI::Window( -name => '_Window', -text => $SETTINGS->{app}->{name}, -left => ($screen_width - 600)/2, -top => ($screen_height - 400)/2, -width => 480, -height => 400, -maxsize => [480, 400], -minsize => [480, 400], -menu => $menu_bar, -class => $hwnd_class, -icon => $icon, -maximizebox => 0 ); # create the systray icon. $systray_icon = $window->AddNotifyIcon( -name => "_Systray", -id => 1, -icon => $icon, -tip => $SETTINGS->{app}->{name} ); # Create the popup menu $systray_menu = new Win32::GUI::Menu( "SystrayMenu Functions" => "SystrayMenu", "> Open Window" => "_OpenWindow", "> Refresh Channels" => "_RefreshChannels", "> Exit" => "_SystrayExit" ); # create our pretty logo - we need to figure out # a good window size and height and then fix this # stuff (and the logbox) up... $window->AddLabel( -text => "", -name => "Bitmap", -left => -34, -top => -3, -width => 505, -height => 116, -style => 14, -visible => 1, ); # actually display the image... $img = new Win32::GUI::Bitmap($SETTINGS->{files}->{gui_win_logo}); $window->Bitmap->SetImage($img); $window->Bitmap->Resize(505, 116); # set the font of our log box below. $font = Win32::GUI::Font->new( -name => "Verdana", -size => 12 ); # create the log box which is gonna hold all our info. $logbox = $window->AddRichEdit( -name => "_RichEdit", -font => $font, -top => 116, -left => 0, -width => 505, -height => 240, -tabstop => 1, -style => WS_CHILD | WS_VISIBLE | ES_LEFT | ES_MULTILINE | ES_AUTOVSCROLL | WS_VSCROLL | ES_READONLY, -exstyle => WS_EX_CLIENTEDGE ); # and make it a little smaller than our window size. $logbox->Resize( $window->ScaleWidth, $window->ScaleHeight - 118); # finally, show all the junk we just did. $window->Show(); return 1; } 1; ############################################################################### # gui_listen() - listen for window events for our gui # ############################################################################### # USAGE: # # &gui_listen; # # # # NOTES: # # This routine checks the event queue and sees if there is anything that # # needs to be done. It's called from the main loop of our program. # # # # RETURNS: # # 1; this routine always returns happily. # ############################################################################### sub gui_listen { # anyone there? Win32::GUI::PeekMessage(0,0,0); Win32::GUI::DoEvents(); return 1; } 1; ############################################################################### # gui_note() - send a note to our gui window # ############################################################################### # USAGE: # # &gui_note("This is a gui window line. Yup."); # # # # NOTES: # # Much like ¬e, only we send our message to our os specific gui window. # # # # RETURNS: # # 1; this routine always returns happily. # ############################################################################### sub gui_note { my ($message) = @_; # select our last line. $logbox->Select(999999,999999); $logbox->ReplaceSel("$message\n", 1); select(undef, undef, undef, 0.25); # autoscroll the log box. $logbox->SendMessage (0x115, 1, 0) while $message =~ /\n|$/g; # listen for good measure. Win32::GUI::PeekMessage(0,0,0); Win32::GUI::DoEvents(); return 1; } 1; ############################################################################### # open_url() - open a url in the system's default browser # ############################################################################### # USAGE: # # &open_url( "http://127.0.0.1:8888/" ); # # # # OS SPECIFIC NOTES: # # This routine loads the Win32::Shell module to execute the "open" # # command which will open the browser and load the URL. However, if the # # user has defined a local path to a browser, we try to open that instead. # # # # RETURNS: # # 1; we instruct the user to open their browser if we can't. # ############################################################################### sub open_url { my ($url) = @_; # we spit out our suggestion just to catch all instances. ¬e("If your browser doesn't load, go to <$url>", 1); # find out what browser we're using. use Win32::TieRegistry; my $browser = $Registry->{"Classes\\http\\shell\\open\\command"}->{'\\'}; ¬e("Your registry states that $browser is your default program."); # if a browser_path hasn't been set, try # to open the default browser using the native API. # we do an API call instead of a 'start $url' sort # of thing, because the API call seems far more stable - # we've experienced slowness with 'start $url' # and random crashes on some machines. if ( $SETTINGS->{user}->{browser_path} eq "default" ) { use Win32::API; my $ShellExecute = new Win32::API("shell32", "ShellExecuteA", ['N','P', 'P', 'P', 'P', 'I'], 'N'); $ShellExecute->Call(0, "open", $url, 0, 0, 1); } # if a browser_path has been defined, try passing # the $url to the .exe and hope it understands. else { ¬e("But instead, we'll try loading $SETTINGS->{user}->{browser_path}."); unless ( $fork_id_path = fork ) { system( qq|"$SETTINGS->{user}->{browser_path} " $url| ); } } return 1; } 1; ############################################################################### # _things() - various routines that control the gui and should be private # ############################################################################### # USAGE: # # These are internally called by the GUI and shouldn't be publically # # used. So stop poking around here. Sheesh. Flippin' nosy people. Sigh. # ############################################################################### # various menu commands. sub _EditCopy_Click { ¬e("Received 'Copy' request."); $logbox->SendMessage(0x301,0,0); } sub _EditSelectAll_Click { ¬e("Received 'Select All' request."); $logbox->Select(0,999999);} sub _FileExit_Click { ¬e("Quitting $SETTINGS->{app}->{name} due to File > Exit."); &exit_program; } # re-open the browser window. sub _OpenWindow_Click { unless ( $already_called ) { # helloooooooo, nurse! ¬e("Received 'Open Window' request from Systray."); # do the dirty deed. &open_url( $SETTINGS->{urls}->{channels_home} ); # for some reason, we get two clicks every # time someone clicks a menu item. we check # for this here. $already_called = 1; } else { $already_called = 0; } } # Respond to the menu choice for # channel refreshing and browser opening. sub _RefreshChannels_Click { unless( $already_called ) { # helloooooooo, nurse! ¬e("Received 'Refresh Channels' request from Systray."); ¬e("--------------------------------------------------------------------------------", 1); ¬e("Refreshing the channel list and opening browser window...", 1); ¬e("--------------------------------------------------------------------------------", 1); # do the dirty deed. &download_my_channels(); &open_url( $SETTINGS->{urls}->{channels_home} ); # for some reason, we get two clicks every # time someone clicks a menu item. we check # for this here. $already_called = 1; } else { $already_called = 0; } } # generic code to force removal of systray icon. sub _Remove_Systray_Icon { Win32::GUI::NotifyIcon::Delete( $systray_icon->{-parent}, -id => $systray_icon->{-id} ); } # if the systray icon is clicked, re-enable the window. sub _Systray_Click { ¬e("Received Systray left click."); $window->Enable(); $window->Show; } # If someone right clicks the systray icon, show a menu. sub _Systray_RightClick { ¬e("Received Systray right click."); # get the x and y coords of the mouse to display the menu at. my($x, $y) = Win32::GUI::GetCursorPos(); # make the popup menu visible at the cursor $window->TrackPopupMenu($systray_menu->{SystrayMenu}, $x, $y-50); } # quit the program. we only do it this way so we can track what was clicked. sub _SystrayExit_Click { ¬e("Quitting $SETTINGS->{app}->{name} due to Systray > Exit."); &exit_program; } # hide the window if it's been minimized. the only # way to get it back would be from the systray icon. # we need to figure out what to do when people click # the "X' on the window. minimize? or close the app? sub _Window_Minimize { ¬e("Minimizing window."); $window->Hide(); } sub _Window_Terminate { ¬e("Quitting $SETTINGS->{app}->{name} due to window termination."); &exit_program; } # our exit code - called from various methods in the Windows # GUI (systray quit, window termination, file->exit, etc.) sub exit_program { # kill our children if they are there. if ( $fork_id_path ) { ¬e("Attempting to manually kill path process id: $fork_id_path."); kill( "TERM", $fork_id_path ); } # remove the icon. &_Remove_Systray_Icon; # ciao. exit; } 1; -- ICQ: 2927491 / AOL: akaMorbus Yahoo: morbus_iff / Jabber: mo...@ja... mo...@di... / http://www.disobey.com/ |
From: Johan L. <jo...@ba...> - 2001-07-02 14:11:16
|
Louis wrote: >It works but still gives an error when I exit using the exe >version. Maybe I should give up on the exit thing and let people click on >the windows X to exit. Try not calling exit(0). Long shot but it might work. /J ------ ---- --- -- -- -- - - - - - Johan Lindström Boss Casinos Sourcerer jo...@ba... http://www.bahnhof.se/~johanl/ If the only tool you have is a hammer, everything tends to look like a nail |