Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 07:28 11 Nov 2026 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Stumped with GUi Controls

Author Message
OA47

Guru

Joined: 11/04/2012
Location: Australia
Posts: 1064
Posted: 04:38am 07 Nov 2026
Copy link to clipboard 
Print this post

MM.VER=6.0201 on Pi Pico 2 W, when I try to define any one of 4 Buttons I require using GUI BUTTON #1, "EXIT", 0, 280, 90, 30, RGB(RED)  I get GUI reference number #NN is in use. I have defined 80 in memory but it seems whatever number I try I get the ERROR.

Help needed please

OA47
 
mozzie
Guru

Joined: 15/06/2020
Location: Australia
Posts: 505
Posted: 06:50am 07 Nov 2026
Copy link to clipboard 
Print this post

G'day OA47,
Can you let us know which flavour of V6.02.01 you are using?
You mention a Pico2W, are you using the WebMite firmware?

Regards, Lyle.
Edited 2026-11-07 16:51 by mozzie
 
OA47

Guru

Joined: 11/04/2012
Location: Australia
Posts: 1064
Posted: 07:25am 07 Nov 2026
Copy link to clipboard 
Print this post

Lyle thankyou for your help. MM.Device$=WebMiteRP2350A

OA47
 
mozzie
Guru

Joined: 15/06/2020
Location: Australia
Posts: 505
Posted: 07:41am 07 Nov 2026
Copy link to clipboard 
Print this post

OA47,
No worries, can you also let us know your option list, just in case it is display specific?

Just tried:
> list
'prog to test gui controls

Option default integer

GUI button #1,"1",10,10,100,20,RGB(red)
GUI button #2,"2",10,30,100,20,RGB(green)
GUI button #3,"3",10,50,100,20,RGB(yellow)
GUI button #4,"4",10,70,100,20,RGB(blue)

End
>


And it ran ok but I don't have a physical display connected so cannot see the output.

> option list
WebMite MMBasic RP2350A Edition V6.02.01
OPTION SYSTEM SPI GP18,GP19,GP16
OPTION FLASH SIZE 4194304
OPTION COLOURCODE ON
OPTION CPUSPEED (KHz) 200000
OPTION LCDPANEL ILI9488, RLANDSCAPE,GP14,GP13,GP12,GP20
OPTION GUI CONTROLS 32
>


Also tried option lcdpanel virtual_C but that is causing other problems:

> option lcdpanel virtual_C
> edit
PC=>


Might also be worth updating to a later firmware, is there a reason for sticking with V6.02.01?

Regards, Lyle.
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 3428
Posted: 07:49am 07 Nov 2026
Copy link to clipboard 
Print this post

As you have OPTION LCDPANEL ILI9488 try OPTION LCDPANEL DISABLE then:
> option lcdpanel virtual_C

You can then save the image.

I don't have a Pico 2 W but "GUI button #1,"1",10,10,100,20,RGB(red)" works with the virtual LCD on the non-W versions.
 
mozzie
Guru

Joined: 15/06/2020
Location: Australia
Posts: 505
Posted: 07:59am 07 Nov 2026
Copy link to clipboard 
Print this post

G'day Phil99,
oops, should have grabbed the whole command string:
> option lcdpanel disable
> option lcdpanel virtual_C
> edit
PC=> print mm.ver
6.0201
>


Regards, Lyle.
 
OA47

Guru

Joined: 11/04/2012
Location: Australia
Posts: 1064
Posted: 08:23pm 07 Nov 2026
Copy link to clipboard 
Print this post

Here is the OPTION LIST
> option list
WebMite MMBasic RP2350A Edition V6.02.01
OPTION SYSTEM SPI GP18,GP19,GP16
OPTION SYSTEM I2C GP26,GP27
OPTION AUTORUN  ON
OPTION FLASH SIZE 4194304
OPTION COLOURCODE ON
OPTION CPUSPEED (KHz) 200000
OPTION LCDPANEL ILI9488, RLANDSCAPE,GP15,GP14,GP13,GP17
OPTION GUI CONTROLS 80
OPTION WIFI ************, **********, PICO02C1AC7E09D
OPTION TOUCH GP12,GP11
GUI CALIBRATE 0, 169, 166, 1282, 885
OPTION SDCARD GP22
OPTION AUDIO GP2,GP3', ON PWM CHANNEL 1
 
mozzie
Guru

Joined: 15/06/2020
Location: Australia
Posts: 505
Posted: 12:14am 08 Nov 2026
Copy link to clipboard 
Print this post

G'day OA47,
Found a Silicon Chip Pico Backpack with almost the same option list, now with Pico2W fitted.

> option list
WebMite MMBasic RP2350A Edition V6.02.01
OPTION SYSTEM SPI GP18,GP19,GP16
OPTION SYSTEM I2C GP26,GP27
OPTION FLASH SIZE 4194304
OPTION COLOURCODE ON
OPTION CPUSPEED (KHz) 200000
OPTION LCDPANEL ILI9488, RLANDSCAPE,GP14,GP13,GP12,GP20
OPTION GUI CONTROLS 80
OPTION TOUCH GP15,GP17
GUI CALIBRATE 0, 210, 156, 1284, 845
OPTION SDCARD GP21
OPTION AUDIO GP2,GP3', ON PWM CHANNEL 1
>


