Jump to content

Listbox that just accepts numbers


didierj

Recommended Posts

Basically I want to implement a list, the user can fill with numbers. Seems simple, but...

- The list just accepts number-keystrokes (0...9), system decimal point, <enter> or <tab> to go to the next line.

- The list doesn't accept empty lines

- vertical scrollbars, since the number of elements is unlimited, but I just can display e.g. 5 elements.

- 1 column, n rows

Now the problems I encouter are:

- either I create an array, then the list just accepts number-keys, but implementing the scrollbars and <tab> is a pain!

- or I implement a table, then I can intercept the keystrokes with a "key-press?" event, but how do I find out which is the system decimal point, and how do I detect an empty line?

Has anyone already solved one of the solutions (I would prefer the second, which means much less coding)?

Thanks

Didier

Link to comment

Prehaps try a simople string control (moved just off screen) and a listbox. Set the string control to update while typing and process each keystroke, passing the "result" you want into the listbox. You can read \n for the enter.

I don't know how you would handle tab, since tabbing usually moves the focus. But, I think you can limit focus (but removing all other controls from the tab list via Advanced:Key Navigation:Skip control while tabbing ), and perhaps in 7+ you can programatically control focus.

Using String:NumberToFractionalString will return a number with the system decimal point in the string. Parse this to get the current system decimal point. eg wire 7.0 as a constant and you should get 7,0 back.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.