Page 1 of 1
Auto Select
Posted: Mon May 10, 2010 6:14 am
by f.x.moser
Hello
I'm very new to revolution. Tried some Basic things, that worked very well. Now my first real thing has come and I need to taylor the GUI a little bit more "windows like". If have two thing I need to solve quickley.
1) "Auto Select" the text in a text field when entering the field, so if the user just begins to type, the content is erased and the new typed content is written in. If the user presses "tab" it advances to the next field.
2) Button "Combo Box" , filled with some entries using the menu items; want to select by "typing the first letters" and if the correct etry is show, leaving the Button with "tab"
Hope these - for me very basic features - can be handled by some properties without having to "code" handlers for that.
Best regards
Franz
Re: Auto Select
Posted: Mon May 10, 2010 11:01 pm
by dunbarx
You will have to do a bit of coding to get what you need.
The first item is easy. I hope you don't really mean "when the user just begins to type". Wouldn't it be better, for example, to have the text selected when the mouse enters the field? Or perhaps when one tabs into the field? In any such case, you would trap for the event, as in:
on mouseEnter
select the text of me
end mouseEnter
Handle the "tabKey" message or the "openField" message if you want to change select the text in another field. Note that normally, tab automatically gives focus to the next numbered control. If you have many fields, this handler should go into the card script, checking the target as you go.
For your second purpose you could write a KeyUp handler that takes the text in the combo box field and finds it in the contents of the button (the contents of the button is the all menuItems of the button). But if you have data that starts with similar characters, you will run into problems, no?
Code: Select all
on keyup
put me into temp
put the selectedText of me into tText
repeat with y = 1 to the number of lines of me
if char 1 to 3 of line y of me = tText then --3 chars enough? Too many?
set the menuHistory of me to y
exit repeat
end if
end repeat
end keyup
Start with these and see if they meet your needs. They likely do not. In other words, you need a bit of coding.
Craig Newman
Re: Auto Select
Posted: Mon May 10, 2010 11:58 pm
by bn
Hi Franz,
f.x.moser wrote:1) "Auto Select" the text in a text field when entering the field, so if the user just begins to type, the content is erased and the new typed content is written in. If the user presses "tab" it advances to the next field.
try to set the autotab property (in the property inspector -> basic properties) for the fields you want to automatically hilite their text when you enter via tab. This might be what you are looking for. Of course Craig's script works too.
regards
Bernd
Re: Auto Select
Posted: Tue May 11, 2010 8:24 am
by Mark
Hi Franz,
I created my own combobox object, which might do what you want. It allows you to type the beginning of a word and view all list items that start with the same characters in a menu. You can choose an item from that menu with mouse or keyboard. You can download a stack with script library and instructions on how to make the object at
http://economy-x-talk.com/developers.html (see bottom of the page).
Best regards,
Mark
Re: Auto Select
Posted: Thu May 13, 2010 8:13 am
by f.x.moser
Many thanks to all!
Tried everthing and got it to work. The scripts are working.
Finally I chose:
"autotab" Property is fine for my purpose
"Combobox" --> I love the solution from Mark. Great stuff.
Franz