And this short program to test gui buttons:

> list
'prog to test gui controls

GUI button #1,"ONE",10,10,100,20,RGB(red),RGB(green)
GUI button #2,"TWO",10,30,100,20,RGB(green),RGB(red)
GUI button #3,"THREE",10,50,100,20,RGB(yellow),RGB(blue)
GUI button #4,"FOUR",10,70,100,20,RGB(blue),RGB(yellow)

Do
 For i = 1 To 4
   CtrlVal(i)=1
   Pause 1000
   CtrlVal(i)=0
 Next
Loop While Inkey$=""

End
>


And all working ok. A couple of suggestions:

Try OPTION AUTORUN OFF and without the WIFI network
Reload the firmware with a CLEAR FLASH RP2350 or CLEAR FLASH UNIVERSAL first.
Is it possible there is a different GUI CONTROL with the same #reference number? they all have to be unique.

Hopefully something works.

Regards, Lyle.
 
OA47

Guru

Joined: 11/04/2012
Location: Australia
Posts: 1064
Posted: 12:17am 08 Nov 2026
Copy link to clipboard 
Print this post

Lyle, I have stripped out all other GUI references and turned off the WIFI but still no go. I will reflash the Pico, reload and test again.

OA47

I have cleared the Pico and loaded 6.03 but I still have the same error. Can someone please point me to CLEAR FLASH RP2350 file?
Edited 2026-11-08 10:54 by OA47
 
mozzie
Guru

Joined: 15/06/2020
Location: Australia
Posts: 505
Posted: 02:30am 08 Nov 2026
Copy link to clipboard 
Print this post

OA47,
All 3 versions in ZIP file below, sometimes CLEAR_FLASH_RP2350 works and sometimes CLEAR_FLASH_UNIVERSAL, it may depend on the version of the Pico.

Clear_Flash_ALL.zip

The fact V6.03.?? is giving problems is very strange, however the problem with LCDPANEL VIRTUAL_C seems to be present up to V7 so maybe this is a similar.

Can I also suggest after loading the updated firmware starting with the minimum options, just OPTION SYSTEM SPI, OPTION GUI CONTROLS 10 and OPTION LCDPANEL to see if it works, the program above might be a good first test.

Regards, Lyle.
Edited 2026-11-08 12:37 by mozzie
 
OA47

Guru

Joined: 11/04/2012
Location: Australia
Posts: 1064
Posted: 03:18am 08 Nov 2026
Copy link to clipboard 
Print this post

Lyle, I can run your code with all options loaded, but when I load my code the error returns. I am very confused.

OA47
Confusion averted. I found that GUI code was accessed more than once that explains everything.

Thank you for your help in the diagnosis.
OA47
Edited 2026-11-08 13:26 by OA47
 
mozzie
Guru

Joined: 15/06/2020
Location: Australia
Posts: 505
Posted: 12:05pm 08 Nov 2026
Copy link to clipboard 
Print this post

OA47, good to hear you got it sorted  

Regards, Lyle.
 
Wölfi

Newbie

Joined: 14/10/2026
Location: Germany
Posts: 40
Posted: 01:26pm 08 Nov 2026
Copy link to clipboard 
Print this post

  mozzie said  
All 3 versions in ZIP file below, sometimes CLEAR_FLASH_RP2350 works and sometimes CLEAR_FLASH_UNIVERSAL, it may depend on the version of the Pico.

Clear_Flash_ALL.zip


Thanks from me too.

I hadn’t seen this collection before. But generally, this one has always helped me so far:
https://thebackshed.com/forum/ViewTopic.php?TID=19203&PID=260799#260799#260799
 
OA47

Guru

Joined: 11/04/2012
Location: Australia
Posts: 1064
Posted: 10:27pm 09 Nov 2026
Copy link to clipboard 
Print this post

Back again with another GUI programming issue, I have read Geoffs Advanced graphics pdf many times but I still cant get the brain cells to align. I have defined 4 GUI BUTTONS, the first is displayed on the first screen and when TOUCHED provides the second screen which then displays the other 3 GUI BUTTONS. The 3 GUI BUTTONS react to touch (altering the graphics) but do not launch the interrupt. I have played with GUI PAGE, Disabling and ENABLING the GUI BUTTONS but nothing seems to work. The buttons on the second screen work if I display the second screen first. What am I missing?
OA47
 
OA47

Guru

Joined: 11/04/2012
Location: Australia
Posts: 1064
Posted: 11:01pm 09 Nov 2026
Copy link to clipboard 
Print this post

Duplicated post
Edited 2026-11-10 09:01 by OA47
 
disco4now

Guru

Joined: 18/12/2014
Location: Australia
Posts: 1162
Posted: 12:57am 10 Nov 2026
Copy link to clipboard 
Print this post

