I've been searching and experimenting with various options. For example, the following doesn't work.
Code: Select all
on focusin
click at the hilitedLine
end focusin
I'm sure this is brain-dead easy.
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Code: Select all
on focusin
click at the hilitedLine
end focusin
Code: Select all
on arrowKey theKey
put the hilitedLine of me into myLine
if theKey is up then
put max(1,myLine-1) into myLine
else if theKey is down then
put min(number of lines of me,myLine+1) into myLine
else
pass arrowKey
end if
set the hilitedLine of me to myLine
end arrowKey
Mark wrote:Hi Bill,
It seems that you have to click in the field to make the arrowKeys work, which is a silly situation of course.
Try this in your list field:
Best,Code: Select all
on arrowKey theKey put the hilitedLine of me into myLine if theKey is up then put max(1,myLine-1) into myLine else if theKey is down then put min(number of lines of me,myLine+1) into myLine else pass arrowKey end if set the hilitedLine of me to myLine end arrowKey
Mark
Code: Select all
on returnInField
set the itemDelimiter to tab
set the selectedLine to myLine
answer item 1 of the value of selectedLine
end returnInField
billworld wrote:That works. Thanks!
Mark wrote:Hi Bill,
It seems that you have to click in the field to make the arrowKeys work, which is a silly situation of course.
Try this in your list field:
Best,Code: Select all
on arrowKey theKey put the hilitedLine of me into myLine if theKey is up then put max(1,myLine-1) into myLine else if theKey is down then put min(number of lines of me,myLine+1) into myLine else pass arrowKey end if set the hilitedLine of me to myLine end arrowKey
Mark
billworld wrote:Now I'm stuck on the issue of being able to press the return key (after using the keyboard to navigate into the table) to grab data from the current line. I've set a local var on myLine to pick up the up/down key line setting, and I'm getting that data into the returnInField handler. However, I'm not seeing how to get values out of that line. The "set the selectedLine to myLine" code is incorrect, but, conceptually that's what needs to occur. How do I transfer the concept of what's set in myLine to becoming the current selectedLine from which I can then grab values?
ThanksCode: Select all
on returnInField set the itemDelimiter to tab set the selectedLine to myLine answer item 1 of the value of selectedLine end returnInField
Bill
billworld wrote:That works. Thanks!
Mark wrote:Hi Bill,
It seems that you have to click in the field to make the arrowKeys work, which is a silly situation of course.
Try this in your list field:
Best,Code: Select all
on arrowKey theKey put the hilitedLine of me into myLine if theKey is up then put max(1,myLine-1) into myLine else if theKey is down then put min(number of lines of me,myLine+1) into myLine else pass arrowKey end if set the hilitedLine of me to myLine end arrowKey
Mark
hilitedLine is a property that can be interrogated, or setRev dictionary wrote:The selectedLine function returns a chunk expression of the form
line lineNumber of field fieldNumber
if the text selection is on one line, or
line startLine to endLine of field fieldNumber
if the text selection crosses multiple lines.
So your codeRev dictionary wrote:The hilitedLine of a field is a list of one or more integers, separated by commas.
Code: Select all
on returnInField
set the itemDelimiter to tab
set the selectedLine to myLine
answer item 1 of the value of selectedLine
end returnInField
Code: Select all
on returnInField
set the itemDelimiter to tab
set the hilitedLine of me to myLine
answer item 1 of line the hilitedLine of me
-- or answer item 1 of (the selectedLine)
-- or answer item 1 of line myLine of field "targetField"
-- etc
end returnInField
Code: Select all
answer item 1 of line myLine of me
SparkOut wrote:Hi Bill,
You need to have a look in the documentation to see the distinction between the "selectedLine" and the "hilitedLine"
Rev dictionary wrote:The selectedLine function returns a chunk expression of the form
line lineNumber of field fieldNumber
if the text selection is on one line, or
line startLine to endLine of field fieldNumber
if the text selection crosses multiple lines.Rev dictionary wrote:The hilitedLine of a field is a list of one or more integers, separated by commas.
Code: Select all
-- activates the arrowkeys
if (the hilitedline of me) <> "" then -- in case there is no selection
select line (item 1 of the hilitedline of me) of me -- in case there is multiple selections
else select line 1 of me
bn wrote:Bill,
to activate the arrowkeys you can putinto the focusIn handler and you dont have to trap for the arrowkeys.Code: Select all
-- activates the arrowkeys if (the hilitedline of me) <> "" then -- in case there is no selection select line (item 1 of the hilitedline of me) of me -- in case there is multiple selections else select line 1 of me
regards
bernd
Code: Select all
on returnInField
set the itemDelimiter to tab
put the hilitedLine of me into myLine
if myLine contains comma
then answer "Please select just one record."
else answer item 1 of line myLine of me
end returnInField
billworld wrote:Yeah, I was going down the wrong path. As I had the right row with hilitedLine, all I then needed to do is:
rather than trying to figure out what the selectedLine was/is and try to pull a value out of that.Code: Select all
answer item 1 of line myLine of me
Anyway, got it.
Thanks, and sorry for the trouble!
SparkOut wrote:Hi Bill,
You need to have a look in the documentation to see the distinction between the "selectedLine" and the "hilitedLine"
Rev dictionary wrote:The selectedLine function returns a chunk expression of the form
line lineNumber of field fieldNumber
if the text selection is on one line, or
line startLine to endLine of field fieldNumber
if the text selection crosses multiple lines.Rev dictionary wrote:The hilitedLine of a field is a list of one or more integers, separated by commas.
Code: Select all
on returnInField
put the hilitedline of me into tHilited
put the number of items of tHilited into tCountLines
if tCountLines < 2 and tCountLines >0 then -- -> 1 line selected
put line (item 1 of the hilitedline of me) of me into tAnswer
else -- -> more than 1 line selected
repeat for each item aSelectedLineNumber in tHilited
put line aSelectedLineNumber of me & return after tAnswer
end repeat
delete char -1 of tAnswer -- return
end if
answer tAnswer
end returnInField
bn wrote:Bill,
I don't quite get what you want.
This code passes the selected line/lines to the answer dialog. It is this you're looking for?this doesnt take care of case no line selectedCode: Select all
on returnInField put the hilitedline of me into tHilited put the number of items of tHilited into tCountLines if tCountLines < 2 and tCountLines >0 then -- -> 1 line selected put line (item 1 of the hilitedline of me) of me into tAnswer else -- -> more than 1 line selected repeat for each item aSelectedLineNumber in tHilited put line aSelectedLineNumber of me & return after tAnswer end repeat delete char -1 of tAnswer -- return end if answer tAnswer end returnInField
regards
bernd