Next the menu is added to the program. WeeGUI doesn’t have a menu view or control, so it is built into the code building engine of Retro GUI IDE. The menu bar consists of a set of buttons placed in series across the top of the screen. More could fit in theory, but remember WeeGUI only allows for 16 views.
To add the menu check box must be clicked, which will make visible the menu setup group. There are three buttons to add, rename and remove menu items. The picture below shows what the IDE would look like after Clear #’s item was added and Play is currently being added.
Adding the rest of the menu options, Demo, Help and Quit looks results in the IDE state below
Then pressing play to load and run the program (with a SHIFT-INSERT to paste into the emulator) provides this output, which one can scroll through the buttons with <TAB> and <Escape>. Selecting a buttton will toggle the button graphic to inverse, but of course will not do anything yet.
Now let’s look at the code that Retro GUI IDE created to make this menu. The first picture below shows a block of code called out in the orange box. The lines 60020 to 60024 create the buttons. Each button call has six parameters that are passed, the view id, followed byt the x, y coordinates with the current view, the width of the button, the callback subroutine line number and finally the text inside the button. The callback subroutine line number is the line line number that is called when the button is pressed. The callback line number is alway the same in every program based on the view ID. The line number is 10000 + 1000*ID. So button with the ID 5, the “exit” button has a callback line number of 15000.
There five sets of REM and RETURN statements, one each at 11000, 12000, 13000, 14000, and 15000 each one is for the buttons to set up blank callback subroutines. We will see how to use the Scratch Pad to write code to go inside these callback templates. (Note below that some code has been added for the Exit button, let’s look and see how that is done)
In the Callback Scratch Pad one types in their own code. In this case for the Quit button lines 15010-15040 are added. The &EXIT command shuts down WeeGUI and leaves puts the computer in a stable state and the HOME and END clear the screen and end the program. When the Play button in the IDE is pressed the code in the scratch pad is appended to the code generated from the IDE. When the project is saved the IDE information is saved in a file with a .RCI extension, and the code in the scratchpad is saved in a file with .SCP extension. Both have the project name as the file name. Both are loaded when the project is loaded into the Retro GUI IDE.
The next post will cover adding additional objects (or views in WeeGUI terminology) to the application.