Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help with textbox and Return key...

Status
Not open for further replies.

ee1

Programmer
May 31, 2011
25
0
0
IL
Hi all,
i have a text box, using for entering search text,
nowthe search proc works only when i push the "find" button.
i want it to work after pressing the Return key when i am in the textbox.
this is the code:
frame .bottom
label .bottom.search -text "search:"
entry .bottom.ent -textvariable find -relief sunken -bg white -width 60
button .bottom.but -text find -command "search proc"


thanks.
 
bind .bottom_ent <Return> {search_proc}

Also try adding this to .bottom.ent

-validate key \
-validatecommand {if {[string length %P] < 3} {return 1}
search_proc %P; return 1}

If you type more than two characters into the entry field then it will run the search proc using the characters entered. Of course your search proc needs to be in the form

proc search_proc {find} {
}

Andrew
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top