BBC BASIC for Windows
« help with restricting inputs »
Welcome Guest. Please Login or Register. Apr 5th, 2018, 10:57pm
ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018. Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.
If you require a dump of the post on your message board, please come to the support board and request it.
help with restricting inputs
« Thread started on: Nov 29th, 2011, 2:14pm »
Hi,
Probably a stoopid noob question, but I've been trying to create a simple invoice entry table and can't seem to find how to restrict the number of characters a user can enter at an input prompt, so that their input doesn't end up moving into the next column.
Is there a way to manage this?
Thanks in advance,
Ben
« Last Edit: Nov 29th, 2011, 2:15pm by malladinben »
Probably a stoopid noob question, but I've been trying to create a simple invoice entry table and can't seem to find how to restrict the number of characters a user can enter at an input prompt, so that their input doesn't end up moving into the next column.
If your input is by means of a dialogue box or edit box (which is the way most modern programs work) you can limit the number of characters that can be entered by sending the EM_LIMITTEXT message:
If entry is by means of an 'old fashioned' method such as an INPUT statement you could write your own custom replacement, with a built-in limit, by adapting the FNinput function in the NOWAIT library:
Other possibilities which come to mind are to provide a separate input field, which is then transferred to the correct place in the table like a spreadsheet (see the supplied example program SHEET.BBC) or to allow the entry to extend too far and then overwrite it afterwards.
As a final suggestion you could dynamically change the text viewport, which would cause the input to wrap onto the next row rather than to overwrite the next column.
Using a proper Windows GUI, such as an Edit Box or a List View is probably the best method, but it hardly meets your requirement of being simple!