Hello Alex,

I have some answers to your unknown lines in your code.

The line below assigns the Window ID and Instance numbers to the
variables $DOShwnd and $DOShinstance.  You really don't need this
unless you are going to hide the DOS window like you do a couple lines
further down.  There are better ways to do this.  Check out the
Win32-GUI docs and a section on 'guiperl'.
AC> ($DOShwnd, $DOShinstance) = GUI::GetPerlWindow();

AC> # these lines close the dos window that pops up after executing the 
AC> # program from windows ... for testing, i'd leave them commented out
AC> # click on the "headcount" button to see why
AC> #
AC> #GUI::CloseWindow($DOShwnd);
AC> #GUI::Hide($DOShwnd);


The lines below return the users screen height and width aka. their
current screen resolution (640 x 480 or 1024 x 768 etc. etc.)
AC> my $screen_width = Win32::GUI::GetSystemMetrics(0);
AC> my $screen_height = Win32::GUI::GetSystemMetrics(1);


You know I thought I new how to make this work for you, but when I
test it nothing happens.  I'm a little stumpped.  Maybe you can make it
work from what I've done.

## Code Fragment Below ##

sub TheListBox_Click {
         ## this line returns a pointer to the item that was
         ## selected.  If nothing is selected it returns '-1'
         ## if the first item was selected it returns '0',
         ## second item returns '1' etc. etc.
         my $ListSelection = $theListBox->SelectedItem();
         
         ## This line gets the string that is assigned to the pointer
         ## obtained by the previous line.
         my $item = $theListBox->GetString($ListSelection);
         
         ## Don't proceed if somehow nothing was selected
         return() if $ListSelection == -1;

         print "You clicked on $item\n";
}

## Code Fragment ENDS ##

Like I said though the code above did NOT work properly for me and I
don't have enough time right now to figure it out.  I'm sure someone
else on the list will point out my error soon.

One last thing.  In the 2 sub-routines below you exit the program with
the exit(0) command.  I was under the impression that the best way to
terminate a program was to use the following line:    return(-1);
AC> # someone clicks File->exit
AC> sub FileExit_Click {
AC>    exit(0);
AC> }

AC> # someone clicks the 'X' window (haha ... not the X-window but the x on the
AC> window)
AC> sub DataWindow_Terminate {
AC>    exit(0);
AC> }
AC> </code>

I hope this helps.  Let me know if you get the TheListBox_Click
routine working, or if you are still stuck let me know as well and I
will take a better stab at it later.  Cheers.

-- 
Best regards,
 Cam                            mailto:[EMAIL PROTECTED]



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


Reply via email to