message box

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pradeeps
    New Member
    • Oct 2008
    • 17

    #1

    message box

    this my piece of code.after pop up 1st msg box.it is not worked.even though i give 'yes' it s not working..pls help me.any mistake..

    Code:
    use strict;
    use warnings;
    use Tk;
    
    
     my $mw = MainWindow->new;
            $mw->geometry("600x475");
            $mw->title("Network Device Monitoring tool");
    
    $mw->Button(-text =>"Refresh",-command =>\&a)->pack(-ipadx => 5,-ipady => 4,-padx => 10,-pady => 15,-side =>"left",-expand
            =>"no");
            
    sub a {
    my $response = $mw -> messageBox(-message=>"Go to Properties of this mac?",-title=>"string",-type=>'yesno',-icon=>'question');
    
    if ($response eq 'yes')
    {
        $mw -> messageBox(-message=>"Go to Properties of this mac?",-title=>"string",-type=>'ok',-icon=>'info');
    }
    else {
        exit;
    }
    }
    MainLoop;
    Last edited by eWish; Nov 5 '08, 02:08 PM. Reason: Please use the code tags
  • nithinpes
    Recognized Expert Contributor
    • Dec 2007
    • 410

    #2
    First, use Code tags while posting your code.
    The script does not work because the messagebox call returns 'Yes' and not 'yes'. Change:
    Code:
    if ($response eq 'yes')
    to :

    Code:
    if ($response eq 'Yes')
    -Nithin

    Comment

    • pradeeps
      New Member
      • Oct 2008
      • 17

      #3
      thanks nithin,it s careless mistake.


      cheers

      Comment

      Working...