moked has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks

Im using the next code for text box:
my $mp = MainWindow->new(title=>"Project List"); my $mp1 = $mp -> Frame; $mp1->Label( -text=>'For Help...', -font => 'bold', -relief => 'sunken', -height => '1.5', -background => 'lightblue')->pack(-side=>"top",-fill=>"both",- +anchor=>"w"); $mp1 -> pack; my $mp2 = $mp -> Frame; $mp2->Button( -text => 'Cancel', -background => 'lightgreen', -command =>\&Escape)->pack(-side=>"right",qw/-padx 50 -pady 2/ +); $mp2->Button( -text => 'OK', -background => 'lightgreen', -command =>[$mp => 'destroy'])->pack(-side=>"right",qw/-ipadx +8 -pady 2/); $mp2 -> pack; my $mp3 = $mp1 -> Frame; $listbox = $mp3->Scrolled("Listbox", "-width" => 35, "-height" => 20, "-scrollbars" => 'sw', "-background" => 'lightyellow'); #open(FILE,"K:\\SHIHAN\\ENV_LIST.txt") or warn "$!\n"; open(FILE,"K:\\Project_List.txt") or warn "$!\n"; while ($line=<FILE>) { chomp ($line); if ( $line =~ '^[1-9]') { $listbox-> insert('end',"$line");} } close (FILE); $listbox-> bind ('<Motion>',\&getNumFlow); $listbox-> bind ('<Double-1>',sub{getNumFlow(); $mp->destroy;}); $listbox->configure(-yscrollcommand =>['set',$scroll]); $listbox->pack(-side=>'left',-fill => 'both'); $text2 = $mp3->Text('-width'=>40,'-height'=>2)->pack; $mp3 -> pack; MainLoop;

I'm using a '<Motion>' since I can't use any thing else
when I tryed to finde something to react
to a single mouse click I kept getting errors.
Please help me find the right command, since for this even the black book didn't help.

Thanks Ahead
Moked

Replies are listed 'Best First'.
Re: a single click in a text box
by Chady (Priest) on Aug 09, 2005 at 09:04 UTC

    Have you tried ButtonRelease-1? It seems to work here:

    $listbox-> bind ('<ButtonRelease-1>',\&getNumFlow);

    He who asks will be a fool for five minutes, but he who doesn't ask will remain a fool for life.
    Chady | http://chady.net/
    Are you a Linux user in Lebanon? join the Lebanese GNU/Linux User Group.
      The ButtonRelease-1 does work here as well.
      I don't know why it doesn't appear on the black book.
      strange isn't it??