text area problem | Newbie | | Join Date: Oct 2008
Posts: 17
| | |
i want to highlight(select) text field in a text area in perl.is there any way to that
any help..........
|  | Expert | | Join Date: Jan 2007 Location: Southern California USA
Posts: 4,091
| | | re: text area problem
perl has no "text area". Can you explain your question better?
| | Newbie | | Join Date: Oct 2008
Posts: 17
| | | re: text area problem Quote:
Originally Posted by KevinADC perl has no "text area". Can you explain your question better?
i mean text box.i have made a text box using perl tk.i want to select some text inside the text box.how i do that.
thanks brother
|  | Expert | | Join Date: Dec 2007
Posts: 400
| | | re: text area problem Quote:
Originally Posted by pradeeps i mean text box.i have made a text box using perl tk.i want to select some text inside the text box.how i do that.
thanks brother Using tag method, set a background color first. You can use this color to highlight text later. E.g -
my $tx= $fr->Scrolled( 'Text', '-scrollbars' => 'e', '-background' => 'white',
-
)->pack( -fill => 'both', -expand => 1, -side => 'bottom' );
-
-
$tx->tag(qw/configure color1 -background yellow/); ##yellow for highlight
-
$tx->insert('insert', "This is ");
-
$tx->insert('insert',"highlighted text",'color1');
-
$tx->insert('insert', "\n ");
-
-Nithin
| | Newbie | | Join Date: Oct 2008
Posts: 17
| | | re: text area problem
thanks very much.i'm sorry.i've illustrate the question wrongly.
when i click the relevant text inside the text box it should select.when i click the text it should come another window that describes the properties of that text.that is the my question.if you don't understand pls tell me.i will explain.
thanks .cheers
| | Member | | Join Date: Sep 2008
Posts: 57
| | | re: text area problem
I dont understand what you want exatly ,but I give u 2 tips, I hope that help u
u can select a text widget in TK(set the cursor in this widget): - use Tk;
-
$mw->maxsize(500,800);
-
$mw->minsize(500,800);
-
$text=$mw->Text( -width=>65,
-
-height=>5,
-
);
-
$text->place(-x => 20,-y => 700);
-
$text->focus; #set cursor to the chosen text widget
When u want take a line from text widget do this: - use Tk;
-
$mw->maxsize(500,800);
-
$mw->minsize(500,800);
-
$text=$mw->Text( -width=>65,
-
-height=>5,
-
);
-
$text->place(-x => 20,-y => 700);
-
#then u write to text widget
-
$r=$text->get('1.0','1.0 lineend'); #take the first line from text
| | Member | | Join Date: Sep 2008
Posts: 57
| | | re: text area problem
u can also many line take(u think that field?) - @r=$text->get(’1.0’,’1.0 lineend’,’2.0’,’2.0 lineend’);
-
#this get first second... lines from your text widget
results:
$r[0]="first line"
$r[1]="second line"
ect.
| | Newbie | | Join Date: Oct 2008
Posts: 17
| | | re: text area problem
thanks brother.i think u ve not understand my problem.
in my text box it is displayed some mac addresses as follows.
0x001cc48468c2
0x001635749100
0x00219bd81383
0x000bcd5f295c
0x000c29a59daa
when i double click on one of mac address then i want to pop up a new window.but i don t know is it possible in perl tk.
how i do that
thanks again............
| | Member | | Join Date: Sep 2008
Posts: 57
| | | re: text area problem Quote:
Originally Posted by pradeeps thanks brother.i think u ve not understand my problem.
in my text box it is displayed some mac addresses as follows.
0x001cc48468c2
0x001635749100
0x00219bd81383
0x000bcd5f295c
0x000c29a59daa
when i double click on one of mac address then i want to pop up a new window.but i don t know is it possible in perl tk.
how i do that
thanks again............
Why dont make a browseentry? In that can u chose a line and to assign a subrutin.
| | Newbie | | Join Date: Oct 2008
Posts: 17
| | | re: text area problem
ye it's also helped me.but i want is when i click on one mac address then it should come a new window.how i do that.i'm new to the perl.
any help greatly appreciated.........
| | Member | | Join Date: Sep 2008
Posts: 57
| | | re: text area problem Quote:
Originally Posted by pradeeps ye it's also helped me.but i want is when i click on one mac address then it should come a new window.how i do that.i'm new to the perl.
any help greatly appreciated......... - use Tk;
-
$mw = MainWindow->new(-title => " Using BrowseEntry");
-
$be = $mw->BrowseEntry(-variable => \$string,
-
-browsecmd => \&rutin);
-
$be->pack();
-
MainLoop();
-
sub rutin
-
{
-
$mw2 = MainWindow->new(-title => " New MainWindow");
-
}
|  | | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,471 network members.
|