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: Piske, H. <Har...@bo...> - 2002-07-09 22:42:56
|
I use it to get some more mouse-related events. The most useful class for that is the RichEdit class. new Win32::GUI::Class ( -name => 'PoorEdit', -widget => 'RichEdit', -extends => 'RichEdit', ); $Main->AddRichEdit( -name => "Rich", -class => "PoorEdit", ... that gives you Rich_LButtonDown, Rich_LButtonUp, Rich_RButtonDown, Rich_RButtonUp, and Rich_KeyPress. Maybe even Rich_MouseMove, I'm not sure. You can safely say -widget => 'Button', -extends => 'RichEdit', to use this class on a button - however, I think that will kill the 3D-behavior (the button looking like being pushed inwards by a mouse-click and popping back upon release) Sometimes you will get _Anonymous events for a widget with the message ID as first parameter - that may be exploited, but you won't get all the "missing" events on all the widgets. I also don't remember what other classes are there - I got this wisdom from reading the GUI.xs source code (look for "MsgLoop", especially "RichEditMsgLoop" and go from there). Note, this applies to Win32-GUI Version 0.0.558 - from V.665, there is a totally new event model (conveniently called "new event model", NEM) which renders the classes inoperative. With this NEM, you can get any widget to invoke subs for a lot of events, so in fact that's a lot better - I hear. Didn't play around with it myself yet. Have fun, Harald > -----Original Message----- > From: Steven Swenson [mailto:ssw...@su...] > Sent: Tuesday, July 09, 2002 15:20 > To: per...@li... > Subject: [perl-win32-gui-users] Win32::GUI::Class() ?? > > > Hi all, > I was curious if anyone has any examples of how to use the > Win32::GUI::Class function to create new class of windows? > Would this allow the use of new events? or combination of > existing classes? > > --Steve > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Stuff, things, and much much more. > http://thinkgeek.com/sf > _______________________________________________ > Perl-Win32-GUI-Users mailing list > Per...@li... > https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users > |
From: Steven S. <ssw...@su...> - 2002-07-09 22:14:22
|
Hi all, I was curious if anyone has any examples of how to use the Win32::GUI::Class function to create new class of windows? Would this allow the use of new events? or combination of existing classes? --Steve |
From: <Kev...@al...> - 2002-07-09 09:01:36
|
Peter, Win32::Pipe allows you to use named pipes for interprocess communication. One process has to act as a server, any others as clients. You might want to have a look at the PerlIPC doc as well. Here's a very simple Win32::Pipe server: use Win32::Pipe; $p = new Win32::Pipe("MyPipe"); # create pipe $res = $p->Connect(); # wait for a process to connect while ($data = $p->Read() ) { print "RECEIVED: $data\n"; } $p->Disconnect(); # disconnect $p->Close(); # close pipe and a client use Win32::Pipe; my $p = new Win32::Pipe("\\\\.\\pipe\\MyPipe"); # client must yous \\server\pipe\pipename syntax for ( my $i = 0; $i <=10 ; $i++) { $p->Write("\$i = $i\n"); # could read from the pipe as well sleep 1; # without a delay all the writes go across at once } $p->Close(); The problem with this is that while waiting for a connection your server script won't be able to respond to user input. This is going to be a problem you hit with most IPC methods. Win32::GUI does give you access to SendMessage in the Win32 api so it may be possible to use that. I have a vague recollection that some of the messages were user definable but wouldn't swear to this. You could look on MSDN to find out. SendMessage details are at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/messagesandmessagequeues/messagesandmessagequeuesreference/messagesandmessagequeuesfunctions/sendmessage.asp Good luck. Kev. |---------+------------------------------------------------> | | "Straub, Peter (Peter)" | | | <st...@op...> | | | Sent by: | | | per...@li...ur| | | ceforge.net | | | | | | | | | 08/07/2002 17:08 | | | | |---------+------------------------------------------------> >----------------------------------------------------------------------------------------------| | | | To: per...@li... | | cc: | | Subject: [perl-win32-gui-users] communication between GUI scripts | >----------------------------------------------------------------------------------------------| Hi all, does anyone know of a reliable way for two Win32::GUI scripts to communicate with each other? They run as separated processes. My idea was to simply write data to a file and send a notification of some kind to the other process (concurrent accesses not being an issue here). What came to my mind in the first place was to use 'PostMessage'. Using Win32::GuiTest I am able to retrieve the adressee's window handle, but what message should I post? As far as I know there is no support for user defined messages (at least I have no idea how to retrieve one). I also tried Win32::GuiTest's SendKeys function to notify a dummy window in the other application by simulating keystrokes. This gradually turned out to be a real horror because the receiving control must be the foreground window in order for SendKeys to succeed and every box popping up at the wrong time spoils the whole thing... Could you please help with better ideas how to accomplish this? TIA and Cheers, Peter ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Oh, it's good to be a geek. http://thinkgeek.com/sf _______________________________________________ Perl-Win32-GUI-Users mailing list Per...@li... https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users |
From: Straub, P. (Peter) <st...@op...> - 2002-07-08 16:09:06
|
Hi all, does anyone know of a reliable way for two Win32::GUI scripts to communicate with each other? They run as separated processes. My idea was to simply write data to a file and send a notification of some kind to the other process (concurrent accesses not being an issue here). What came to my mind in the first place was to use 'PostMessage'. Using Win32::GuiTest I am able to retrieve the adressee's window handle, but what message should I post? As far as I know there is no support for user defined messages (at least I have no idea how to retrieve one). I also tried Win32::GuiTest's SendKeys function to notify a dummy window in the other application by simulating keystrokes. This gradually turned out to be a real horror because the receiving control must be the foreground window in order for SendKeys to succeed and every box popping up at the wrong time spoils the whole thing... Could you please help with better ideas how to accomplish this? TIA and Cheers, Peter |
From: Peter E. <Pet...@at...> - 2002-07-08 13:07:19
|
First you set up your $menu. Then it is done something like this... I have a script that does this when a user Click's on a NotifyIcon, so within the sub ni_Click there is: my ( $nipx, $nipy ) = Win32::GUI::GetCursorPos (); $Window->TrackPopupMenu( $menu -> {'PopUpMenu'}, $nipx, $nipy ); HTH, Pete > -----Original Message----- > From: Bjoern Hoehrmann [mailto:der...@gm...] > Sent: Saturday, July 06, 2002 05:33 > To: per...@li... > Subject: [perl-win32-gui-users] Context Menus > > > Hi, > > I want to create a context menu, but I am not sure if Win32::GUI > supports them. Basically, as far as I understand it, the code is > already in the module (calls to CreatePopupMenu, TrackPopupMenu, > InsertMenuItem), but I don't know how they fit together. Hints? > > regards. > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > We have stuff for geeks like you. > http://thinkgeek.com/sf > _______________________________________________ > Perl-Win32-GUI-Users mailing list > Per...@li... > https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users > |
From: Bjoern H. <der...@gm...> - 2002-07-06 09:32:48
|
Hi, I want to create a context menu, but I am not sure if Win32::GUI supports them. Basically, as far as I understand it, the code is already in the module (calls to CreatePopupMenu, TrackPopupMenu, InsertMenuItem), but I don't know how they fit together. Hints? regards. |
From: Mark Di N. <amo...@ih...> - 2002-07-03 07:23:28
|
carollyne courtney wrote: > Hi, > > How do I automatically scroll down and select the most currently > appended item in a ListView? > > Thanks > > -snip- > > use Win32::GUI; > use strict; > > my $W = new Win32::GUI::Window( > -left => 50, > -top => 387, > -width => 200, > -height => 200, > -name => "test", > -text => "listview" > ); > > $W->AddListView( > -name => "lv", > -text => "", > -left => 0, > -top => 0, > -width => 180, > -height => 170, > -style => WS_CHILD | WS_VISIBLE | 1, > -singlesel => 1, > -fullrowselect => 1, > -gridlines => 1, > # -checkboxes => 1, > -hottrack => 1, > ); > > $W->lv->InsertColumn( > -index => 0, > -width => $W->lv->ScaleWidth, > -text => "one", > #-align => "center" > ); > > $W->Show(); > > > for my $i ( 0 .. 30 ) { > insert($i); > } > > Win32::GUI::Dialog(); > > sub insert { > my $item = $W->lv->InsertItem( > -item => $W->lv->Count(), > -text => $_[0], > -select => 1, > ); > > # How do I select the current item? > # $W->lv->Select($item); > > } thats it - $W->lv->Select($i); |
From: carollyne c. <car...@ho...> - 2002-07-03 07:05:45
|
Hi, How do I automatically scroll down and select the most currently appended item in a ListView? Thanks -snip- use Win32::GUI; use strict; my $W = new Win32::GUI::Window( -left => 50, -top => 387, -width => 200, -height => 200, -name => "test", -text => "listview" ); $W->AddListView( -name => "lv", -text => "", -left => 0, -top => 0, -width => 180, -height => 170, -style => WS_CHILD | WS_VISIBLE | 1, -singlesel => 1, -fullrowselect => 1, -gridlines => 1, # -checkboxes => 1, -hottrack => 1, ); $W->lv->InsertColumn( -index => 0, -width => $W->lv->ScaleWidth, -text => "one", #-align => "center" ); $W->Show(); for my $i ( 0 .. 30 ) { insert($i); } Win32::GUI::Dialog(); sub insert { my $item = $W->lv->InsertItem( -item => $W->lv->Count(), -text => $_[0], -select => 1, ); # How do I select the current item? # $W->lv->Select($item); } _________________________________________________________________ Join the worlds largest e-mail service with MSN Hotmail. http://www.hotmail.com |
From: Steven S. <ssw...@su...> - 2002-07-03 02:18:41
|
At 08:35 PM 7/2/02, you wrote: So... Once I have placed a list of things into a listview how do I retrieve them later? having a GetList() method returning a List would be nice :) Any ideas? --Steve |
From: Steven S. <ssw...@su...> - 2002-07-03 01:28:18
|
When the number of items inserted into the list exeeds its current displayable size my list box disappears... That is it vanishes and does not redraw itself... I have placed $listview->Update() and $listview->SetReDraw (1) but that doesnot appear to make a difference. Is there an option I should make sure is enabled in the Listview ? --Steve |
From: Andrea M. <mae...@fr...> - 2002-07-02 10:09:24
|
"Rogers, John" wrote: > > Hi, > If you specify, -multiline=>1, when you define the textfield, then the > Change() event occurs when the user presses enter. > > My idea is you could search the text string as each character is typed > and match on "enter". > something like this, > > #untested code > sub textfield_Change{my $rtest = 0; > my $input =''; > $input=$MW->tf->Text(); > $rtest = $input=~s/\r\n/''/egsm; better is (I hope): $rtest = $input=~/\r\n$/; :) -- $_=q,6;-16;-1;-8;0;7;-13;-12;-9;-3;13#4A75737420616E6F74686572,,($_,$b)= split?#?;@b=split?;?;map{$c.=$_,$d.=chr$b[$e++]+ord}split??,pack'H24',$b ;chop$d,print$c.chr(32).$d |
From: Steven S. <ssw...@su...> - 2002-07-02 03:03:14
|
Thanks Roger, '-mulitline' seems to do the trick! I will have to do some=20 cleaning but I think I can get it to work. I already had a similar test for Text() to check for return character by character and Text doesn't=20 return those characters. Thanks for your help. --steve At 09:02 PM 7/1/02, Rogers, John wrote: >Hi, >If you specify, -multiline=3D>1, when you define the textfield, then the >Change() event occurs when the user presses enter. > >My idea is you could search the text string as each character is typed >and match on "enter". >something like this, > >#untested code >sub textfield_Change{my $rtest =3D 0; > my $input =3D''; > $input=3D$MW->tf->Text(); > $rtest =3D $input=3D~s/\r\n/''/egsm; > if($rtest){print "User pressed enter, better do somthing >here"; > } >} > > >JohnR > > > > -----Original Message----- > > From: Steven Swenson [mailto:ssw...@su...] > > Sent: Tuesday, 2 July 2002 10:19 AM > > To: per...@li... > > Subject: RE: [perl-win32-gui-users] How do I recognize that > > the user has > > pressed enter inside a text box? > > > > > > Basically I want the equivalent of the pascal readln or perl $input =3D > > <STDIN>; from within a textbox. > > the Text() method does allow me to gain access to the > > information entered > > but does not tell me whether the information > > was committed to by the user. I don't want to use a button > > if I can get > > away with it. > > > > any ideas? > > > > --Steve > > > > > > At 06:03 PM 7/1/02, you wrote: > > >Uh-oh ... that's a tricky one as far as I remember. Never > > did it myself, I > > >only have dialogs where the user triggers something with a > > button anyway. If > > >you want to capture the enter key, I'm afraid you have to go > > with those very > > >much not trivial accelerators. There has been a recent > > posting about them, > > >if that doesn't help you, you should go back to the list and post a > > >follow-up question. > > > > > >cya > > >Harald > > > > > > > -----Original Message----- > > > > From: Steven Swenson [mailto:ssw...@su...] > > > > Sent: Monday, July 01, 2002 16:03 > > > > To: Piske, Harald > > > > Subject: RE: [perl-win32-gui-users] How do I read the > > information in a > > > > tex tbox? > > > > > > > > > > > > You assumed correctly :). However, the Text() method doesn't > > > > appear to > > > > return either a \r or a \n ... so how do I determine whether > > > > the user has > > > > in fact entered the data? > > > > > > > > --Steve > > > > > > > > > > > > At 05:14 PM 7/1/02, you wrote: > > > > >I'm assuming you want to get the contents of a text field, > > > > not text file ... > > > > >;-) > > > > >There is the Text() method, defined as a general function, > > > > i.e. should be > > > > >valid for all widgets. It returns all of a field's contents. > > > > If you want the > > > > >bit that's selected: > > > > > > > > > >($from, $to) =3D $Main->MyField->Selection() > > > > >$selectedText =3D substr ($Main->MyField->Text(), $from, > > $to - $from); > > > > > > > > > >I'm not too sure about special cases (what are the values of > > > > Selection() > > > > >when there is nothing selected, what if the selection > > > > includes the very last > > > > >character, do you have to adjust the values by one for each > > > > crlf etc), but > > > > >that's the basic idea. > > > > > > > > > >Have fun, > > > > >Harald > > > > > > > > > > > -----Original Message----- > > > > > > From: Steven Swenson > > [mailto:ssw...@su...] > > > > > > Sent: Monday, July 01, 2002 15:06 > > > > > > To: per...@li... > > > > > > Subject: [perl-win32-gui-users] How do I read the > > information in a > > > > > > textbox? > > > > > > > > > > > > > > > > > > Ok, This feels like a silly question. However the > > > > > > documentation I have on > > > > > > Win32::Gui does not seem to specify a method by which I can > > > > > > actually read > > > > > > the content of a text file. All select, selectAll do is tell > > > > > > me they are > > > > > > successful. And Change() is called for every > > > > character... so I hope > > > > > > someone can give me a hand. > > > > > > > > > > > > --Steve > > > > > > > > > > > > > > > > > > > > > > > > ------------------------------------------------------- > > > > > > This sf.net email is sponsored by:ThinkGeek > > > > > > Welcome to geek heaven. > > > > > > http://thinkgeek.com/sf > > > > > > _______________________________________________ > > > > > > Perl-Win32-GUI-Users mailing list > > > > > > Per...@li... > > > > > > > > https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users > > > > > > > > > > > > > > > > > > ------------------------------------------------------- > > This sf.net email is sponsored by:ThinkGeek > > Welcome to geek heaven. > > http://thinkgeek.com/sf > > _______________________________________________ > > Perl-Win32-GUI-Users mailing list > > Per...@li... > > https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users > > > > >############################################################## >Disclaimer > >If this e-mail has been sent to you in error, please notify >Oc=E9-Australia Limited immediately and delete this e-mail from >your system. > >Any views expressed in this e-mail are those of the individual >sender and may not necessarily reflect the views of >Oc=E9-Australia Limited. >############################################################## > > >------------------------------------------------------- >This sf.net email is sponsored by:ThinkGeek >Welcome to geek heaven. >http://thinkgeek.com/sf >_______________________________________________ >Perl-Win32-GUI-Users mailing list >Per...@li... >https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users |
From: Rogers, J. <rog...@oc...> - 2002-07-02 02:10:22
|
Hi, If you specify, -multiline=>1, when you define the textfield, then the Change() event occurs when the user presses enter. My idea is you could search the text string as each character is typed and match on "enter". something like this, #untested code sub textfield_Change{my $rtest = 0; my $input =''; $input=$MW->tf->Text(); $rtest = $input=~s/\r\n/''/egsm; if($rtest){print "User pressed enter, better do somthing here"; } } JohnR > -----Original Message----- > From: Steven Swenson [mailto:ssw...@su...] > Sent: Tuesday, 2 July 2002 10:19 AM > To: per...@li... > Subject: RE: [perl-win32-gui-users] How do I recognize that > the user has > pressed enter inside a text box? > > > Basically I want the equivalent of the pascal readln or perl $input = > <STDIN>; from within a textbox. > the Text() method does allow me to gain access to the > information entered > but does not tell me whether the information > was committed to by the user. I don't want to use a button > if I can get > away with it. > > any ideas? > > --Steve > > > At 06:03 PM 7/1/02, you wrote: > >Uh-oh ... that's a tricky one as far as I remember. Never > did it myself, I > >only have dialogs where the user triggers something with a > button anyway. If > >you want to capture the enter key, I'm afraid you have to go > with those very > >much not trivial accelerators. There has been a recent > posting about them, > >if that doesn't help you, you should go back to the list and post a > >follow-up question. > > > >cya > >Harald > > > > > -----Original Message----- > > > From: Steven Swenson [mailto:ssw...@su...] > > > Sent: Monday, July 01, 2002 16:03 > > > To: Piske, Harald > > > Subject: RE: [perl-win32-gui-users] How do I read the > information in a > > > tex tbox? > > > > > > > > > You assumed correctly :). However, the Text() method doesn't > > > appear to > > > return either a \r or a \n ... so how do I determine whether > > > the user has > > > in fact entered the data? > > > > > > --Steve > > > > > > > > > At 05:14 PM 7/1/02, you wrote: > > > >I'm assuming you want to get the contents of a text field, > > > not text file ... > > > >;-) > > > >There is the Text() method, defined as a general function, > > > i.e. should be > > > >valid for all widgets. It returns all of a field's contents. > > > If you want the > > > >bit that's selected: > > > > > > > >($from, $to) = $Main->MyField->Selection() > > > >$selectedText = substr ($Main->MyField->Text(), $from, > $to - $from); > > > > > > > >I'm not too sure about special cases (what are the values of > > > Selection() > > > >when there is nothing selected, what if the selection > > > includes the very last > > > >character, do you have to adjust the values by one for each > > > crlf etc), but > > > >that's the basic idea. > > > > > > > >Have fun, > > > >Harald > > > > > > > > > -----Original Message----- > > > > > From: Steven Swenson > [mailto:ssw...@su...] > > > > > Sent: Monday, July 01, 2002 15:06 > > > > > To: per...@li... > > > > > Subject: [perl-win32-gui-users] How do I read the > information in a > > > > > textbox? > > > > > > > > > > > > > > > Ok, This feels like a silly question. However the > > > > > documentation I have on > > > > > Win32::Gui does not seem to specify a method by which I can > > > > > actually read > > > > > the content of a text file. All select, selectAll do is tell > > > > > me they are > > > > > successful. And Change() is called for every > > > character... so I hope > > > > > someone can give me a hand. > > > > > > > > > > --Steve > > > > > > > > > > > > > > > > > > > > ------------------------------------------------------- > > > > > This sf.net email is sponsored by:ThinkGeek > > > > > Welcome to geek heaven. > > > > > http://thinkgeek.com/sf > > > > > _______________________________________________ > > > > > Perl-Win32-GUI-Users mailing list > > > > > Per...@li... > > > > > > https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users > > > > > > > > > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Perl-Win32-GUI-Users mailing list > Per...@li... > https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users > ############################################################## Disclaimer If this e-mail has been sent to you in error, please notify Océ-Australia Limited immediately and delete this e-mail from your system. Any views expressed in this e-mail are those of the individual sender and may not necessarily reflect the views of Océ-Australia Limited. ############################################################## |
From: Steven S. <ssw...@su...> - 2002-07-02 00:11:48
|
Basically I want the equivalent of the pascal readln or perl $input = <STDIN>; from within a textbox. the Text() method does allow me to gain access to the information entered but does not tell me whether the information was committed to by the user. I don't want to use a button if I can get away with it. any ideas? --Steve At 06:03 PM 7/1/02, you wrote: >Uh-oh ... that's a tricky one as far as I remember. Never did it myself, I >only have dialogs where the user triggers something with a button anyway. If >you want to capture the enter key, I'm afraid you have to go with those very >much not trivial accelerators. There has been a recent posting about them, >if that doesn't help you, you should go back to the list and post a >follow-up question. > >cya >Harald > > > -----Original Message----- > > From: Steven Swenson [mailto:ssw...@su...] > > Sent: Monday, July 01, 2002 16:03 > > To: Piske, Harald > > Subject: RE: [perl-win32-gui-users] How do I read the information in a > > tex tbox? > > > > > > You assumed correctly :). However, the Text() method doesn't > > appear to > > return either a \r or a \n ... so how do I determine whether > > the user has > > in fact entered the data? > > > > --Steve > > > > > > At 05:14 PM 7/1/02, you wrote: > > >I'm assuming you want to get the contents of a text field, > > not text file ... > > >;-) > > >There is the Text() method, defined as a general function, > > i.e. should be > > >valid for all widgets. It returns all of a field's contents. > > If you want the > > >bit that's selected: > > > > > >($from, $to) = $Main->MyField->Selection() > > >$selectedText = substr ($Main->MyField->Text(), $from, $to - $from); > > > > > >I'm not too sure about special cases (what are the values of > > Selection() > > >when there is nothing selected, what if the selection > > includes the very last > > >character, do you have to adjust the values by one for each > > crlf etc), but > > >that's the basic idea. > > > > > >Have fun, > > >Harald > > > > > > > -----Original Message----- > > > > From: Steven Swenson [mailto:ssw...@su...] > > > > Sent: Monday, July 01, 2002 15:06 > > > > To: per...@li... > > > > Subject: [perl-win32-gui-users] How do I read the information in a > > > > textbox? > > > > > > > > > > > > Ok, This feels like a silly question. However the > > > > documentation I have on > > > > Win32::Gui does not seem to specify a method by which I can > > > > actually read > > > > the content of a text file. All select, selectAll do is tell > > > > me they are > > > > successful. And Change() is called for every > > character... so I hope > > > > someone can give me a hand. > > > > > > > > --Steve > > > > > > > > > > > > > > > > ------------------------------------------------------- > > > > This sf.net email is sponsored by:ThinkGeek > > > > Welcome to geek heaven. > > > > http://thinkgeek.com/sf > > > > _______________________________________________ > > > > Perl-Win32-GUI-Users mailing list > > > > Per...@li... > > > > https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users > > > > > > |
From: Steven S. <ssw...@su...> - 2002-07-01 23:43:43
|
Basically I want the equivalent of the pascal readln or perl $input = <STDIN>; from within a textbox. the Text() method does allow me to gain access to the information entered but does not tell me whether the information was committed to by the user. I don't want to use a button if I can get away with it. any ideas? --Steve At 06:03 PM 7/1/02, you wrote: >Uh-oh ... that's a tricky one as far as I remember. Never did it myself, I >only have dialogs where the user triggers something with a button anyway. If >you want to capture the enter key, I'm afraid you have to go with those very >much not trivial accelerators. There has been a recent posting about them, >if that doesn't help you, you should go back to the list and post a >follow-up question. > >cya >Harald > > > -----Original Message----- > > From: Steven Swenson [mailto:ssw...@su...] > > Sent: Monday, July 01, 2002 16:03 > > To: Piske, Harald > > Subject: RE: [perl-win32-gui-users] How do I read the information in a > > tex tbox? > > > > > > You assumed correctly :). However, the Text() method doesn't > > appear to > > return either a \r or a \n ... so how do I determine whether > > the user has > > in fact entered the data? > > > > --Steve > > > > > > At 05:14 PM 7/1/02, you wrote: > > >I'm assuming you want to get the contents of a text field, > > not text file ... > > >;-) > > >There is the Text() method, defined as a general function, > > i.e. should be > > >valid for all widgets. It returns all of a field's contents. > > If you want the > > >bit that's selected: > > > > > >($from, $to) = $Main->MyField->Selection() > > >$selectedText = substr ($Main->MyField->Text(), $from, $to - $from); > > > > > >I'm not too sure about special cases (what are the values of > > Selection() > > >when there is nothing selected, what if the selection > > includes the very last > > >character, do you have to adjust the values by one for each > > crlf etc), but > > >that's the basic idea. > > > > > >Have fun, > > >Harald > > > > > > > -----Original Message----- > > > > From: Steven Swenson [mailto:ssw...@su...] > > > > Sent: Monday, July 01, 2002 15:06 > > > > To: per...@li... > > > > Subject: [perl-win32-gui-users] How do I read the information in a > > > > textbox? > > > > > > > > > > > > Ok, This feels like a silly question. However the > > > > documentation I have on > > > > Win32::Gui does not seem to specify a method by which I can > > > > actually read > > > > the content of a text file. All select, selectAll do is tell > > > > me they are > > > > successful. And Change() is called for every > > character... so I hope > > > > someone can give me a hand. > > > > > > > > --Steve > > > > > > > > > > > > > > > > ------------------------------------------------------- > > > > This sf.net email is sponsored by:ThinkGeek > > > > Welcome to geek heaven. > > > > http://thinkgeek.com/sf > > > > _______________________________________________ > > > > Perl-Win32-GUI-Users mailing list > > > > Per...@li... > > > > https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users > > > > > > |
From: Piske, H. <Har...@bo...> - 2002-07-01 22:17:49
|
I'm assuming you want to get the contents of a text field, not text file ... ;-) There is the Text() method, defined as a general function, i.e. should be valid for all widgets. It returns all of a field's contents. If you want the bit that's selected: ($from, $to) = $Main->MyField->Selection() $selectedText = substr ($Main->MyField->Text(), $from, $to - $from); I'm not too sure about special cases (what are the values of Selection() when there is nothing selected, what if the selection includes the very last character, do you have to adjust the values by one for each crlf etc), but that's the basic idea. Have fun, Harald > -----Original Message----- > From: Steven Swenson [mailto:ssw...@su...] > Sent: Monday, July 01, 2002 15:06 > To: per...@li... > Subject: [perl-win32-gui-users] How do I read the information in a > textbox? > > > Ok, This feels like a silly question. However the > documentation I have on > Win32::Gui does not seem to specify a method by which I can > actually read > the content of a text file. All select, selectAll do is tell > me they are > successful. And Change() is called for every character... so I hope > someone can give me a hand. > > --Steve > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Perl-Win32-GUI-Users mailing list > Per...@li... > https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users > |
From: Steven S. <ssw...@su...> - 2002-07-01 22:00:56
|
Ok, This feels like a silly question. However the documentation I have on Win32::Gui does not seem to specify a method by which I can actually read the content of a text file. All select, selectAll do is tell me they are successful. And Change() is called for every character... so I hope someone can give me a hand. --Steve |
From: Chris I. <ch...@sp...> - 2002-07-01 15:33:04
|
Heh... should've mentioned I tried it under two builds of ActivePerl and v558 and 665 of Win32::GUI :) What I have found is that if I load up DestroyWindow via Win32::API, and then do an "exit", right afterwards, it disappears (presumably because the perl environment thinks it's dying, and cleans up after itself)... but at least in the script host environment I'm in, calling exit doesn't seem to do much of anything except keep it from crashing :) Thanks for the suggestion regarding TK, however, it's very important in this particular instance that everthing look "Windowsy", my users are very change-phobic and they'll probably be frightened of anything unfamiliar :) I'll give the $_ trick a shot and see if it does anything for me. -chris -----Original Message----- From: per...@li... [mailto:per...@li...]On Behalf Of Piske, Harald Sent: Monday, July 01, 2002 11:21 AM To: 'Chris Ingrassia'; per...@li... Subject: RE: [perl-win32-gui-users] crashes... Win32-GUI Versions 0.558 and 0.665 are totally different, the latter being a thorough rework. If you use one, try the other to see if it helps. I've made a post the other day about GUI crashing when I use DoEvents() - like you, I could only do some magic to shift the crash to a different point. What seemed to help: putting something into $_ (without using local). Maybe there IS an issue with garcol as you suggest because at the point where I experienced crashes, the $_ from the caller usually held a reference to a complex struct, so doing $_=0 must have caused some cleanups. Here's something you might not like: I've tested the crashy script under GUI558 and 665, Win2k and 98, Perl618 and 631 and many combinations of those and the crash doesn't seem to care. Here's another idea you might not like: when I came to a dead end in another project (not due to GUI crashing, but because it fails with some graphics elements under 98), I switched to Tk. Sometimes, depending on the project, personal taste and probably moonlight, it beats VB and if you already have the core functionality in Perl, it may be worth the effort of picking up Tk, if you're not yet familiar with it. Its most commonly used window manager ('pack') is less like GUI and more like Java in that it arranges "floating" widgets, but there are also ways to use fixed pixel coords. I'm not too good in Tk myself, I don't know if it comes with all the widgets of windows (haven't seen combo boxes yet and did not need accelerators). The trick seems to be NOT to try and make it do exactly what you're used from GUI but just take what it offers - I found some things a lot easier than with GUI and some more tricky. Have fun, Harald ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Perl-Win32-GUI-Users mailing list Per...@li... https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users |
From: Piske, H. <Har...@bo...> - 2002-07-01 15:24:17
|
Win32-GUI Versions 0.558 and 0.665 are totally different, the latter being a thorough rework. If you use one, try the other to see if it helps. I've made a post the other day about GUI crashing when I use DoEvents() - like you, I could only do some magic to shift the crash to a different point. What seemed to help: putting something into $_ (without using local). Maybe there IS an issue with garcol as you suggest because at the point where I experienced crashes, the $_ from the caller usually held a reference to a complex struct, so doing $_=0 must have caused some cleanups. Here's something you might not like: I've tested the crashy script under GUI558 and 665, Win2k and 98, Perl618 and 631 and many combinations of those and the crash doesn't seem to care. Here's another idea you might not like: when I came to a dead end in another project (not due to GUI crashing, but because it fails with some graphics elements under 98), I switched to Tk. Sometimes, depending on the project, personal taste and probably moonlight, it beats VB and if you already have the core functionality in Perl, it may be worth the effort of picking up Tk, if you're not yet familiar with it. Its most commonly used window manager ('pack') is less like GUI and more like Java in that it arranges "floating" widgets, but there are also ways to use fixed pixel coords. I'm not too good in Tk myself, I don't know if it comes with all the widgets of windows (haven't seen combo boxes yet and did not need accelerators). The trick seems to be NOT to try and make it do exactly what you're used from GUI but just take what it offers - I found some things a lot easier than with GUI and some more tricky. Have fun, Harald |
From: Chris I. <ch...@sp...> - 2002-07-01 13:11:11
|
If anyone could offer any insight here, it would be greatly aprpecaited. I have been struggling with Win32::GUI for a few days now, and I keep running into the same problem. Using ActivePerl (the latest build, I can't remember the build number off the top of my head) inside a Windows Script Host environment, the host application consistently crashes every single time I return -1 from an event handler to terminate the message loop. It seems like as soon as the message loop exits, somebody, somewhere, tries to do some cleanup and dereferences a null pointer somewhere along the line. That's a best-guess on my part, as the host application is SoftQuad XMetaL 3, and I have no debugging symbols for it, or ActivePerl, and I can't figure out if it's even possible to attach a debugger to a Win32::GUI app running in such a fashion. The only way I can get it to NOT crash is inside the _Terminate event handler, by calling PostQuitMessage, and then returning 1, which seems to destroy the window, and the application never crashes. I can delay the crash until somebody exits the application by hiding the window(s) and returning 1 from my event handlers, but all that does is keep the window handles floating around until the application closes, and then it crashes. I need to make the windows shut down after a user clicks on certain buttons, and I just can't seem to do it without making everything crash and burn. Here are the things I've tried so far: Calling $Window->PostQuitMessage from inside my button event handlers Returning -1 from my event handlers Loading the DestroyWindow function through Win32::API, and then calling it with the {-handle} of my main window Calling $Window->DestroyWindow Calling $Window->PostMessage(WM_QUIT, 0, 0) "" "" "" WM_DESTROY And just about every single combination thereof. I can't track down the problem much more specifically, but I know it happens when the Win32::GUI::Dialog loop terminates, and I know it crashes inside of Perl56.dll somewhere. I think a lot of it just has to do with the fact that were I not running in a somewhat persistent Windows Script Host environment, more garbage collection would be done by perl, but since I can't force a reload of the scripting environment, I'm kind of stuck... I've also tried everything I could think of to trick perl into running a garbage collection pass on my windows, but they all ended up with the application crashing at one point or another. If I can't get this to work, I'll be forced to use Visual Studio, and I _REALLY_ don't want to :) So if anyone has had any similar problems, or has any ideas, I'd really love to hear them. Thanks, Chris |
From: <ma...@mm...> - 2002-06-28 05:43:27
|
thanx for all the replies. i think i'll just stick with what i'm using at the moment and see if i can figure out where its going wrong. on a different note, is it possible to put a copyright symbol in the window title? AND i was just going through the samples and i noticed in pmx.pl that the menu accelerators actually work, so i added the & in front of menu items in my program but it doesn't work for the top menu entry. so if i press alt+f for file nothing will happen but if i click on file and press s the settings window will appear. any ideas? thanx in advance Mark Di Nicola <amo...@ih...> Sent by: To: Kev...@al... per...@li...urc cc: eforge.net per...@li..., per...@li... Subject: Re: [perl-win32-gui-users] sorting a 27/06/02 08:26 PM listview Kev...@al... wrote: > Mark, > > Haven't had time to examine your code to closely but it looks as though > you're sorting everything as strings. I assume the quantity should be a > number? > > I've used something like the code below to try to deal with this. I can > send you a working example if you need it and this is your problem. > > Cheers, > > Kev. > > sub alpascend { > uc($details{$a}[$col]) cmp uc ($details{$b}[$col]); > } > > sub numdescend { > $details{$b}[$col] <=> $details{$a}[$col]; > } > > sub alpdescend { > uc($details{$b}[$col]) cmp ($details{$a}[$col]); > } > > sub initlv { > $Window->ListView->Clear(); > my $rout; > > @index=keys %details; > $rout= $details{1}[$col]=~ /^\d/ ? "num" : "alp"; > > if ($dir==1) { > $rout.="ascend"; > } else { > $rout.="descend"; > } > > @index= sort $rout @index; > > foreach $i (@index) { > if ($details{$i}[0] ne '..') { > InsertListItem(0, $details{$i}[0], $details{$i}[1]); > } else { > InsertListItem(1, $details{$i}[0], $details{$i}[1]); > } > } > $Window->ListView->SetFocus(); > } > > sub ListView_ColumnClick { > $col=shift; > if ($col==$lastcol) { > $dir= $dir * -1; > } else { > $dir= -1; > } > initlv($dir); > $lastcol=$col; > } > > > > |---------+------------------------------------------------> > | | ma...@mm... | > | | Sent by: | > | | per...@li...ur| > | | ceforge.net | > | | | > | | | > | | 27/06/2002 07:32 | > | | | > |---------+------------------------------------------------> > > ----------------------------------------------------------------------------------------------| > | | > | To: per...@li... | > | cc: | > | Subject: [perl-win32-gui-users] sorting a listview | > > ----------------------------------------------------------------------------------------------| > > > > > hi. i've got alist view with 4 columns, being catalogue number, artist, > title and qty (there's 2 other columns but they don't matter) and i've been > trying to figure out how to sort the whole listview on a column click. i > found a message sometime last year where someone posted something that i > kind of got working, after a bit of tweaking. the problem is that the qty > column doesn't sort properly and i just can't seem to figure out why. all > the other columns sort fine when i click on them. any ideas? code below > > thanx in advance > > > sub ListView_ColumnClick { > $totalcols = 6; > my $column = shift; > print "column:$column\n"; > $column=$column+1; > > ## i do this so that I can toggle between ascending and descending > sorts > ## 0 = ascending (A-Z), 1 = decending (Z - A) > if ($lastcolumn == $column) # if you clicked the same column twice in > a row > {$sortorder = 1 - $sortorder;} # toggle between 1 and 0 values > else > {$sortorder = 0;} > print "You Clicked $column, last time it was $lastcolumn,sortorder > =$sortorder\n"; > $lastcolumn = $column; > > %data=(); > $rows=$ListView->Count(); > print "rows:$rows\n"; > for $i(0..$rows-1) > { > $row=""; > my %result=$ListView->GetItem($i,0); > $image=$result{-image}; > for $j(0..$totalcols-1) > { > my %result=$ListView->GetItem($i,$j); > $text=$result{-text}; > $row.=",$text"; > } > $data{$i}="$image$row"; > } > > my %sortcol = NewList($column, %data); > SortListItem(\%data,\%sortcol,$column); > if ($sortorder) { > print "Sorted descending by Column $column\n"; > } else { > print "Sorted ascending by Column $column\n"; > } > return; > } > > sub SortListItem { > my ($data,$sortcol,$column) = @_; > my $check; > my %data = %$data; > my %sortcol = %$sortcol; > > $check = "$_" foreach (values %sortcol); > > $ListView->Clear(); ## clear the ListView window > $index = 0; > if ($sortorder == 0) > { ## this is sorting in ascending order > if (($column == 1) or ($column == 4)) > { > print "sorting numerically\n"; > foreach (sort { > (substr($sortcol{$a},0,index($sortcol{$a}," "))) <=> > (substr($sortcol{$b},0,index($sortcol{$b}," "))) } > keys %sortcol) > { > my @newdata = split/,/,$data{$_}; > print $data{$_}; > InsertListItem(@newdata); > } > } > else { > foreach (sort { uc($sortcol{$a}) cmp uc($sortcol{$b}) > } keys %sortcol) > { > my @newdata = split/,/,$data{$_}; > print $data{$_}; > InsertListItem(@newdata); > } > } > $ListView->Update(); > } > else > { ## this is sorting in descending order > if (($column == 1) or ($column == 4)) > { > print "sorting numerically\n"; > foreach (sort { > (substr($sortcol{$b},0,index($sortcol{$b}," "))) <=> > (substr($sortcol{$a},0,index($sortcol{$a}," "))) } keys > %sortcol) > { > my @newdata = split/,/,$data{$_}; > print $data{$_}; > InsertListItem(@newdata); > } > } > else { > foreach (sort { uc($sortcol{$b}) cmp uc($sortcol{$a}) > } keys %sortcol) > { > my @newdata = split/,/,$data{$_}; > print $data{$_}; > InsertListItem(@newdata); > } > $ListView->Update(); > } > } > my $lpPoint = pack("LLLLLALLLL", LVIF_STATE, 0, 0, > 0x2000,LVIS_STATEIMAGEMASK, " ", 127, 0, 0, 0); > my $rtn = $SendMsg->Call($ListView->{'-handle'}, LVM_SETITEMSTATE, -1, > $lpPoint); > > return; > } > > sub NewList { > ## This creates another hash to use only for sorting purposes. > my ($column,%sortcol) = @_; > my $sortthis; > > foreach (keys %sortcol) { > my @info = split /,/, $sortcol{$_}; > $sortthis = $info[$column]; > $sortcol{$_} = "$sortthis"; > } > return(%sortcol); > } > > sub InsertListItem { > my(@info) = @_; > $Window->ListView->InsertItem( > #-item => $Window->ListView->Count(), > -text => [@info[1],@info[2],@info[3],@info[4], > @info[5],@info[6]], > ); > #$Window->ListView->SetItem( > # -item => $item, > # -subitem => 1, > # -text => $description, > # ); > print "@info[1] @info[2] @info[3] @info[4] @info[5] @info[6]\n"; > } > > > > ------------------------------------------------------- > Sponsored by: > ThinkGeek at http://www.ThinkGeek.com/ > _______________________________________________ > Perl-Win32-GUI-Users mailing list > Per...@li... > https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users > > > > > > ------------------------------------------------------- > Sponsored by: > ThinkGeek at http://www.ThinkGeek.com/ > _______________________________________________ > Perl-Win32-GUI-Users mailing list > Per...@li... > https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users > > kevin if you're talking about using cmp instead of <=> then thats not it. depending on which column it is, it will use either of those 2. so for 1 and 4 (cat number and qty) it uses <=> and for anything else it uses cmp. sorting the cat number works perfectly but for qty it doesn't for some reason. mark ------------------------------------------------------- Sponsored by: ThinkGeek at http://www.ThinkGeek.com/ _______________________________________________ Perl-Win32-GUI-Users mailing list Per...@li... https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users |
From: Frazier, J. J. <Joe...@Pe...> - 2002-06-27 15:32:17
|
Here is what I use. I have "global" vars called $dir and $sortCol. = $dir contains the current direction (asc or desc), while $sortCol = contains the last sorted column. Using both, I then either reverse the = sort is the column is the same as the current sorted column, or apply a = asc sort if it is a new column. sub lvwJobposts_ColumnClick{ my $sort =3D shift; #column to sort on, passed in by the click event = and is the header you click on. my @Rows; for(my $x =3D 0; $x < $win->lvwJobposts->Count();$x++){ my @Values; for(my $y =3D 0; $y <=3D $win->lvwJobposts->{Columns}; $y++){ my %data =3D $win->lvwJobposts->ItemInfo($x, $y); push @Values, $data{-text}; } push @Rows, \@Values; =20 =3Dpod this grabs all the columns in a row and stuffs into an array subscript, = then go to the next array subscript and do the same thing again. After = this loop, @Rows is a 2 diminsional array like this: [joe, frazier, 30, tammy], [john, smith, 35, ''], [bill, wilson, 40, Cary] where the columns are laid out like "firstname, lastname, age, wife". =3Dcut=09 } if ($sort =3D=3D $sortCol){ if($dir eq 'f'){ $dir =3D 'b'; }elsif($dir eq 'b'){ $dir =3D 'f'; } }else{ $sortCol =3D $sort; $dir =3D "f"; } my @result; dosort (\@Rows, \@result, $sort, $dir); $win->lvwJobposts->Clear(); for (my $d =3D 0; $d <=3D $#result;$d++){ Win32::GUI::DoEvents(); $win->lvwJobposts->InsertItem(-text =3D>$result[$d]); } } sub dosort { # dosort \@sort, \@result, column 0 to n, 'f'|'r' my ($sort, $sorted, $col, $dir) =3D @_; if ($dir eq 'f') { @$sorted =3D sort { $a->[$col] <=3D> $b->[$col] || $a->[$col] cmp = $b->[$col] } @$sort; } else { @$sorted =3D sort { $b->[$col] <=3D> $a->[$col] || $b->[$col] cmp = $a->[$col] } @$sort; } } This could be cleaned up and made shorter, but It works great and I dont = have time to mess with it right now. Perhaps Aldo can put something in = the core Win32 to handle all this junk for us at some point in the = future. Joe > -----Original Message----- > From: ma...@mm... [mailto:ma...@mm...] > Sent: Thursday, June 27, 2002 2:32 AM > To: per...@li... > Subject: [perl-win32-gui-users] sorting a listview >=20 >=20 > hi. i've got alist view with 4 columns, being catalogue=20 > number, artist, > title and qty (there's 2 other columns but they don't matter)=20 > and i've been > trying to figure out how to sort the whole listview on a=20 > column click. i > found a message sometime last year where someone posted=20 > something that i > kind of got working, after a bit of tweaking. the problem is=20 > that the qty > column doesn't sort properly and i just can't seem to figure=20 > out why. all > the other columns sort fine when i click on them. any ideas?=20 > code below >=20 > thanx in advance >=20 >=20 > sub ListView_ColumnClick { > $totalcols =3D 6; > my $column =3D shift; > print "column:$column\n"; > $column=3D$column+1; >=20 > ## i do this so that I can toggle between ascending and descending > sorts > ## 0 =3D ascending (A-Z), 1 =3D decending (Z - A) > if ($lastcolumn =3D=3D $column) # if you clicked the same=20 > column twice in > a row > {$sortorder =3D 1 - $sortorder;} # toggle between 1=20 > and 0 values > else > {$sortorder =3D 0;} > print "You Clicked $column, last time it was=20 > $lastcolumn,sortorder > =3D$sortorder\n"; > $lastcolumn =3D $column; >=20 > %data=3D(); > $rows=3D$ListView->Count(); > print "rows:$rows\n"; > for $i(0..$rows-1) > { > $row=3D""; > my %result=3D$ListView->GetItem($i,0); > $image=3D$result{-image}; > for $j(0..$totalcols-1) > { > my %result=3D$ListView->GetItem($i,$j); > $text=3D$result{-text}; > $row.=3D",$text"; > } > $data{$i}=3D"$image$row"; > } >=20 > my %sortcol =3D NewList($column, %data); > SortListItem(\%data,\%sortcol,$column); > if ($sortorder) { > print "Sorted descending by Column $column\n"; > } else { > print "Sorted ascending by Column $column\n"; > } > return; > } >=20 > sub SortListItem { > my ($data,$sortcol,$column) =3D @_; > my $check; > my %data =3D %$data; > my %sortcol =3D %$sortcol; >=20 > $check =3D "$_" foreach (values %sortcol); >=20 > $ListView->Clear(); ## clear the ListView window > $index =3D 0; > if ($sortorder =3D=3D 0) > { ## this is sorting in ascending order > if (($column =3D=3D 1) or ($column =3D=3D 4)) > { > print "sorting numerically\n"; > foreach (sort { > (substr($sortcol{$a},0,index($sortcol{$a}," "))) = <=3D> > =20 > (substr($sortcol{$b},0,index($sortcol{$b}," "))) } > keys %sortcol) > { > my @newdata =3D split/,/,$data{$_}; > print $data{$_}; > InsertListItem(@newdata); > } > } > else { > foreach (sort { uc($sortcol{$a}) cmp uc($sortcol{$b}) > } keys %sortcol) > { > my @newdata =3D split/,/,$data{$_}; > print $data{$_}; > InsertListItem(@newdata); > } > } > $ListView->Update(); > } > else > { ## this is sorting in descending order > if (($column =3D=3D 1) or ($column =3D=3D 4)) > { > print "sorting numerically\n"; > foreach (sort { > (substr($sortcol{$b},0,index($sortcol{$b}," "))) <=3D> > (substr($sortcol{$a},0,index($sortcol{$a}," "))) } keys > %sortcol) > { > my @newdata =3D split/,/,$data{$_}; > print $data{$_}; > InsertListItem(@newdata); > } > } > else { > foreach (sort { uc($sortcol{$b}) cmp uc($sortcol{$a}) > } keys %sortcol) > { > my @newdata =3D split/,/,$data{$_}; > print $data{$_}; > InsertListItem(@newdata); > } > $ListView->Update(); > } > } > my $lpPoint =3D pack("LLLLLALLLL", LVIF_STATE, 0, 0, > 0x2000,LVIS_STATEIMAGEMASK, " ", 127, 0, 0, 0); > my $rtn =3D $SendMsg->Call($ListView->{'-handle'},=20 > LVM_SETITEMSTATE, -1, > $lpPoint); >=20 > return; > } >=20 > sub NewList { > ## This creates another hash to use only for sorting purposes. > my ($column,%sortcol) =3D @_; > my $sortthis; >=20 > foreach (keys %sortcol) { > my @info =3D split /,/, $sortcol{$_}; > $sortthis =3D $info[$column]; > $sortcol{$_} =3D "$sortthis"; > } > return(%sortcol); > } >=20 > sub InsertListItem { > my(@info) =3D @_; > $Window->ListView->InsertItem( > #-item =3D> $Window->ListView->Count(), > -text =3D> = [@info[1],@info[2],@info[3],@info[4], > @info[5],@info[6]], > ); > #$Window->ListView->SetItem( > # -item =3D> $item, > # -subitem =3D> 1, > # -text =3D> $description, > # ); > print "@info[1] @info[2] @info[3] @info[4] @info[5] @info[6]\n"; > } >=20 >=20 >=20 > ------------------------------------------------------- > Sponsored by: > ThinkGeek at http://www.ThinkGeek.com/ > _______________________________________________ > Perl-Win32-GUI-Users mailing list > Per...@li... > https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users >=20 |
From: Mark Di N. <amo...@ih...> - 2002-06-27 10:27:37
|
Kev...@al... wrote: > Mark, > > Haven't had time to examine your code to closely but it looks as though > you're sorting everything as strings. I assume the quantity should be a > number? > > I've used something like the code below to try to deal with this. I can > send you a working example if you need it and this is your problem. > > Cheers, > > Kev. > > sub alpascend { > uc($details{$a}[$col]) cmp uc ($details{$b}[$col]); > } > > sub numdescend { > $details{$b}[$col] <=> $details{$a}[$col]; > } > > sub alpdescend { > uc($details{$b}[$col]) cmp ($details{$a}[$col]); > } > > sub initlv { > $Window->ListView->Clear(); > my $rout; > > @index=keys %details; > $rout= $details{1}[$col]=~ /^\d/ ? "num" : "alp"; > > if ($dir==1) { > $rout.="ascend"; > } else { > $rout.="descend"; > } > > @index= sort $rout @index; > > foreach $i (@index) { > if ($details{$i}[0] ne '..') { > InsertListItem(0, $details{$i}[0], $details{$i}[1]); > } else { > InsertListItem(1, $details{$i}[0], $details{$i}[1]); > } > } > $Window->ListView->SetFocus(); > } > > sub ListView_ColumnClick { > $col=shift; > if ($col==$lastcol) { > $dir= $dir * -1; > } else { > $dir= -1; > } > initlv($dir); > $lastcol=$col; > } > > > > |---------+------------------------------------------------> > | | ma...@mm... | > | | Sent by: | > | | per...@li...ur| > | | ceforge.net | > | | | > | | | > | | 27/06/2002 07:32 | > | | | > |---------+------------------------------------------------> > >----------------------------------------------------------------------------------------------| > | | > | To: per...@li... | > | cc: | > | Subject: [perl-win32-gui-users] sorting a listview | > >----------------------------------------------------------------------------------------------| > > > > > hi. i've got alist view with 4 columns, being catalogue number, artist, > title and qty (there's 2 other columns but they don't matter) and i've been > trying to figure out how to sort the whole listview on a column click. i > found a message sometime last year where someone posted something that i > kind of got working, after a bit of tweaking. the problem is that the qty > column doesn't sort properly and i just can't seem to figure out why. all > the other columns sort fine when i click on them. any ideas? code below > > thanx in advance > > > sub ListView_ColumnClick { > $totalcols = 6; > my $column = shift; > print "column:$column\n"; > $column=$column+1; > > ## i do this so that I can toggle between ascending and descending > sorts > ## 0 = ascending (A-Z), 1 = decending (Z - A) > if ($lastcolumn == $column) # if you clicked the same column twice in > a row > {$sortorder = 1 - $sortorder;} # toggle between 1 and 0 values > else > {$sortorder = 0;} > print "You Clicked $column, last time it was $lastcolumn,sortorder > =$sortorder\n"; > $lastcolumn = $column; > > %data=(); > $rows=$ListView->Count(); > print "rows:$rows\n"; > for $i(0..$rows-1) > { > $row=""; > my %result=$ListView->GetItem($i,0); > $image=$result{-image}; > for $j(0..$totalcols-1) > { > my %result=$ListView->GetItem($i,$j); > $text=$result{-text}; > $row.=",$text"; > } > $data{$i}="$image$row"; > } > > my %sortcol = NewList($column, %data); > SortListItem(\%data,\%sortcol,$column); > if ($sortorder) { > print "Sorted descending by Column $column\n"; > } else { > print "Sorted ascending by Column $column\n"; > } > return; > } > > sub SortListItem { > my ($data,$sortcol,$column) = @_; > my $check; > my %data = %$data; > my %sortcol = %$sortcol; > > $check = "$_" foreach (values %sortcol); > > $ListView->Clear(); ## clear the ListView window > $index = 0; > if ($sortorder == 0) > { ## this is sorting in ascending order > if (($column == 1) or ($column == 4)) > { > print "sorting numerically\n"; > foreach (sort { > (substr($sortcol{$a},0,index($sortcol{$a}," "))) <=> > (substr($sortcol{$b},0,index($sortcol{$b}," "))) } > keys %sortcol) > { > my @newdata = split/,/,$data{$_}; > print $data{$_}; > InsertListItem(@newdata); > } > } > else { > foreach (sort { uc($sortcol{$a}) cmp uc($sortcol{$b}) > } keys %sortcol) > { > my @newdata = split/,/,$data{$_}; > print $data{$_}; > InsertListItem(@newdata); > } > } > $ListView->Update(); > } > else > { ## this is sorting in descending order > if (($column == 1) or ($column == 4)) > { > print "sorting numerically\n"; > foreach (sort { > (substr($sortcol{$b},0,index($sortcol{$b}," "))) <=> > (substr($sortcol{$a},0,index($sortcol{$a}," "))) } keys > %sortcol) > { > my @newdata = split/,/,$data{$_}; > print $data{$_}; > InsertListItem(@newdata); > } > } > else { > foreach (sort { uc($sortcol{$b}) cmp uc($sortcol{$a}) > } keys %sortcol) > { > my @newdata = split/,/,$data{$_}; > print $data{$_}; > InsertListItem(@newdata); > } > $ListView->Update(); > } > } > my $lpPoint = pack("LLLLLALLLL", LVIF_STATE, 0, 0, > 0x2000,LVIS_STATEIMAGEMASK, " ", 127, 0, 0, 0); > my $rtn = $SendMsg->Call($ListView->{'-handle'}, LVM_SETITEMSTATE, -1, > $lpPoint); > > return; > } > > sub NewList { > ## This creates another hash to use only for sorting purposes. > my ($column,%sortcol) = @_; > my $sortthis; > > foreach (keys %sortcol) { > my @info = split /,/, $sortcol{$_}; > $sortthis = $info[$column]; > $sortcol{$_} = "$sortthis"; > } > return(%sortcol); > } > > sub InsertListItem { > my(@info) = @_; > $Window->ListView->InsertItem( > #-item => $Window->ListView->Count(), > -text => [@info[1],@info[2],@info[3],@info[4], > @info[5],@info[6]], > ); > #$Window->ListView->SetItem( > # -item => $item, > # -subitem => 1, > # -text => $description, > # ); > print "@info[1] @info[2] @info[3] @info[4] @info[5] @info[6]\n"; > } > > > > ------------------------------------------------------- > Sponsored by: > ThinkGeek at http://www.ThinkGeek.com/ > _______________________________________________ > Perl-Win32-GUI-Users mailing list > Per...@li... > https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users > > > > > > ------------------------------------------------------- > Sponsored by: > ThinkGeek at http://www.ThinkGeek.com/ > _______________________________________________ > Perl-Win32-GUI-Users mailing list > Per...@li... > https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users > > kevin if you're talking about using cmp instead of <=> then thats not it. depending on which column it is, it will use either of those 2. so for 1 and 4 (cat number and qty) it uses <=> and for anything else it uses cmp. sorting the cat number works perfectly but for qty it doesn't for some reason. mark |
From: <Kev...@al...> - 2002-06-27 09:17:35
|
Mark, Haven't had time to examine your code to closely but it looks as though you're sorting everything as strings. I assume the quantity should be a number? I've used something like the code below to try to deal with this. I can send you a working example if you need it and this is your problem. Cheers, Kev. sub alpascend { uc($details{$a}[$col]) cmp uc ($details{$b}[$col]); } sub numdescend { $details{$b}[$col] <=> $details{$a}[$col]; } sub alpdescend { uc($details{$b}[$col]) cmp ($details{$a}[$col]); } sub initlv { $Window->ListView->Clear(); my $rout; @index=keys %details; $rout= $details{1}[$col]=~ /^\d/ ? "num" : "alp"; if ($dir==1) { $rout.="ascend"; } else { $rout.="descend"; } @index= sort $rout @index; foreach $i (@index) { if ($details{$i}[0] ne '..') { InsertListItem(0, $details{$i}[0], $details{$i}[1]); } else { InsertListItem(1, $details{$i}[0], $details{$i}[1]); } } $Window->ListView->SetFocus(); } sub ListView_ColumnClick { $col=shift; if ($col==$lastcol) { $dir= $dir * -1; } else { $dir= -1; } initlv($dir); $lastcol=$col; } |---------+------------------------------------------------> | | ma...@mm... | | | Sent by: | | | per...@li...ur| | | ceforge.net | | | | | | | | | 27/06/2002 07:32 | | | | |---------+------------------------------------------------> >----------------------------------------------------------------------------------------------| | | | To: per...@li... | | cc: | | Subject: [perl-win32-gui-users] sorting a listview | >----------------------------------------------------------------------------------------------| hi. i've got alist view with 4 columns, being catalogue number, artist, title and qty (there's 2 other columns but they don't matter) and i've been trying to figure out how to sort the whole listview on a column click. i found a message sometime last year where someone posted something that i kind of got working, after a bit of tweaking. the problem is that the qty column doesn't sort properly and i just can't seem to figure out why. all the other columns sort fine when i click on them. any ideas? code below thanx in advance sub ListView_ColumnClick { $totalcols = 6; my $column = shift; print "column:$column\n"; $column=$column+1; ## i do this so that I can toggle between ascending and descending sorts ## 0 = ascending (A-Z), 1 = decending (Z - A) if ($lastcolumn == $column) # if you clicked the same column twice in a row {$sortorder = 1 - $sortorder;} # toggle between 1 and 0 values else {$sortorder = 0;} print "You Clicked $column, last time it was $lastcolumn,sortorder =$sortorder\n"; $lastcolumn = $column; %data=(); $rows=$ListView->Count(); print "rows:$rows\n"; for $i(0..$rows-1) { $row=""; my %result=$ListView->GetItem($i,0); $image=$result{-image}; for $j(0..$totalcols-1) { my %result=$ListView->GetItem($i,$j); $text=$result{-text}; $row.=",$text"; } $data{$i}="$image$row"; } my %sortcol = NewList($column, %data); SortListItem(\%data,\%sortcol,$column); if ($sortorder) { print "Sorted descending by Column $column\n"; } else { print "Sorted ascending by Column $column\n"; } return; } sub SortListItem { my ($data,$sortcol,$column) = @_; my $check; my %data = %$data; my %sortcol = %$sortcol; $check = "$_" foreach (values %sortcol); $ListView->Clear(); ## clear the ListView window $index = 0; if ($sortorder == 0) { ## this is sorting in ascending order if (($column == 1) or ($column == 4)) { print "sorting numerically\n"; foreach (sort { (substr($sortcol{$a},0,index($sortcol{$a}," "))) <=> (substr($sortcol{$b},0,index($sortcol{$b}," "))) } keys %sortcol) { my @newdata = split/,/,$data{$_}; print $data{$_}; InsertListItem(@newdata); } } else { foreach (sort { uc($sortcol{$a}) cmp uc($sortcol{$b}) } keys %sortcol) { my @newdata = split/,/,$data{$_}; print $data{$_}; InsertListItem(@newdata); } } $ListView->Update(); } else { ## this is sorting in descending order if (($column == 1) or ($column == 4)) { print "sorting numerically\n"; foreach (sort { (substr($sortcol{$b},0,index($sortcol{$b}," "))) <=> (substr($sortcol{$a},0,index($sortcol{$a}," "))) } keys %sortcol) { my @newdata = split/,/,$data{$_}; print $data{$_}; InsertListItem(@newdata); } } else { foreach (sort { uc($sortcol{$b}) cmp uc($sortcol{$a}) } keys %sortcol) { my @newdata = split/,/,$data{$_}; print $data{$_}; InsertListItem(@newdata); } $ListView->Update(); } } my $lpPoint = pack("LLLLLALLLL", LVIF_STATE, 0, 0, 0x2000,LVIS_STATEIMAGEMASK, " ", 127, 0, 0, 0); my $rtn = $SendMsg->Call($ListView->{'-handle'}, LVM_SETITEMSTATE, -1, $lpPoint); return; } sub NewList { ## This creates another hash to use only for sorting purposes. my ($column,%sortcol) = @_; my $sortthis; foreach (keys %sortcol) { my @info = split /,/, $sortcol{$_}; $sortthis = $info[$column]; $sortcol{$_} = "$sortthis"; } return(%sortcol); } sub InsertListItem { my(@info) = @_; $Window->ListView->InsertItem( #-item => $Window->ListView->Count(), -text => [@info[1],@info[2],@info[3],@info[4], @info[5],@info[6]], ); #$Window->ListView->SetItem( # -item => $item, # -subitem => 1, # -text => $description, # ); print "@info[1] @info[2] @info[3] @info[4] @info[5] @info[6]\n"; } ------------------------------------------------------- Sponsored by: ThinkGeek at http://www.ThinkGeek.com/ _______________________________________________ Perl-Win32-GUI-Users mailing list Per...@li... https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users |
From: <ma...@mm...> - 2002-06-27 06:39:47
|
hi. i've got alist view with 4 columns, being catalogue number, artist, title and qty (there's 2 other columns but they don't matter) and i've been trying to figure out how to sort the whole listview on a column click. i found a message sometime last year where someone posted something that i kind of got working, after a bit of tweaking. the problem is that the qty column doesn't sort properly and i just can't seem to figure out why. all the other columns sort fine when i click on them. any ideas? code below thanx in advance sub ListView_ColumnClick { $totalcols = 6; my $column = shift; print "column:$column\n"; $column=$column+1; ## i do this so that I can toggle between ascending and descending sorts ## 0 = ascending (A-Z), 1 = decending (Z - A) if ($lastcolumn == $column) # if you clicked the same column twice in a row {$sortorder = 1 - $sortorder;} # toggle between 1 and 0 values else {$sortorder = 0;} print "You Clicked $column, last time it was $lastcolumn,sortorder =$sortorder\n"; $lastcolumn = $column; %data=(); $rows=$ListView->Count(); print "rows:$rows\n"; for $i(0..$rows-1) { $row=""; my %result=$ListView->GetItem($i,0); $image=$result{-image}; for $j(0..$totalcols-1) { my %result=$ListView->GetItem($i,$j); $text=$result{-text}; $row.=",$text"; } $data{$i}="$image$row"; } my %sortcol = NewList($column, %data); SortListItem(\%data,\%sortcol,$column); if ($sortorder) { print "Sorted descending by Column $column\n"; } else { print "Sorted ascending by Column $column\n"; } return; } sub SortListItem { my ($data,$sortcol,$column) = @_; my $check; my %data = %$data; my %sortcol = %$sortcol; $check = "$_" foreach (values %sortcol); $ListView->Clear(); ## clear the ListView window $index = 0; if ($sortorder == 0) { ## this is sorting in ascending order if (($column == 1) or ($column == 4)) { print "sorting numerically\n"; foreach (sort { (substr($sortcol{$a},0,index($sortcol{$a}," "))) <=> (substr($sortcol{$b},0,index($sortcol{$b}," "))) } keys %sortcol) { my @newdata = split/,/,$data{$_}; print $data{$_}; InsertListItem(@newdata); } } else { foreach (sort { uc($sortcol{$a}) cmp uc($sortcol{$b}) } keys %sortcol) { my @newdata = split/,/,$data{$_}; print $data{$_}; InsertListItem(@newdata); } } $ListView->Update(); } else { ## this is sorting in descending order if (($column == 1) or ($column == 4)) { print "sorting numerically\n"; foreach (sort { (substr($sortcol{$b},0,index($sortcol{$b}," "))) <=> (substr($sortcol{$a},0,index($sortcol{$a}," "))) } keys %sortcol) { my @newdata = split/,/,$data{$_}; print $data{$_}; InsertListItem(@newdata); } } else { foreach (sort { uc($sortcol{$b}) cmp uc($sortcol{$a}) } keys %sortcol) { my @newdata = split/,/,$data{$_}; print $data{$_}; InsertListItem(@newdata); } $ListView->Update(); } } my $lpPoint = pack("LLLLLALLLL", LVIF_STATE, 0, 0, 0x2000,LVIS_STATEIMAGEMASK, " ", 127, 0, 0, 0); my $rtn = $SendMsg->Call($ListView->{'-handle'}, LVM_SETITEMSTATE, -1, $lpPoint); return; } sub NewList { ## This creates another hash to use only for sorting purposes. my ($column,%sortcol) = @_; my $sortthis; foreach (keys %sortcol) { my @info = split /,/, $sortcol{$_}; $sortthis = $info[$column]; $sortcol{$_} = "$sortthis"; } return(%sortcol); } sub InsertListItem { my(@info) = @_; $Window->ListView->InsertItem( #-item => $Window->ListView->Count(), -text => [@info[1],@info[2],@info[3],@info[4], @info[5],@info[6]], ); #$Window->ListView->SetItem( # -item => $item, # -subitem => 1, # -text => $description, # ); print "@info[1] @info[2] @info[3] @info[4] @info[5] @info[6]\n"; } |