Re: [perl-win32-gui] BrowseForFolder?

2001-01-04 Thread Robert Sherman

included in the docs of the newest version of win32::gui (0.0.502)

-rob



Re: [perl-win32-gui] Perl list for beginners

2001-01-03 Thread Robert Sherman

check out

http://lists.perl.org/


especially:

perl-beginner
perl-faq-daily
perl-ntadmin (good list for win32 perl)

and be sure your library includes the 3rd edition of Programming Perl...


-rob



"Naika M." wrote:
> 
> Does anyone know of a Perl list out there for beginners? I've got over 10
> books but I think I need tutoring to explain some of oddities of Perl.
> 
> Naika
> 
> Realm Gothica - http://www.triocollective.com/gothica.htm
> Join the Darklings of the Realm mailing list -
> http://RealmGothica.listbot.com
> Tune into my Radio Broadcast at
> http://www.live365.com/cgi-bin/directory.cgi?autostart=whisperwish
> 
> _
> Get your FREE download of MSN Explorer at http://explorer.msn.com



Re: [perl-win32-gui] Event processing

2001-01-03 Thread Robert Sherman

okay, i think i see what you mean...you want a GUI that starts a loop
which can conditionally spawn a second window, and when that second
windows is closed, it returns to the loop and continues processing...

i can't figure it out either...my current theory is that since the
Loop_Click event has not exited, another click event (OK_Click) cannot
be registered...

you can do something like this to exit the loop (thereby exiting the
click event) prior to displaying the window, but then you have to pull
some shysty manoeuvres to maintain state and get the loop going again:
=== 

sub Loop_Click {

while ($i<20) {
sleep 1;


last if ($i==10);

$i++;
}

&Show_Win2($i);

$i++;
}
===

if anyone knows of a better way to handle this, please contribute...





for reference, here is the full script that i am playing with:



use Win32::GUI;

$i=0;

$Win = new Win32::GUI::Window(
  -left   => 341,
  -top=> 218,
  -width  => 300,
  -height => 213,
  -name   => "Win",
  -text   => "Window Title"
  );



$Win->AddButton(
   -text=> "Loop",
   -name=> "Loop",
   -left=> 104.5,
   -top => 102,
   -width   => 95,
   -height  => 28,
  );

$Win2 = new Win32::GUI::Window(
  -left   => 391,
  -top=> 238,
  -width  => 200,
  -height => 183,
  -name   => "Win2",
  -title   => "New Window",
  );

$Win2->AddLabel(
   -text=> "",
   -name=> "Label",
   -left=> 60,
   -top => 30,
   -width   => 20,
   -height  => 20,
  );

$Win2->AddButton(
   -text=> "OK",
   -name=> "OK",
   -left=> 50,
   -top => 102,
   -width   => 95,
   -height  => 28,
  );

$Win->Show();

Win32::GUI::Dialog();

sub Win_Terminate {
   return -1;
}

sub OK_Click {
   

   $Win2->Hide();
}

sub Loop_Click {

while ($i<20) {
sleep 1;


if ($i==10){
&Show_Win2($i);
}

$i++;
}

}

sub Show_Win2 {
   my $num = shift;

   $Win2->Label->Text($num);
   $Win2->Show();
   $Win2->Update();
   
   
  
}



Re: [perl-win32-gui] $Window->TextField->Text()

2000-12-18 Thread Robert Sherman

works like a charm...thanks all...

-rob



Re: [perl-win32-gui] Event processing

2000-12-15 Thread Robert Sherman

oops...that's odd, because i was sure i had gotten it to work...oh,
well...how about this:



use Win32::GUI;

$i=0;

$Win = new Win32::GUI::Window(
  -left   => 341,
  -top=> 218,
  -width  => 300,
  -height => 213,
  -name   => "Win",
  -text   => "Window Title"
  );



$Win->AddButton(
   -text=> "Loop",
   -name=> "Loop",
   -left=> 104.5,
   -top => 102,
   -width   => 95,
   -height  => 28,
  );

