simulate keyboard
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 106
- Joined: Wed May 31, 2006 9:56 pm
- Contact:
simulate keyboard
I'm creating a class resource to be used on a tablet PC. Part of the task is to enter text in a field. I guess the best approach is a graphic of the keyboard with buttons placed over the keys and then use a general script like:
Put the short name of me after field "Title"
Etc.
Then use button highlite and some audio 'click' for feedback.
Is there a better approach or an existing resource that I'm not aware of?
Put the short name of me after field "Title"
Etc.
Then use button highlite and some audio 'click' for feedback.
Is there a better approach or an existing resource that I'm not aware of?
-
- Posts: 106
- Joined: Wed May 31, 2006 9:56 pm
- Contact:
First idea is fine
The basic idea worked- I grouped all the buttons that cover the keys on a graphic of a keyboard and this is the code for the group (only one place that needs editing):
Any further suggestions are welcome- Now need to switch between upper/lower case. Not sure if I just want to duplicate the whole group, or modify each key to have a dual name ( A a ). Then use an IF to test for the caps lock and select, e.g.
This way seems easier to maintain & edit.
Code: Select all
on mouseUp
play audioClip "snd_click.wav"
put the short name of the target after field "TitleContent"
end mouseUp
Code: Select all
put word 2 of the name of the target after field "TitleContent"
-
- Posts: 106
- Joined: Wed May 31, 2006 9:56 pm
- Contact:
Malte,
Yes, thanks! That helps very much. Very efficient way to do it.
Another elusive feature: is there a way to determine where the text insertion point (cursor) is in a field? I need to have the delete button delete the character to the left of that point. I can delete at the end of the line, but not inside it. I can also delete selected text, but cannot put new text at the insertion point.
If you remember, we purchased Arcade Engine a few years ago and I wanted to mention that the student using it for simulating coin puzzles has completed her dissertation on problem solving strategies and graduated. It all worked well and allowed for a more realistic simulation. Thanks again for your help on that.
Yes, thanks! That helps very much. Very efficient way to do it.
Another elusive feature: is there a way to determine where the text insertion point (cursor) is in a field? I need to have the delete button delete the character to the left of that point. I can delete at the end of the line, but not inside it. I can also delete selected text, but cannot put new text at the insertion point.
Code: Select all
on mouseUp
play audioClip "snd_click.wav"
if the selectedText of field "TitleContent" ="" then
delete last character of field "TitleContent"
else
delete the selectedChunk
end if
end mouseUp
Hi Ron,
you will need to play with the selectedChunk of the field. if word 2 of the selectedChunk > word 4 of the selectedChunk of the field, you know there is no selection active and the insertionpoint is after char (word 2 of the selectedChunk of the field).
Glad to here the coin project worked out! Is that available somewhere? I'd be really curious to see it.
All the best,
Malte
you will need to play with the selectedChunk of the field. if word 2 of the selectedChunk > word 4 of the selectedChunk of the field, you know there is no selection active and the insertionpoint is after char (word 2 of the selectedChunk of the field).
Glad to here the coin project worked out! Is that available somewhere? I'd be really curious to see it.
All the best,
Malte
-
- Posts: 106
- Joined: Wed May 31, 2006 9:56 pm
- Contact:
Malte,
Thanks again! that was the insight that I needed, I didn't realize I could get a value for 'selected chunk' if there was nothing selected, but the line:
Put the selectedchunk of field "TitleContent"
Produced (as you indicated) the following:
char 86 to 85 of field 1
So this was then the simple solution for the delete button:
Likewise, the code for the text keys becomes:
This is great, solves the final problem.
The coin problem is part of a large stack that has passwords, data collection, subject randomization, etc. I'll see if I can break out the Coin card and edit it so it will work out of context.
Thanks again! that was the insight that I needed, I didn't realize I could get a value for 'selected chunk' if there was nothing selected, but the line:
Put the selectedchunk of field "TitleContent"
Produced (as you indicated) the following:
char 86 to 85 of field 1
So this was then the simple solution for the delete button:
Code: Select all
on mouseUp
play audioClip "snd_click.wav"
if the selectedText of field "TitleContent" ="" then --no text has been selected
Put word 4 of the selectedchunk of field "TitleContent" into ThePoint -- identifies the character to the left of the insertion point
delete character ThePoint of field "TitleContent" -- deletes the character to the left of the insertion point
else
delete the selectedChunk
end if
end mouseUp
Code: Select all
Put word 4 of the selectedchunk of field "TitleContent" into ThePoint
put toLower(the label of the target) after character ThePoint of field "TitleContent"
The coin problem is part of a large stack that has passwords, data collection, subject randomization, etc. I'll see if I can break out the Coin card and edit it so it will work out of context.