Have you got GUI SETUP in the main loop? It should only be used during the initialisation when initially defining the controls. From then on GUI PAGE in the main loop is enough switch to those predefined pages.
F4 H7FotSF4xGT
 
panky

Guru

Joined: 02/10/2012
Location: Australia
Posts: 1142
Posted: 01:40am 10 Nov 2026
Copy link to clipboard 
Print this post

OA47

This program
cbe-43f-470live.bas.zip, the display section of a Caravan Battery Monitor system makes extensive use of GUI elements in a multi page menuing system. It is fairly well commented and was designed to run on a PIC32MX470 with a 7" LCD touch screen.

I think it shows the GUI system well and may be of use to you.

Happy to answer any questions on it.

Doug.
... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it!
 
OA47

Guru

Joined: 11/04/2012
Location: Australia
Posts: 1064
Posted: 01:57am 10 Nov 2026
Copy link to clipboard 
Print this post

  Quote  Have you got GUI SETUP in the main loop?


Gerry, that was the original problem I had when I stated this post, the GUI SETUP was accessed a second time and gave me the error. I have the GUI SETUP before the MAIN LOOP with the other declarations so I do not get the original error. I have even tried defining the GUI BUTTON at the start of a SUB that draws a new screen and DELETING it at the end of the SUB but that did not work.


  Quote  This program
cbe-43f-470live.bas.zip,


Panky, I have had a quick look thru your code but you haven't been able to use GUI BUTTON in that version of MMBasic

OA47
 
disco4now

Guru

Joined: 18/12/2014
Location: Australia
Posts: 1162
Posted: 07:10am 10 Nov 2026
Copy link to clipboard 
Print this post

How are you calling the sub that switches to the second page. If its called from the interrupt of the touch on the first page you need to ensure that the code finishes/returns to that interrupt and lets it complete, otherwise you will never see any other interrupt. The safest way is to set a flag in the first interrupt and then action that flag in the main loop to show the second page. I am not sure what would happen if you hide the first page in its own interrupt, but probably should be avoided.i.e. GUI PAGE #2 would hide Page #1.
F4 H7FotSF4xGT
 
mozzie
Guru

Joined: 15/06/2020
Location: Australia
Posts: 505
Posted: 01:22pm 10 Nov 2026
Copy link to clipboard 
Print this post

G'day OA47,
What version of WebMite did you end up using? the GUI commands have had a few additions and changes in later editions to my knowledge.

These two programs should run on WebMite V6.02.01 onward:
'prog to test gui controls

GUI Interrupt TouchDown
Font 1,2
GUI setup 1
GUI button #1,"ONE",0,0,100,50,RGB(red),RGB(green)
GUI setup 2
GUI button #2,"TWO",0,0,100,50,RGB(green),RGB(red)
GUI button #3,"THREE",0,50,100,50,RGB(yellow),RGB(blue)
GUI button #4,"FOUR",0,100,100,50,RGB(blue),RGB(yellow)

GUI Page 1

Do
 Pause 100
Loop While Inkey$=""

End

Sub TouchDown
 Select Case Touch(ref)
 Case 1:GUI page 2:Text 0,190,"BUTTON 1 PRESSED"
 Case 2:GUI page 1:Text 0,190,"BUTTON 2 PRESSED"
 Case 3:Text 0,190,"BUTTON 3 PRESSED"
 Case 4:Text 0,190,"BUTTON 4 PRESSED"
 End Select
End Sub

'prog to test gui controls

GUI Interrupt TouchDown
Font 1,2
GUI setup 1
GUI button #10,"PAGE",0,0,100,50,RGB(yellow),RGB(red)
GUI Caption #11,"Page 1",100,0,,RGB(red)
GUI setup 2
GUI button #1,"ONE",0,50,100,50,RGB(red),RGB(green)
GUI button #2,"TWO",0,100,100,50,RGB(green),RGB(red)
GUI button #3,"THREE",0,150,100,50,RGB(yellow),RGB(blue)
GUI button #4,"FOUR",0,200,100,50,RGB(blue),RGB(yellow)

GUI Page 1
GPage=1
CtrlVal(11)="PAGE 1"

Do
 Pause 100
Loop While Inkey$=""

End

Sub TouchDown
 Select Case Touch(ref)
 Case 10
   If GPage=1 Then
     GPage=2
     GUI page 1,2
     CtrlVal(11)="PAGE 2"
   Else
     Gpage=1
     GUI page 1
     CtrlVal(11)="PAGE 1"
   EndIf
 Case 1:CtrlVal(11)="BUTTON 1 PRESSED"
 Case 2:CtrlVal(11)="BUTTON 2 PRESSED"
 Case 3:CtrlVal(11)="BUTTON 3 PRESSED"
 Case 4:CtrlVal(11)="BUTTON 4 PRESSED"
 End Select
End Sub


Slightly different ways of doing a similar thing. I too took a fair while to get my head around the way the GUI system works, little programs like this are littered through my system while I got my head around it.

You also shouldn't use TEXT with the GUI commands but I like to live dangerously at times  

Hope this helps.

Regards, Lyle.
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2026