I have text field, when I type anything and press space bar the field become empty. If I press up arrow then it should display the last command (like linux terminal) , If I press down arrow also display the nex command . How I do this
Last entered word in filed
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Last entered word in filed
Hi All,
I have text field, when I type anything and press space bar the field become empty. If I press up arrow then it should display the last command (like linux terminal) , If I press down arrow also display the nex command . How I do this
I have text field, when I type anything and press space bar the field become empty. If I press up arrow then it should display the last command (like linux terminal) , If I press down arrow also display the nex command . How I do this
--
Thanks
Shalu S
Thanks
Shalu S
Re: Last entered word in filed
Hi.
Do you mean that you want the field to "become" empty when you press spacebar? That is easy.
But what do you mean by "the last" or "the next" command?
Craig Newman
Do you mean that you want the field to "become" empty when you press spacebar? That is easy.
But what do you mean by "the last" or "the next" command?
Craig Newman
Re: Last entered word in filed
Hi Craig,
Best
Jean-Marc
I think expected behavior is same of messages box.But what do you mean by "the last" or "the next" command?
Best
Jean-Marc
https://alternatic.ch
Re: Last entered word in filed
Shalu.
So is Jean-Marc correct? You want this field to work like the message box? Interesting challenge if so, but please confirm.
Craig
So is Jean-Marc correct? You want this field to work like the message box? Interesting challenge if so, but please confirm.
Craig
Re: Last entered word in filed
@dunbarx sorry for the late reply, I want a field like
When I type any text and press space bar the field should be empty
When I press up-arrow the field should display last typed text
When I type any text and press space bar the field should be empty
When I press up-arrow the field should display last typed text
--
Thanks
Shalu S
Thanks
Shalu S
Re: Last entered word in filed
OK. I did this in two handlers for readability. You need to pay me by rewriting in a single handler. Now which message should you use?
In a field script:
Get going.
Craig
In a field script:
Code: Select all
on keyDown tkey
put tKey after me
set the lastText of me to me
if tkey is space then put "" into me
end keyDown
on rawKeyDown tKey
if tKey = 65362 then set the text of me to the lastText of me
select after text of me
pass rawKeyDown
end rawKeyDownCraig
Re: Last entered word in filed
@dunbarx This is awesome. suppose I want see the all entered word in field then, how I change this code
--
Thanks
Shalu S
Thanks
Shalu S
Re: Last entered word in filed
Sorry.
Craig
I do not understand what you want.suppose I want see the all entered word in field then, how I change this code
Craig
Re: Last entered word in filed
Hi Shalu,
do you have any idea what Craig's script actually does?
Best
Klaus
do you have any idea what Craig's script actually does?
Best
Klaus
Re: Last entered word in filed
@dunbarx @Klaus sorry for the late reply
now the last entered word is placed into lastText "set the lastText of me to me", I want all word I entered into the field is placed into "lastText".
now the last entered word is placed into lastText "set the lastText of me to me", I want all word I entered into the field is placed into "lastText".
--
Thanks
Shalu S
Thanks
Shalu S
Re: Last entered word in filed
samlpe video is attached, I think now you understand my requrement
- Attachments
-
- s.zip
- (47.93 KiB) Downloaded 251 times
--
Thanks
Shalu S
Thanks
Shalu S
Re: Last entered word in filed
Shalu.
I have seen your video, but I do not understand it.
But is this what you wanted":
Craig
I have seen your video, but I do not understand it.
But is this what you wanted":
Code: Select all
on keyDown tkey
put tKey after me
set the lastText of me to the lastText of me & tKey
if tkey is space then put "" into me
end keyDown
on rawKeyDown tKey
if tKey = 65362 then set the text of me to the lastText of me
select after last char of me
pass rawKeyDown
end rawKeyDownRe: Last entered word in filed
@dunbarx sorry for the late reply
It's ok now but the problem is when I press up arrow tex field is display the all last entered words. suppose the last entered words are word1, word2, word3 (word1 space word2 space e.t.c). If I press up arrow then word3 should display and If I again press uparrow then word2 should display. now the current output is word1 word2 word3
It's ok now but the problem is when I press up arrow tex field is display the all last entered words. suppose the last entered words are word1, word2, word3 (word1 space word2 space e.t.c). If I press up arrow then word3 should display and If I again press uparrow then word2 should display. now the current output is word1 word2 word3
--
Thanks
Shalu S
Thanks
Shalu S
Re: Last entered word in filed
Hmmm.
Are you saying you want to store each field entry separately when you hit the spacebar? That is, each time the field is cleared? And then recall those entries one-by-one when you hit the up arrow?
If so, then make a second field, a bit larger than the first. Change your field handler to this:
Now this will load your text snippets into both the custom property and the field so you can see it. You will want to think of a way to clear that property, I would imagine, and maybe add other required gadgetry.
@Jacque, please look the other way. OK? Good. Now, Shalu, tell me how you can, in the "rawKeyDown" handler, extract each line of the custom property, one by one. This is tricky, but should be fun.
@Jacque! I asked you to turn around please.
Craig
Are you saying you want to store each field entry separately when you hit the spacebar? That is, each time the field is cleared? And then recall those entries one-by-one when you hit the up arrow?
If so, then make a second field, a bit larger than the first. Change your field handler to this:
Code: Select all
on keyDown tkey
put tKey after me
if tkey is space then
set the lastText of me to me & return & the lastText of me
put "" into me
end if
put the lastText of me into fld 2
end keyDown
on rawKeyDown tKey
if tKey = 65362 then
--your homework here
pass rawKeyDown
end rawKeyDown@Jacque, please look the other way. OK? Good. Now, Shalu, tell me how you can, in the "rawKeyDown" handler, extract each line of the custom property, one by one. This is tricky, but should be fun.
@Jacque! I asked you to turn around please.
Craig
