Dialog box selections using keyboard.
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Livecode Opensource Backer
- Posts: 9450
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Dialog box selections using keyboard.
Thanks, Bernd:
1. You ARE 'the man'.
2. I was being sleepy as I had already worked
out about traversal 2 weeks ago.
3. No need to use focus at all, now just using
textColor to know where to send a mouseUp
message.
Will post that code when back from church.
1. You ARE 'the man'.
2. I was being sleepy as I had already worked
out about traversal 2 weeks ago.
3. No need to use focus at all, now just using
textColor to know where to send a mouseUp
message.
Will post that code when back from church.
-
- Livecode Opensource Backer
- Posts: 9450
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Dialog box selections using keyboard.
What I wrote about textColor (while being possible) is not the method I used,
but my state of mind then was determined by
"Will post that code when back from church."
As went to church to bury a friend, and I was a bit . . .
The way to understand how I did things is to understand the context of my building a keyboard
to allow severely disabled people to type into a text field using ONLY these keys, or a subset of them:
- -
These can be easily mapped to a joystick, or for that matter a mouth-controlled device.
As you will see from the screen shot, my virtual keyboard is NOT complete, and needs further modification:
- -
This is the cardScript in the virtual keyboard palette:
but my state of mind then was determined by
"Will post that code when back from church."
As went to church to bury a friend, and I was a bit . . .
The way to understand how I did things is to understand the context of my building a keyboard
to allow severely disabled people to type into a text field using ONLY these keys, or a subset of them:
- -
These can be easily mapped to a joystick, or for that matter a mouth-controlled device.
As you will see from the screen shot, my virtual keyboard is NOT complete, and needs further modification:
- -
This is the cardScript in the virtual keyboard palette:
Code: Select all
on openStack
set the textColor of btn "b1" to blue
put "1" into fld "kee"
--focus on btn "b1"
end openStack
on arrowKey AK
if AK = "right" then
put fld "kee" into KEEE
if exists(btn ("b" & KEEE)) then
set the textColor of btn ("b" & KEEE) to red
end if
add 1 to KEEE
put KEEE into fld "kee"
if exists(btn ("b" & KEEE)) then
set the textColor of btn ("b" & KEEE) to blue
--focus on btn ("b" & KEEE)
end if
end if
if AK = "left" then
put fld "kee" into KEEE
if exists(btn ("b" & KEEE)) then
set the textColor of btn ("b" & KEEE) to red
end if
subtract 1 from KEEE
put KEEE into fld "kee"
if exists(btn ("b" & KEEE)) then
set the textColor of btn ("b" & KEEE) to blue
--focus on btn ("b" & KEEE)
end if
end if
end arrowKey
on enterKey
put fld "kee" into KEEY
if exists(btn ("b" & KEEY)) then
send "mouseUp" to btn ("b" & KEEY)
end if
end enterKey
on closeStack
put 1 into Kred
repeat until Kred > 35
set the textColor of btn ("b" & Kred) to red
add 1 to Kred
end repeat
end closeStack
Last edited by richmond62 on Sun Mar 12, 2023 7:53 pm, edited 1 time in total.
-
- Livecode Opensource Backer
- Posts: 9450
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Dialog box selections using keyboard.
Mind you, this is a load of old cobblers:
- -
as I was expecting the cursor to move BACK one character . . .
. . . instead of a SPACE and a 'q'.
- -
as I was expecting the cursor to move BACK one character . . .
. . . instead of a SPACE and a 'q'.
-
- Livecode Opensource Backer
- Posts: 9450
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Dialog box selections using keyboard.
I would also like to know whether it is possible to show an insertion point in a field which has FOCUS turned OFF.
-
- VIP Livecode Opensource Backer
- Posts: 9747
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Dialog box selections using keyboard.
Richmond.
Assuming you mean simply that if the field currently does not have focus, then I believe LC will automatically give it focus if you want a blinking cursor.
Craig
Assuming you mean simply that if the field currently does not have focus, then I believe LC will automatically give it focus if you want a blinking cursor.
Craig
Last edited by dunbarx on Sun Mar 12, 2023 11:42 pm, edited 1 time in total.
-
- VIP Livecode Opensource Backer
- Posts: 9747
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Dialog box selections using keyboard.
Interestingly, if one has a card with a button and a field, with the field NOT in focus, and this in the button script:
The field becomes focussed with a blinking cursor. But if the same line of code is executed from the message box, nothing happens.
Craig
Code: Select all
on mouseUp
select after text of fld 1
end mouseUp
Craig
-
- VIP Livecode Opensource Backer
- Posts: 7258
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Dialog box selections using keyboard.
If traversalOn is false then the field will not have a cursor, and apparently doesn't have a selection either, at least from the message box. This fails:
The response will refer to the message box. I imagine it will be the same from any handler. Is there a reason to turn off traversalOn?
Code: Select all
put "abcde" into fld 1
select after char 2 of fld 1
put the selectedChunk
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- Livecode Opensource Backer
- Posts: 9450
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Dialog box selections using keyboard.
The field, which is on a card on a different stack to the virtual keyboard, is blocked from receiving focus as it is part of what I hope will eventually be a joystick-controlled interface for LC/OXT to allow seriously disabled people to write computer programs.
-
- Livecode Opensource Backer
- Posts: 9450
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Dialog box selections using keyboard.
Here's another jolly problem:
- -
Why is my right arrow key going on adding to fld "nCHX" when
there are only 11 characters in fld "ff"?
- -
Code: Select all
on mouseUp
put fld "nCHX" into CHX
if exists(char (CHX + 1) in fld "ff") then
select after char (CHX + 1) in fld "ff"
put (CHX + 1) into fld "nCHX"
end if
end mouseUp
there are only 11 characters in fld "ff"?
- Attachments
-
- Arrow key faker.livecode.zip
- Stack.
- (1.17 KiB) Downloaded 54 times
Re: Dialog box selections using keyboard.
According to the dictionary, the exists function always returns true when specifying a chunk of a container. Perhaps you should simply test if the chunk is empty.richmond62 wrote: ↑Mon Mar 13, 2023 12:09 pmWhy is my right arrow key going on adding to fld "nCHX" when
there are only 11 characters in fld "ff"?
Gerrie
-
- VIP Livecode Opensource Backer
- Posts: 4021
- Joined: Sun Jan 07, 2007 9:12 pm
- Location: Bochum, Germany
Re: Dialog box selections using keyboard.
Here is my take on button Bleft:
And here for button Bright
Your use of "exist" in this context is new to me
Kind regards
Bernd
Code: Select all
on mouseUp
put fld "nCHX" into CHX
put the number of chars of field "ff" into tNumChars
if CHX = 0 then
beep
end if
if CHX > 0 and CHX <= tNumChars then
select after char (CHX - 1) in fld "ff"
put min(max(tNumChars,0),CHX-1) into field "nCHX"
end if
end mouseUp
Code: Select all
on mouseUp
put fld "nCHX" into CHX
put the number of chars of field "ff" into tNumChars
if CHX = tNumChars then
beep
end if
if CHX >= 0 and CHX <= tNumChars then
select after char (CHX + 1) in fld "ff"
put min(max(tNumChars,0),CHX+1) into field "nCHX"
end if
end mouseUp
Kind regards
Bernd
-
- Livecode Opensource Backer
- Posts: 9450
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Dialog box selections using keyboard.
Thank you, Bernd: I was obviously being too clever with exists.
-
- Livecode Opensource Backer
- Posts: 9450
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Dialog box selections using keyboard.
-
- Attachments
-
- Arrow key faker.livecode.zip
- Stack.
- (1.4 KiB) Downloaded 57 times
Re: Dialog box selections using keyboard.
The code is in the button and card script - but. not sure what you actually mean.
On a related note, the 'forward delete' button does not work as one would imagine - it just goes to the end of line.
I'm not are what the use-case for this 'functionality' would be other than idle curiosity (I mean most would probably just use the actual arrow, delete and forward-delete keyboard keys) - perhaps if you let us know what it is you're trying to do?
S
Re: Dialog box selections using keyboard.
Hi Stam,
I keep an eye on this possible spammer!
Best
Klaus
I keep an eye on this possible spammer!
Best
Klaus