INEDIT CURSPOS

Ideas for improvement
Post Reply
User avatar
Dutchman
Posts: 148
Joined: Tue Aug 06, 2019 4:47 pm
Location: Netherlands

INEDIT CURSPOS

Post by Dutchman » Fri Sep 13, 2019 11:37 am

If something has been changed in an edit field, this can only be noticed with 'INEDIT CHANGED' if the user has closed with 'Enter'. This can lead to misunderstandings, such as in the following example from the Examples folder:
.
multiplier screen shot.JPG
multiplier screen shot.JPG (19.25 KiB) Viewed 216 times
.
This can be made better if the presence of the cursor can be detected. For example:
INEDIT CURSPOS k
Returns the position of the cursor in the edit field with the object index k. The position equals the number of characters before the cursor, including spaces. If zero then the cursor is on the left side of the field. If the return value is -1 then the cursor is not in field k.
It is still a long way to go

User avatar
kibernetik
Site Admin
Posts: 131
Joined: Tue Aug 06, 2019 3:03 pm

Re: INEDIT CURSPOS

Post by kibernetik » Fri Sep 13, 2019 3:41 pm

Ok, and how this function can help?

User avatar
Dutchman
Posts: 148
Joined: Tue Aug 06, 2019 4:47 pm
Location: Netherlands

Re: INEDIT CURSPOS

Post by Dutchman » Fri Sep 13, 2019 7:03 pm

In this example the result field can be cleared as soon as the cursor is placed in the other fields and then, after changes by the user, as soon as the cursor is no longer present in that field then the content can be read and the correct result given.
In this way there is no need to give "Enter"
In SmartBASIC this method was used in the program iConvert.
It is still a long way to go

User avatar
kibernetik
Site Admin
Posts: 131
Joined: Tue Aug 06, 2019 3:03 pm

Re: INEDIT CURSPOS

Post by kibernetik » Fri Sep 13, 2019 7:17 pm

Dutchman wrote:
Fri Sep 13, 2019 7:03 pm
... after changes by the user, as soon as the cursor is no longer present in that field then the content can be read and the correct result given.
In this way there is no need to give "Enter"
There are 3 ways to validate a text input:
- to place cursor into another text field;
- to press Tab;
- to press Enter.

Post Reply