$Win2 = new Win32::GUI::Window(
  -left   => 391,
  -top=> 238,
  -width  => 200,
  -height => 183,
  -name   => "Win2",
  -title   => "New Window",
  );

$Win2->AddLabel(
   -text=> "",
   -name=> "Label",
   -left=> 60,
   -top => 30,
   -width   => 20,
   -height  => 20,
  );

$Win2->AddButton(
   -text=> "OK",
   -name=> "OK",
   -left=> 50,
   -top => 102,
   -width   => 95,
   -height  => 28,
  );

$Win->Show();

Win32::GUI::Dialog();

sub Win_Terminate {
   return -1;
}

sub OK_Click {
   $Win2->Hide();
   $i++;
}

sub Loop_Click {
   &Show_Win2($i);
   
}

sub Show_Win2 {
   my $num = shift;

   $Win2->Label->Text($num);
   $Win2->Show();
   $Win2->Update();
   
}



[perl-win32-gui] $Window->TextField->Text()

2000-12-15 Thread Robert Sherman

any idea as to why in the script below, in sub Button2_Click, TextField1
does not change to "Processing..." prior to running the process_file
sub? A similar call in the process_file sub changes the field to "Done!"
when it finishes, and that call works fine...

TIA

-rob


=

use Win32::GUI;



$Window = new Win32::GUI::Window(
-name   => "Window",
-title  => "EXCISE",
-left   => 100,  
-top=> 100,
-width  => 430, 
-height => 200, 
-menu   => $Menu,
);

$Window->AddTextfield(
-name   => "TextField1",
-left   => 30,
-top=> 10,
-width  => 300,
-height => 20,
-prompt => "  Input file:",

); 

$Window->AddTextfield(
-name   => "TextField2",
-left   => 30,
-top=> 40,
-width  => 300,
-height => 20,
-prompt => "  Output file name:",

); 


$Window->AddTextfield(
-name   => "TextField3",
-left   => 30,
-top=> 70,
-width  => 50,
-height => 20,
-prompt => "  Keep this many fields from the beginning of each
record:",

); 

$Window->AddTextfield(
-name   => "TextField4",
-left   => 30,
-top=> 100,
-width  => 50,
-height => 20,
-prompt => "  Keep this many fields from the end of each record:",

); 

$Window->AddButton( 
-name   => "Button1",   
-left   => 150,  
-top=> 135,
-width  => 90, 
-height => 30,
-text   => "Browse for file",
);

$Window->AddButton( 
-name   => "Button2",   
-left   => 245,  
-top=> 135,
-width  => 90, 
-height => 30,
-text   => "Process file",
);

$Window->Show();



sub Button1_Click {  
$file = &get_file_name;
$path = $file;
$path =~ s/(^.*\\)(.*$)/$1/;
$Window->TextField1->Text("$file");
}


sub Button2_Click {  

if ($file) {
$front = $Window->TextField3->Text; 
$end = $Window->TextField4->Text;
$outfile = $Window->TextField2->Text;
$Window->TextField1->Text("Processing...");
&process_file($file, $front, $end); 
}
else {  $file = $Window->TextField1->Text;
$path = $file;
$path =~ s/(^.*\\)(.*$)/$1/;
$front = $Window->TextField3->Text; 
$end = $Window->TextField4->Text;
$outfile = $Window->TextField2->Text;
$Window->TextField1->Text("Processing...");
&process_file($file, $front, $end); 
}   

}


sub Window_Terminate { return -1; }




sub get_file_name {

$ret = GUI::GetOpenFileName(
   -title  => "File Browser",
   -file   => "\0" . " " x 256,
   -filter => [
"Text documents (*.txt)" => "*.txt",  
"All files", "*.*",
 ],
);

   return $ret;

}

sub process_file {
my $file = shift;
my $front = shift;
my $end = shift;
##
##begin excise code
##

open (INFILE, "$file");

open (OUTFILE, ">>$outfile");

foreach $line () {

@output_front = ();

@output_end = ();

$output_string = 0;

$count_shift = 0;

$count_pop = 0;

@array = split (/,/,$line);

while ($count_shift < $front){

@shifted = shift @array;

push (@output_front, @shifted);

$count_shift++;

}

while ($count_pop < $end){

@popped = pop @array;

push (@output_end, @popped);

$count_pop++;

}

@rev_output_end = reverse @output_end;

push (@output_front, @rev_output_end);

$output_string = join (",", @output_front);

print OUTFILE ("$output_string");

}

##
## end excise code
##

$Window->TextField1->Text("Done!");
}


