|
Forum Index : Microcontroller and PC projects : Problem with GUI HIDE?
| Author | Message | ||||
| seco61 Senior Member Joined: 15/06/2011 Location: AustraliaPosts: 205 |
Hi. I am having an issue with a control not being hidden when I show the page it is located on. While displaying PAGE 1 (the default), I am creating a GUI Displaybox control (6) on PAGE 2 (GUI Setup 2). I am issuing the GUI HIDE command for this control. When I show the page with the PAGE 1,2 command, the control is not hidden... I have tried this on both a Micromite Plus v5.05.02 and an ARMmite H7 v5.05.06. Cut down code below: if mm.device$="Micromite Plus" then ' Definitions for the Micromite Plus LCD Backpack cpu 120 pwm 2,1000,25 elseif mm.device$="ARMmite H7" then ' Definitions for the ARMmite H7 backlight 25 else ? "Device is not a Micromite Plus or ARMmite H7 - Found: "+mm.device$ error "Not a Micromite Plus or ARMmite H7!!" endif InitPages page 1,2 ' subroutine to create display pages sub InitPages cls font 1,2 colour RGB(white) gui setup 1 gui area 1,0,0,155,200 gui area 2,165,0,155,200 gui setup 2 gui area 3,2,198,156,42 gui area 4,162,198,156,42 gui displaybox 5,0,162,210,32,rgb(white) ctrlval(5)="Total: 0.000" gui displaybox 6,220,162,99,32,rgb(white),rgb(red) ctrlval(6)="Disc" gui hide 6 end sub Regards Gerard (vk3cg/vk3grs) |
||||
| KeepIS Guru Joined: 13/10/2014 Location: AustraliaPosts: 1945 |
I didn't think you could show two pages with the command [code] page 1,2 [/code] Should that not be: [code] Page 1 Page 2 [/code] Of course I could be missing something? Or is this just your cutdown command? I have numerous pages and am hiding/unhiding over a dozen controls on some pages on the fly on the H7 NANO Inverter: Full download - Only Hex Ver 8.1Ks |
||||
| seco61 Senior Member Joined: 15/06/2011 Location: AustraliaPosts: 205 |
Hi. According to the manual: PAGE #n [,#n2, #n3, etc] This will switch the display to show controls that have been assigned (via the GUI SETUP command) to the page numbers specified on the command line (#n, #n2, etc). Any controls that were displayed but are not on the current list of pages will be automatically hidden. Any controls on a page that was displayed on the old screen and is also specified in the new PAGE command will remain unaffected. The default when a program starts running is PAGE 1 and GUI SETUP 1. This means that if these commands are not used the program will run as normal showing all GUI controls that have been defined. See also the GUI SETUP command. Regards Gerard (vk3cg/vk3grs) |
||||
| KeepIS Guru Joined: 13/10/2014 Location: AustraliaPosts: 1945 |
OK, you obviously have a reason to hide/show/manipulate controls from various pages for displaying controls from a number of pages at the same time on screen, hope you get it sorted. I'm more a "kiss" kind of coder as it suites my nature NANO Inverter: Full download - Only Hex Ver 8.1Ks |
||||
| seco61 Senior Member Joined: 15/06/2011 Location: AustraliaPosts: 205 |
Some additional information. The GUI HIDE command does not appear to work when issued while the page the control is on is not active. But the GUI SHOW command works in this case... More sample code: option default none option explicit option base 0 if mm.device$="Micromite Plus" then ' Definitions for the Micromite Plus LCD Backpack cpu 120 pwm 2,1000,25 elseif mm.device$="ARMmite H7" then ' Definitions for the ARMmite H7 backlight 50 else ? "Device is not a Micromite Plus or ARMmite H7 - Found: "+mm.device$ error "Not a Micromite Plus or ARMmite H7!!" endif InitPages page 1 pause 2000 page 2 pause 2000 page 1 pause 2000 page 2 gui hide 6:ctrlval(5)="Page 2 - hidden" pause 2000 page 1 pause 2000 page 2 pause 2000 page 1 gui show 6:ctrlval(5)="Page 2 - showing" pause 2000 page 2 pause 2000 page 1 gui hide 6:ctrlval(5)="Page 2 - hidden" pause 2000 page 2 ' subroutine to create display pages sub InitPages cls font 1,2 colour RGB(white) gui displaybox 1,0,22,210,32,rgb(white) ctrlval(1)="Page 1" gui setup 2 gui displaybox 5,0,162,320,32,rgb(white) gui displaybox 6,0,198,99,32,rgb(white),rgb(red) ctrlval(6)="Disc" gui hide 6:ctrlval(5)="Page 2 - hidden" end sub Regards Gerard (vk3cg/vk3grs) |
||||
| KeepIS Guru Joined: 13/10/2014 Location: AustraliaPosts: 1945 |
This has been the way it has always worked, well for me at least. I assumed that once a Page command - PAGE X - was issued, that all controls would be enabled, even if previously disabled. I have a Page with 25 GUI Buttons and 1/3 of the Buttons occupy the same position as another buttons. Logically I have to issue: A: Page X command - which resets all controls to enabled. B: GUI HIDE ALL Then, depending on the current machine state, enable the required controls. C: GUI SHOW Bx,Bx,Bx,Bx,Bx etc. I have reread Geoff's Manual entry you quoted, but it seems a tad ambiguous to me. However I can see where it would be handy to Enable or Disable controls on a Page prior to switching to the Page. Apology if this is not the behaviour you are enquiring about. Mike. NANO Inverter: Full download - Only Hex Ver 8.1Ks |
||||
| seco61 Senior Member Joined: 15/06/2011 Location: AustraliaPosts: 205 |
Hi. From the Micromite Plus manual (page 40): It is perfectly legal for a program to modify controls on other pages even though they are not displayed at the time. This includes changing the value and colours as well as disabling or hiding them. When the display is switched to their page the controls will be displayed with their new attributes. I have confirmed that the problem only exists with GUI HIDE - GUI SHOW, GUI DISABLE and GUI ENABLE all work when issued for a control that is not on the active page(s). Regards Gerard (vk3cg/vk3grs) |
||||
| KeepIS Guru Joined: 13/10/2014 Location: AustraliaPosts: 1945 |
Yes I should have been more clear, I can (and do) update Control values when the Page is hidden, but I cannot Hide Controls (as in my little example) prior to page switching. Mike. NANO Inverter: Full download - Only Hex Ver 8.1Ks |
||||
| Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3308 |
Thanks Gerard, another bug found! At least they are getting more and more obscure. I will add it to the list and fix it in the next version (probably a beta release). Geoff Geoff Graham - http://geoffg.net |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |