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

2000-04-25 Thread Jonathan Southwick

I sure can.  It will be here either later today or tomorrow.  I am still tweaking my 
program for use here but at least
its working.

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: Tuesday, April 25, 2000 1:21 PM
Subject: RE: Re[4]: [perl-win32-gui] Capturing ListView Clicks


> Can you send us your final code, so we can see how you got it working.
> Thanks,
> Tim
>
> 
> -
> 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: Tuesday, April 25, 2000 11:20 AM
> > To: [EMAIL PROTECTED]
> > Subject: Re: Re[4]: [perl-win32-gui] Capturing ListView Clicks
> >
> > A million thanks ... no make it one zillion thanks to everyone who helped
> > out.  The sort works great!
> >
> > Jonathan
> > --
> > Jonathan Southwick  [EMAIL PROTECTED]
> > Technical and Network Services
> > Allegheny College
> > Meadville, PA  16335 814-332-2755
> >
>





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

2000-04-25 Thread timothy . b . thomas

Can you send us your final code, so we can see how you got it working.
Thanks,
Tim


-
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: Tuesday, April 25, 2000 11:20 AM
> To:   [EMAIL PROTECTED]
> Subject:      Re: Re[4]: [perl-win32-gui] Capturing ListView Clicks
> 
> A million thanks ... no make it one zillion thanks to everyone who helped
> out.  The sort works great!
> 
> Jonathan
> --
> Jonathan Southwick  [EMAIL PROTECTED]
> Technical and Network Services
> Allegheny College
> Meadville, PA  16335 814-332-2755
> 




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

2000-04-25 Thread Jonathan Southwick

A million thanks ... no make it one zillion thanks to everyone who helped out.  The 
sort works great!

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-25 Thread Cam

Hello Jonathan,

JS> Okay I am getting this to almost work.  However I get an error on this line in the 
code you gave:

JS> &SortListItem(/%data,/%sortonly);

Sorry about this, but that is typo on my part.  The line of
code you are getting an error on should actually look like this:

&SortListItem(\%data,\%sortonly);

To make a long story short you are passing references to the
variables, not the actually data.  This is because when you pass data
to a sub-routine it becomes one big long list.  When you pass 2 or
most lists (arrays or hashes) Perl won't assign the data correctly to
your new local varaibles within the sub-routine.  That is why you have
the following lines of code inside the subroutine:

## Perl Code Segment Begins

sub SortListItem {
   ## I found another error, you don't need to include the
   ## $section in the first line of code for SortListItem
   ## It should look like this

   my ($data,$sortonly) = @_; ## Assign references to strings
   my $check;
   my %data = %$data; ## A new hash from the reference
   my %sortonly = %$sortonly; ## Same as above

## Perl Code Segment Ends

   You pass references to string variables, and then create new
local hashes (in this case %data, %sortonly) from those references.
Sorry about the typo.  Cheers.

-- 
Best regards,
 Cammailto:[EMAIL PROTECTED]



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





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 () { ## 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