Win32::GUI::Dialog();



Re: [perl-win32-gui] Event processing

2000-12-15 Thread Robert Sherman

you did not call dialog() for the second window:

sub Loop_Click {

   foreach $i (0 ... 3) {
 &Show_Win2($i);
 sleep 1;
   }
Win32::GUI::Dialog();  ##add this and it works
}


-rob



David Hiltz wrote:
> 
>Below you will a small Win32::GUI program that displays a window with a
>button labeled "Loop".  When you click on the button it calls a
>subroutine which should display another window with a number and an OK
>button.  I want the program to wait between each display of the second
>window (waiting for the user to click "OK"), but instead you see the
>number changing and it comes to rest on the last number.
> 
>Any ideas?
> 
>Thanks -David Hiltz
> 
> 
> use Win32::GUI;
> 
> $Win = new Win32::GUI::Window(
>   -left   => 341,
>   -top=> 218,
>   -width  => 300,
>   -height => 213,
>   -name   => "Win",
>   -text   => "Window Title"
>   );
> 
> $Win->Show();
> 
> $Win->AddButton(
>-text=> "Loop",
>-name=> "Loop",
>-left=> 104.5,
>-top => 102,
>-width   => 95,
>-height  => 28,
>   );
> 
> $Win2 = new Win32::GUI::Window(
>   -left   => 391,
>   -top=> 238,
>   -width  => 200,
>   -height => 183,
>   -name   => "Win2",
>   -title   => "New Window",
>   );
> 
> $Win2->AddLabel(
>-text=> "",
>-name=> "Label",
>-left=> 60,
>-top => 30,
>-width   => 20,
>-height  => 20,
>   );
> 
> $Win2->AddButton(
>-text=> "OK",
>-name=> "OK",
>-left=> 50,
>-top => 102,
>-width   => 95,
>-height  => 28,
>   );
> 
> Win32::GUI::Dialog();
> 
> sub Win_Terminate {
>return -1;
> }
> 
> sub OK_Click {
>$Win2->Hide();
> }
> 
> sub Loop_Click {
> 
>foreach $i (0 ... 3) {
>  &Show_Win2($i);
>  sleep 1;
>}
> }
> 
> sub Show_Win2 {
>my($num) = @_;
> 
>$Win2->Label->Text($num);
>$Win2->Show();
>$Win2->Update();  # This will make the OK button show up, but
>  # the window will not wait for a click of the OK.
> }



Re: [perl-win32-gui] gui builder

2000-12-13 Thread Robert Sherman

i believe i have located it (for any interested):

http://www.mail-archive.com/perl-win32-gui@httptech.com/msg00718.html

-rob

David Hiltz wrote:
> 
> > is there a forms builder or a gui builder for the win32::GUI module ?
> 
>   I've been working on one.  It will lets you drag around widgets (buttons,
>   labels, etc) and place them on an empty window.  You can size them and
>   change some basic properties about the widgets.  You can also save your
>   work and read it back into to make changes.
> 
>   I call the program "GB" (GUI Builder).
> 
>   You might find a copy in the archives.  I have made some minor fixes and
>   additions to the program since the last version, but haven't gotten around
>   to releasing it.  If there is enough interest, I can become motivated to
>   do so.  ;)
> 
>   -David Hiltz



[perl-win32-gui] explorer/file browser?

2000-08-04 Thread Robert Sherman

does anyone out there have or know of a file browser/explorer written
entirely in perl? i want to create a gui app that has a file browser in
it so the user can browse through the local file sytem on their machine
to choose the file they are going to use within the app...

i am mapping out ways to roll my own, but was wondering if there is one
already floating around out there...


TIA

rob

 
=
Robert Sherman
Campus Life Local Support
Emory University
=