In the last post a menu was added to the Keno simulation program and the BASIC coded to end the program was added into the callback function for the exit button. Next the screen for the program will be built using labels, rectangles, buttons, progress bar, check box and number boxes. These screen objects (or view in Wee GUI vernacular). There are two kinds of objects, those that are just displayed and others that have some action associated. In this post the static or display objects will be discussed and the action oriented ones in the next post.
Labels are objects that can be used to place text on the screen in the application. They are added to the project by using the Objects Definition group of controls in the bottom left corner of the Retro GUI IDE window. The different objects required different data based on which is selected, and this changes the rest of the controls in this group. To define a Label object the X,Y position relative to the window and the text to display is required.
To add the KENO title to the left side of the game screen above the numbers that will comprise the board the X value is set to 13, Y to 3 and the text KENO is typed into the Caption text box. Once the Add button is clicked the label is stored in the objects list box, as seen below the first entry of “LABEL : KENO”.
When the project is run and the code pasted into the emulator (see earlier post) we see that the label has been added to the screen.
Reviewing from the previous post a block of BASIC code is set up at 60300 and this is where the code for the static ojbects is added. This will allow the programmer to call to this block if in his/her program they need to redraw the static objects. Line 60302 has been inserted to this block as a result of the additon of the KENO label. It should be noted that a “Label” is Retro GUI IDE object type, which is created by two WeeGUI commands &CURSR and &PRINT. The &CURSR(14,3) places the local cursor to the position of column 14 and row 13 relative to our main window view. The local cursor is relative to the upper left corner of the view which is 0,0 and where the Clear #’s button is located.
To build out the rest of the KENO play screen, which is 8 lines of ten numbers (1-80) these are entered as eight labels starting on row 5. The pictures below show what this looks like in the IDE, the BASIC code that is automatically generated and the the screen when the program is run.
Next a rectangle (box) will be added to frame the main play screen. When the rectangle object is selected there is some additional needed, width and height. To frame the labels already added it will be placed at 2,4 with a wdith of 34 characters and height of 10. Here is a short video to show how this works. The rectange is a WeeGUI object and the single command &DRAW(2,4,34,10) in line 60311 creates the box on the screen.
As the program builds it wil be easy to redraw the static parts of the screen with gosub 60300.
The next post will begin to cover the action focuses objects.