Page 1 of 1
Click doesn't register after code selects a line in a list field
Posted: Sat Feb 15, 2025 9:40 am
by MichaelBluejay
I have a text input field and a couple of list fields.
When I edit the value of the input field, it puts that value into the first list field and selects the line, e.g.:
Code: Select all
on closeField
updateTitle
pass closeField -- Thought this might help, but it doesn't.
end closeField
on updateTitle
put me into line 4 of fld listField1
select line 4 of fld listField1
end updateTitle
If I edit the input field and then click on a line on the 2nd list field, nothing happens: The clicked line doesn't hilite, and the mouseup doesn't fire. If I click on the same line on the 2nd list field again, it works.
Any idea how I can get the click to work the first time?
Re: Click doesn't register after code selects a line in a list field
Posted: Sat Feb 15, 2025 11:44 am
by bn
Hi Michael,
Your current code in the input field takes the focus away from the second list field because of the
You can avoid setting the focus to listField1 with this code that does not take focus away from the second listfield when clicking on a line in it
Code: Select all
on closeField
updateTitle
end closeField
on updateTitle
put me into line 4 of fld listField1
--select line 4 of fld listField1
set the hilitedLine of field listField1 to 4
end updateTitle
I find it a bit unusual to do data entry using "closeField". I would do the data entry on for example using
Code: Select all
on returnInField
updateTitle
end returnInField
on enterInfield
returnInField
end enterInfield
That way data entry is done and does not interfere with focus etc.
And the user sees right away what has changed (typos included) and not after the user has done anything that triggers "closeField".
Unless of course you have a special reason to use "closeField" as trigger.
Kind regards
Bernd
Re: Click doesn't register after code selects a line in a list field
Posted: Sat Feb 15, 2025 1:26 pm
by MichaelBluejay
Thank you, Bernd, changing the code from "select line..." to "set the hilitedline..." fixed it.
I'm using closeField because I don't want to make the user press the Return or Enter key. I want the changes populated into my list field as soon as the user clicks away onto something else. Is closeField not the right way to do that? I'm also handling returnInField and enterInField, but if that's *all* I handled, it seems like the changes wouldn't get populated into my list field.
Re: Click doesn't register after code selects a line in a list field
Posted: Sat Feb 15, 2025 1:57 pm
by bn
MichaelBluejay wrote: ↑Sat Feb 15, 2025 1:26 pm
I'm using closeField because I don't want to make the user press the Return or Enter key. I want the changes populated into my list field as soon as the user clicks away onto something else. Is closeField not the right way to do that? I'm also handling returnInField and enterInField, but if that's *all* I handled, it seems like the changes wouldn't get populated into my list field.
That comes down to what user interface you have in mind. I think the users are used to apply changes/data entry/searches by using return/enter. Or clicking on a dedicated button.
"CloseField" can be confusing when you imagine the following:
During data entry I am not sure about spelling and see the the word is somewhere on the page, I decide to copy the word from there but my attempt at the entry which is still in the entry field gets applied. Not what I would expect.
In my testing return/enter work as expected without a "closeField" handler with the code I posted above.
It is just an interface question, you decide.
Kind regards
Bernd