For Programmers: Free Programming Magazines  


Home > Archive > PerlTk > June 2007 > insert menu option text on a entry widget









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author insert menu option text on a entry widget
props666999@googlemail.com

2007-05-03, 8:01 am

Hi

i've been stuck

i need when i select any option of the menu that option' label to be
added on the
$addtxtexpense widget

use Tk;
my $mw = new MainWindow;
#Text Area
my $frm_name = $mw->Frame(-relief=>'groove',-borderwidth=> 5,-
background=>'black')
->pack(-side => 'top',-fill => 'x');

my $mw = new MainWindow;
my $button= $frm_name->Menubutton(-width=> 5,-relief=>'groove',-
activebackground=>'green',-activeforeground=>'blue',
-menuitems=>[['command'=>"item1", -command=>\&do_item],
[ 'command' =>"item2",-command=>\&do_item]])
-> pack(-side =>'left',-anchor =>'nw');


my $addexpense =$frm_name->Text(-width=>8,-height=>1)
->pack(-side=>'left',-anchor =>'nw',-
padx=>5);



sub do_item {

#$addtxtexpense->insert('end',);

}

MainLoop;

Marc Dashevsky

2007-05-03, 10:01 pm

In article <1178186631.812589.235080@y5g2000hsa.googlegroups.com>, props666999@googlemail.com says...
> Hi
>
> i've been stuck
>
> i need when i select any option of the menu that option' label to be
> added on the $addtxtexpense widget


use strict;
use Tk;
use Tk::BrowseEntry;

my $var;
my $mw = tkinit;
my $b = $mw->BrowseEntry(-variable => \$var)->pack;
$b->insert('end', 1 .. 10);
my $t = $mw->Label(-textvariable => \$var)->pack;

MainLoop;

--
Go to http://MarcDashevsky.com to send me e-mail.
Ch Lamprecht

2007-05-03, 10:01 pm

props666999@googlemail.com wrote:
> Hi
>
> i've been stuck
>
> i need when i select any option of the menu that option' label to be
> added on the
> $addtxtexpense widget
>
> use Tk;
> my $mw = new MainWindow;
> #Text Area
> my $frm_name = $mw->Frame(-relief=>'groove',-borderwidth=> 5,-
> background=>'black')
> ->pack(-side => 'top',-fill => 'x');
>
> my $mw = new MainWindow;

#Are you sure, you need a second MainWindow?
> my $button= $frm_name->Menubutton(-width=> 5,-relief=>'groove',-
> activebackground=>'green',-activeforeground=>'blue',
> -menuitems=>[['command'=>"item1", -command=>[\&do_item,'item 1']],
> ['command' =>"item2",-command=>[\&do_item,'item 2']],

# pass arguments here^^
])
> -> pack(-side =>'left',-anchor =>'nw');
>
>
> my $addexpense =$frm_name->Text(-width=>8,-height=>1)

# Maybe you want an Entry widget instead? ^^^
> ->pack(-side=>'left',-anchor =>'nw',-
> padx=>5);
>
>
>
> sub do_item {
>

#$addtxtexpense->insert('end',);
$addexpense->insert('end',$_[0]);
>
> }
>
> MainLoop;
>


Christoph


--
use Tk;use Tk::GraphItems;$c=tkinit->Canvas->pack;push@i,Tk::GraphItems->
TextBox(text=>$_,canvas=>$c,x=>$x+=70,y=>100)for(Just=>another=>Perl=>Hacker);
Tk::GraphItems->Connector(source=>$i[$_],target=>$i[$_+1])for(0..2);
$c->repeat(30,sub{$_->move(0,4*cos($d+=3.16))for(@i)});MainLoop
Abermotertard4

2007-05-09, 10:37 pm

Martha Stewart in anal action!
http://Martha-Stewart-anal-action.o...hp?movie=726071
Abedsterjotard

2007-05-12, 5:18 am

http://Britney-Spears-jerking.info/...hp?movie=148803
Adamelder

2007-06-07, 3:20 pm

http://www.shockingtheworld.com/watch?id=1673286
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com