[perl-win32-gui] Capturing ListView Clicks

2000-04-24 Thread Jonathan Southwick

Never mind ... I think figured it out ...

hehe ... I am gonna go try it now!

Jonathan
--
Jonathan Southwick  [EMAIL PROTECTED]
Technical and Network Services
Allegheny College
Meadville, PA  16335 814-332-2755







RE: [perl-win32-gui] Capturing ListView Clicks

2000-04-24 Thread timothy . b . thomas

Hey, if you figure it out, let me know how you get it. I knew at one point
how to capture the column clicks, there is a function there somewhere for
it, I just have to dig it out, I just couldn't figure out how to sort the
items in the list.
Tim Thomas


-
Tim Thomas
Unix Systems Administrator
Lockheed Martin EIS · Denver Data Center
303-430-2281
mailto:[EMAIL PROTECTED]

-

 -Original Message-
 From: Jonathan Southwick [SMTP:[EMAIL PROTECTED]]
 Sent: Monday, April 24, 2000 9:55 AM
 To:   Perl-Win32-GUI Help
 Subject:  [perl-win32-gui] Capturing ListView Clicks
 
 Never mind ... I think figured it out ...
 
 hehe ... I am gonna go try it now!
 
 Jonathan
 --
 Jonathan Southwick  [EMAIL PROTECTED]
 Technical and Network Services
 Allegheny College
 Meadville, PA  16335 814-332-2755
 
 




Re[4]: [perl-win32-gui] Capturing ListView Clicks

2000-04-24 Thread Cam

Hello Jonathan,

Well to start I would suggest you should use a hash if your
$id's are unique.  If they aren't then you will have to live with
arrays.  To create a hash this is what I would do

## --- Perl Code Below --- UNTESTED code
my %data;  ## A Global declaration

open FILE, "your-file.txt"; ## Insert your comma delimited file here

foreach (FILE) { ## Fill read file up til a 'newline'
 my @temp = split/,/, $_;  ## Split the string
 s/^\d{3},//;  ## This removes the first 3 digits and
   ## a comma from $_
 $data{$temp[0]} =  $_;## Assign a key  a value to your hash
}

## This loop simply prints each key and its value to confirm that
## everything has worked.
foreach (keys %data) {
 print "Key:$_  Value: $data{$_}\n";
}

## --- END OF PERL CODE

After the above code is finished you will have a Hash called %data
that contains all data with keys that are created with your ID's.  The
next part... actually sorting you can use the code I sent you before.
 I am a little confused about one thing though.  My code simply sorts
alphabetically or from highest to lowest.  From your email I don't
think that's what you are trying to do.  However all you ahve to do is
create another hash from %data and then edit the values until they
suit your sorting requirments.  For example to sort for only names
that start with 'M' you could do the following:

## --- Perl Code Below --- UNTESTED code
my %sorthash = SortSub('M',%data);

##---
sub SortSub {
 my $letter,%sorthash = @_;
 foreach (keys %sorhash)  {
my @data = split/,/, $_;
## If it doesn't start with a 'M' then put whatever is needed
## to put it at the end of your sort routine.
$sorthash{$_} = "zzz" if ($data[0] !~ /^$letter/);
 }
}
## END OF PERL CODE

Now you can use the 2 hashes (%data,%sorthash) and use the code I sent
you that sorts alphabetically.  Everything that doesn't start with 'M'
with be sent to the end.  Let me know if this helps.  I don't have a
lot of time these days, but if you are still stuck send me the code
and we'll see if can hack something togther.  Cheers


Monday, April 24, 2000, 11:24:58, you wrote:

JS Cam,

JS Thanks for the help.  I am trying to get the sort part to work.  Seems pretty 
simple as you stated  ... I just need to
JS figure out HOW to apply it to my program.

JS My data is stored in a comma delimited file.  Here is the format: (with sample 
data)

JS 857,Gabe,Skrinjar,Ravine,109-1,00:60:67:25:91:92,141.195.134.100
JS 858,Kelly,Murphy,Schultz,313-2,00:60:67:25:91:9b,141.195.134.101
JS 860,Tara,Dodge,Walker,260-1,00:50:da:c8:ff:7b,141.195.134.102
JS 861,Fabrizio,Polo,Baldwin,A312-1,00:01:02:28:9f:e6,141.195.134.103

JS I read in the data:

JS ($id,$fname,$lname,$build,$room,$adap,$ip) = split(/,/)

JS and ignore the $id.

JS A specifc search is done on all the data based on the "subject" of a tab-click on 
a TabView object. I have three tabs:
JS Name, Building, and Adapter Address.  For instance: someone wants to get a list of 
all the people whose First and last
JS names begin with 'M'.  These are displayed in the ListView window.

JS The data that is displayed needs to be sorted if the user clicks on a tab.

JS I guerss I don't know how to store the data in a hash to be used with your code.  
Any ideas?  I can supply the code if
JS you want.

JS Jonathan
JS --
JS Jonathan Southwick  [EMAIL PROTECTED]
JS Technical and Network Services
JS Allegheny College
JS Meadville, PA  16335 814-332-2755






-- 
Best regards,
 Cammailto:[EMAIL PROTECTED]



__
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com





Re: [perl-win32-gui] Capturing ListView Clicks

2000-04-24 Thread Jonathan Southwick

Well I figured out how to capture the column click but I don't know how to
tell which one was clicked. As far as the sorting goes I think you have to
write your own routine to sort the items and write them back to the listview
but I could be wrong.

To capture the event:

sub ListView_ColumnClick {

[code in here]

}

So how do I determine exactly what column was clicked?

Jonathan
--
Jonathan Southwick  [EMAIL PROTECTED]
Technical and Network Services
Allegheny College
Meadville, PA  16335 814-332-2755


- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, April 24, 2000 11:55 AM
Subject: RE: [perl-win32-gui] Capturing ListView Clicks


 Hey, if you figure it out, let me know how you get it. I knew at one point
 how to capture the column clicks, there is a function there somewhere for
 it, I just have to dig it out, I just couldn't figure out how to sort the
 items in the list.
 Tim Thomas

 --
--
 -
 Tim Thomas
 Unix Systems Administrator
 Lockheed Martin EIS · Denver Data Center
 303-430-2281
 mailto:[EMAIL PROTECTED]
 --
--
 -

  -Original Message-
  From: Jonathan Southwick [SMTP:[EMAIL PROTECTED]]
  Sent: Monday, April 24, 2000 9:55 AM
  To: Perl-Win32-GUI Help
  Subject: [perl-win32-gui] Capturing ListView Clicks
 
  Never mind ... I think figured it out ...
 
  hehe ... I am gonna go try it now!
 
  Jonathan
  --
  Jonathan Southwick  [EMAIL PROTECTED]
  Technical and Network Services
  Allegheny College
  Meadville, PA  16335 814-332-2755