panky
 Guru
 Joined: 02/10/2012 Location: AustraliaPosts: 1116 |
| Posted: 11:21pm 04 Apr 2018 |
Copy link to clipboard |
 Print this post |
|
In playing around with DisplayBox, I came across an anomoly (don't think it's a bug, just a limitation).
In the program below, I create 5 DisplayBox's. One is a background (limited to just a strip on the left of the screen to show the issue), a heading box, 2 test boxes and a box at the bottom to go back to a previous screen.
The 2 test boxes and the back box are all overlayed with the GUI Area command to make them touch sensitive.
I initially clear the screen to white with the CLS RGB(WHITE) command.
I then set up the other boxes in order with the background box being at the lowest layer.
Touching either of the 2 test boxes hides the other using GUI HIDE, then touching the back box at the bottom restores both test boxes.
If you run the program, you will see that when you hide a DisplayBox, it knocks out the normal screen colour (set with CLS RGB(white) to black except for the area which is defined by the background box.
In short, when you HIDE a DisplayBox you get a black box in its place. The workaround is to create a full screen DisplayBox with the background colour of your choice.
panky.
' GUI Test Code Option explicit Option base 1 CPU 80 ' Define constants for gui controls const BB_1A = 3 ' back button area Const BV_Area = 5 ' battery volts selection area const BA_Area = 6 ' battery amps selection area const BGround_Box = 8 ' full screen background Const Head_Box = 20 ' heading Const BV_Box = 22 ' battery voltage box const BA_Box = 23 ' battery current box const BB_1 = 25 ' back box 'Define variables - anything will do to test dim BVolts = 12.8 dim BAmps = 5.5 dim BV$ = "12.78" dim BA$ = "5.4" dim ActivePage = 1 'default to main page dim ReEnter = 0 cls rgb(white) ' clear screen to white '****************************************************** ' Start of main code - initialise variables and ' other set up routines. ' initialise graphics GUI displaybox BGround_Box,1,1,80,480,RGB(white),RGB(white) ' to show problem, the background box is limited to a strip ' on the left Font 3,2 GUI displaybox Head_Box,1,1,797,60,RGB(black),RGB(white) font 4 GUI Displaybox BV_Box,1,180,797,60,RGB(black),RGB(magenta) GUI Displaybox BA_Box,1,250,797,60,RGB(black),RGB(yellow) font 1,4 GUI Displaybox BB_1,1,420,80,60,RGB(black),RGB(white) GUI area BV_Area,1,180,797,60 ' GUI area BA_Area,1,250,797,60 ' GUI area BB_1A,1,420,80,60 ' the back button
' preset some display boxes ctrlval(BB_1) = "<"
' set up injterrupt routines GUI interrupt TouchDown ' touchup not used
' preset some variables ActivePage = 1 ReEnter = 1 Main: do Do loop while ReEnter = 0 BV$ = "Battery~Volts = "+str$(BVolts)+"V" BA$ = "Battery Amps = "+str$(BAmps)+"A" If ActivePage = 1 then gui show BGround_Box,Head_Box,BV_Box,BA_Box gui show BV_Area,BA_Area CtrlVal(Head_Box) = "Test GUI DisplayBox Overlay" CtrlVal(BV_Box) = BV$ CtrlVal(BA_Box) = BA$ elseif ActivePage = 2 then gui hide Head_Box,BA_Box,BA_Area gui show BGround_Box,BV_Box,BB_1,BB_1A gui fcolour rgb(black),Head_Box gui bcolour rgb(white),Head_Box CtrlVal(Head_Box) = "Battery Voltage" gui fcolour rgb(black),Head_Box gui bcolour rgb(magenta),BV_Box CtrlVal(BV_Box) = BV$ CtrlVal(BA_Box) = BA$ elseif ActivePage = 3 then gui hide BV_Box,BV_Area gui show BGround_Box,Head_Box,BA_Box,BB_1,BB_1A gui fcolour rgb(black),Head_Box gui bcolour rgb(white),Head_Box CtrlVal(Head_Box) = "Battery Current" gui fcolour rgb(black),Head_Box gui bcolour rgb(yellow),BA_Box CtrlVal(BV_Box) = BV$ CtrlVal(BA_Box) = BA$ endif ReEnter = 0 Loop
' ********************************************************** ' Interrupt service routines Sub TouchDown Select Case Touch(REF) Case BV_Area ReEnter = 1 ActivePage = 2 Print "BV Touch detected " Case BA_Area ReEnter = 1 ActivePage = 3 Print "BA Touch detected " Case BB_1A ReEnter = 1 ActivePage = 1 Print "Back button Touch detected " Case Else ReEnter = 0 Print "?? Touch detected " End Select End Sub
... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it! |