| Posted: 11:08pm 06 Aug 2019 |
Copy link to clipboard |
 Print this post |
|
G'day All I'm fiddling with code optimizing and generally trying to improve the 'flow' of my code. Just to push it a little further, I'm trying arrays of GUI controls, with local declarations for the GUI elements... Here's what I've come up with -
sub GuiSetup gui setup 1 'Show the main options frame local OptionsFrame=16 Font 4 gui frame OptionsFrame," Change Time/Date ",1,50,790,200,rgb(Cyan) gui setup 2 'Show the Time/Date radio buttons local X=50, Y=100 'Declare the initial X,Y coordinates Local TimeRadioID(5)=(10,11,12,13,14,15) 'Setup the Array identifiers Local String TimeRadioStr$(5) Length 6=("Hour","Minute","Second","Day","Month","Year") 'Assign the names to the buttons font 4 for i = 0 to 5 'Loop through the array gui radio TimeRadioID(i), TimeRadioStr$(i), X,Y,15,RGB(cyan) 'Add the radio buttons X=X+180 'Next X position If i=2 then 'First 3 radios are done X=50 'Reset the X position Y=150 'New Y position end if 'Reset complete next i 'Do the next item in the array ctrlval(TimeRadioID(0))=1 gui setup 3'Show the Increase/Decrease arrows Local IncreaseButton=17, DecreaseButton=18 Font 8 'Change to the ARROW font gui button IncreaseButton, " ", 700,75,66,66,RGB(green)'Space is the UP arrow gui button DecreaseButton, "!", 700,160,66,66,RGB(green)'! is the DOWN arrow end sub
(Note: This is only the GUI SETUP in my coding, so it won't actually do anything if you cut and paste to try it out)
This was much easier and painless than I thought it would be (testament to MM Basic!) but I'm now wondering if putting LOCAL declarations for the GUI elements in the GUI SETUP is somehow going to trip me over further down the track? So far, I haven't had any problems!
Any thoughts would be appreciated  John |