August 22, 2019, 11:50:49 am

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Useful tips part 1

Started by Andy, September 12, 2018, 01:21:07 am

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Andy

September 12, 2018, 01:21:07 am Last Edit: September 12, 2018, 01:25:56 am by Andy
Hi,

I thought it would be nice to post this program as it shows you several things which anyone new to IWB (or maybe not) might find useful.

It is a program that simulates entering a license key.

The program has four edit boxes and an "OK" button, when all edit boxes are filled the "OK" button is enabled.

The following code shows you how to:

1. Make it easy to assign control numbers.
2. Force upper case letters in an edit control.
3. Vertically center text of a static.
4. Limit the number of characters in an edit control.
5. Detect when text has changed in an edit control.
6. How to set the cursor to the end of any existing text.
7. Sub class a control so we can make it do what we want it to do.

The program is designed to only allow letters A to Z, a backspace, and a Tab.

When one edit box has four letters in it, it automatically jumps to the next edit box, when all edit boxes are "full" the "OK" button is enabled.

You can use backspace to delete letters and even move back to the previous edit box.
You can use the Tab button to jump to the next edit box providing that the edit box contains four letters.

I've spent a lot of time commenting the code, so just take your time and have a read - spelling mistakes and all!

Thanks,
Andy.
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

billhsln

Very nice will take some time studying the code.

Bill
When all else fails, get a bigger hammer.

Andy

Thanks Bill!  :)

I just think most of this code is really useful and helpful, and hopefully it explains what is going on in the program and why.
Hope it helps someone.

Andy.


Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

h3kt0r

Thanks for sharing !

;) Really useful.