Computer Science Canada

[SOURCE] GUI Keypad for number entry into a program

Author:  the_short1 [ Sat Mar 27, 2004 12:53 am ]
Post subject:  [SOURCE] GUI Keypad for number entry into a program

here it is... a key pad so users can enter a number using GUI's.. not very complicated but is good for beginers..
also if you add a couple more buttons it becomes a calculator...

you can store the string number into an interger variable using

var anumber : int
anumber := strint (nums)

i have it just to display that amount using strint

Please post any comments, they are really apreciated.... also if you need help and want to add some more buttons to it.. i can help ya, or just post to tell me waht ur going to be making... !!!

Author:  Delos [ Sun Mar 28, 2004 11:19 am ]
Post subject: 

Hehe...not bad.

But not quite up to your standard either.

Change those GUI.CreateButton's to GUI.CreateButtonFull's and add some keyboard shortcuts to it.

I mean, we all know that onscreen keypads look nice, but there's no way anyone is going to click out a large number. Plus, having both keyboard/mouse options makes it more versitle.

Author:  the_short1 [ Sun Mar 28, 2004 11:32 am ]
Post subject: 

i said it was simplke for beginers... but having the button key shortcuts would kick.... ill get on it later... thx delos..

i just made this cuz i was bored and its cooler then having to imput by hand... and i will be using it later for a program of mine...

Author:  guruguru [ Mon Mar 29, 2004 2:56 pm ]
Post subject: 

It looks as if you could compress the whole program into a couples less lines... as in, make all the buttons into an array; somehow make one procedure that tests if any button has been pressed...

BTW: A get this error and I'm wondering how to fix it (relates to making the buttons into an array.

If I did...
code:

var buttons : array 1 .. * of int := init (GUI.CreateButton (5, 5, 71, "0", btn0))

The error appears:
Quote:

Compile time expression expected

Why does that happen and how do i fix it???

Author:  the_short1 [ Mon Mar 29, 2004 3:44 pm ]
Post subject: 

did u make a proc called btn0...
.
.also... the big size down would be on all the procs....
.
but ya see i asked the master module maker delos to help me make it so u can just import it into ur program very easily.... so its being updated while we speak... using import vitKeyboard then to make the keyboard apear u just have to call
vitKeyboard.main,.....

folr that error.... hmmm.... what is the start in the array declaration....

make it an acuall number and try it again.... and if taht dont help... remove the init... i dont think u acually need it...

Author:  guruguru [ Mon Mar 29, 2004 4:08 pm ]
Post subject: 

The reason I used a '*' is so that I can have a different number of buttons without having to change it every time I change the number of buttons. When I do use '*', you have to initialize all the values or it yells at you Shocked . So ya, you gotta use init... Thx neways.

Anybody know why that happens (maybe I should make a new thread... Confused )


: