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.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: help with restricting inputs  (Read 283 times)
malladinben
New Member
Image


member is offline

Avatar




PM


Posts: 1
xx 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 » User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: help with restricting inputs
« Reply #1 on: Nov 29th, 2011, 3:01pm »

on Nov 29th, 2011, 2:14pm, malladinben wrote:
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:

http://msdn.microsoft.com/en-us/library/windows/desktop/bb761607.aspx

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:

http://www.bbcbasic.co.uk/bbcwin/manual/bbcwing.html#fninput

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!

Richard.
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls