By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,541 Members | 1,455 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,541 IT Pros & Developers. It's quick & easy.

text area problem

P: 17
i want to highlight(select) text field in a text area in perl.is there any way to that

any help..........
Oct 22 '08 #1
Share this Question
Share on Google+
10 Replies


KevinADC
Expert 2.5K+
P: 4,059
perl has no "text area". Can you explain your question better?
Oct 22 '08 #2

P: 17
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
Oct 22 '08 #3

nithinpes
Expert 100+
P: 410
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
Expand|Select|Wrap|Line Numbers
  1. my  $tx= $fr->Scrolled( 'Text', '-scrollbars' => 'e', '-background' => 'white',       
  2.   )->pack( -fill => 'both', -expand => 1, -side => 'bottom' );
  3.  
  4. $tx->tag(qw/configure color1 -background yellow/); ##yellow for highlight
  5. $tx->insert('insert', "This is ");
  6. $tx->insert('insert',"highlighted text",'color1');
  7. $tx->insert('insert', "\n ");
  8.  
-Nithin
Oct 22 '08 #4

P: 17
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
Oct 22 '08 #5

P: 62
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):


Expand|Select|Wrap|Line Numbers
  1. use Tk;    
  2. $mw->maxsize(500,800);                                
  3. $mw->minsize(500,800);
  4. $text=$mw->Text( -width=>65,
  5.                  -height=>5,
  6.          );
  7. $text->place(-x => 20,-y => 700);    
  8. $text->focus;    #set cursor to the chosen text widget
When u want take a line from text widget do this:


Expand|Select|Wrap|Line Numbers
  1. use Tk;    
  2. $mw->maxsize(500,800);                                
  3. $mw->minsize(500,800);
  4. $text=$mw->Text( -width=>65,
  5.                  -height=>5,
  6.          );
  7. $text->place(-x => 20,-y => 700);    
  8. #then u write to text widget
  9. $r=$text->get('1.0','1.0 lineend');       #take the first line from text
Oct 22 '08 #6

P: 62
u can also many line take(u think that field?)

Expand|Select|Wrap|Line Numbers
  1. @r=$text->get(’1.0’,’1.0 lineend’,’2.0’,’2.0 lineend’);
  2. #this get first second... lines from your text widget
results:
$r[0]="first line"
$r[1]="second line"
ect.
Oct 22 '08 #7

P: 17
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............
Oct 23 '08 #8

P: 62
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.
Oct 23 '08 #9

P: 17
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.........
Oct 28 '08 #10

P: 62
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.........
Expand|Select|Wrap|Line Numbers
  1. use Tk;
  2. $mw = MainWindow->new(-title => " Using BrowseEntry");
  3. $be = $mw->BrowseEntry(-variable => \$string,
  4.                                       -browsecmd => \&rutin);
  5. $be->pack();
  6. MainLoop();
  7. sub rutin
  8. {
  9.         $mw2 = MainWindow->new(-title => " New MainWindow");
  10. }
Oct 28 '08 #11

Post your reply

Sign in to post your reply or Sign up for a free account.