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.
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
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
Code: Select all
on mouseUp
select after text of fld 1
end mouseUp
Code: Select all
put "abcde" into fld 1
select after char 2 of fld 1
put the selectedChunk
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
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"?
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
The code is in the button and card script - but. not sure what you actually mean.