yes. 

Here is the code. It's messy, but commented ...

use Win32::GUI;
#($DOS) = Win32::GUI::GetPerlWindow();
# Win32::GUI::Hide($DOS);

# this is basically a test to learn Win32::GUI
my $Toolbar=Win32::GUI::Window->new(
     -name=>'Toolbar',
     -size=>[600,75],
     -title=>"PERL ToolBar",
     );

# launcher button on main bar
my $launcher=$Toolbar->AddButton(
     -name=>'launcher',
     -pos=>[10,10],
     -text=>"Launcher",
     );
$Toolbar->launcher->Show();


#launch the launcher panel and create panel as separate window
#this is where I can type a command in and run it directly from <STDIN>
 sub launcher_Click{
   my $Launcher=Win32::GUI::Window->new( 
          -name=>'CommandLauncher',
          -size=>[200,75],
          -title=>"Launcher",
          );
   $Launcher->Show();


   my $textfield=$Launcher->AddTextfield(
           -name=>'CommandBox',
           -background=>[255,255,0],
           -pos=>[10,10],
           -size=>[150,22],
           );

#run button on launcher window
   my $runButton-$Launcher->AddButton(
        -name=>'runbutton',
        -pos=>[160,10],
        -text=>'Run',
        -size=>[30,22],
        );
   $Launcher->runbutton->Show();

# this executes the user input of $textfield 
    sub runbutton_Click{
     exec($textfield->Text);
    }
   }
my $NotePadButton=$Toolbar->AddButton(
        -name=>'notepad',
        -pos=>[75,10],
        -text=>'notepad',
           );

  
$Toolbar->notepad->Show();
  sub notepad_Click{
   exec("notepad.exe");
    }

#exit the program. This is a test to figure out how to keep the 
#toolbar floating without exiting on button_Click. 


my $ExitButton=$Toolbar->AddButton(
     -name=>'Exit',
     -pos=>[150,10],
     -text=>'Exit Toolbar',
     );
     
   sub Exit_Click {
    exit;
    }
   


$Toolbar->Show();
Win32::GUI::Dialog();

# commented this out trying to troubleshoot 
#  sub Toolbar_Terminate{
#   -1;
#  }

    




  ----- Original Message ----- 
  From: Peter Eisengrein 
  To: 'perl-win32-gui-users@lists.sourceforge.net' 
  Sent: Friday, May 11, 2001 7:31 AM
  Subject: RE: [perl-win32-gui-users] keeping a window open


  Do you have the Win::GUI::Dialog(); statement in there?
   
   
    -----Original Message-----
    From: Chris Etzel [mailto:[EMAIL PROTECTED]
    Sent: Thursday, May 10, 2001 8:03 PM
    To: perl-win32-gui-users@lists.sourceforge.net
    Subject: [perl-win32-gui-users] keeping a window open


    Ok, it may be that I have hacking at my script so long I am cross-eyed, but 
it is too much fun to stop now. I figured the best way to learn the Win32::GUI 
was to write a cool little toolbar with a couple of my most used apps on it. It 
floats and brings up my apps like it should, but it closes after I click the 
button for the app. How do I keep the script open until I exit it manually? 

    I have an exit button but for the life of me I can't figure out how to tell 
it 
        unless I click EXIT, stay open.

    I will kick myself in advance in case this is a basic perl coding issue and 
not a Win32gui issue.

    Thanks, 
    Chris

Reply via email to