Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 18:29 11 Jul 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 : MMBasic V6.03.00 release candidates

     Page 31 of 31    
Author Message
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 5975
Posted: 09:04am 29 Jun 2026
Copy link to clipboard 
Print this post

  dddns said  Hello Volhout,

I tried that with Blit slots using Blit read/load/write which is very fast like Framebuffer copy


Thanks, works great....

This ... is coming for Game*Mite (and any other ILI9341 LCD equiped mite).



Volhout
PicomiteVGA PETSCII ROBOTS
 
mozzie
Guru

Joined: 15/06/2020
Location: Australia
Posts: 400
Posted: 12:11pm 29 Jun 2026
Copy link to clipboard 
Print this post

Hi Peter,
Thanks for the clarification, on reflection it makes sense so error messages etc are not lost when the screen updates.

Also my apologies, I had convinced myself earlier versions waited for the CR/LF before clearing the LCD, possibly confusing the action of PRINT@() with the TEXT command. Testing has confirmed it was always this way. (As far back as V6.00.01)
Sorry for any confusion.

Regards, Lyle.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 11603
Posted: 04:31pm 29 Jun 2026
Copy link to clipboard 
Print this post

I decided to go with one more release candidate as I have added a couple of things
V6.03.00RC26

PicoMiteRP2040V6.03.00RC26.zip
PicoMiteRP2350V6.03.00RC26a.zip
PicoMiteRP2350V6.03.00RC26b.zip

Mod to list pins to switch to font 7 if the display is <=40 chars wide

WebMite RP2040 now supports TLS. Note this uses up to 40K of ram while making the connection so defer setting up large arrays until after the connection is established

New GUI commands
GUI LISTBOX and GUI SLIDER

  Quote  
`LISTBOX` and `SLIDER` are two advanced GUI controls for the PicoMite family,
adding to the existing set (`BUTTON`, `SWITCH`, `RADIO`, `CHECKBOX`, `LED`,
`SPINBOX`, `FRAME`, `NUMBERBOX`, `TEXTBOX`, `FORMATBOX`, `DISPLAYBOX`,
`CAPTION`, `AREA`, `GAUGE`, `BARGAUGE`). They fill two gaps in that set:

- **`LISTBOX`** — selecting one item from a list that can be long and/or change
 at run time. A collapsed control shows the current selection; tapping it opens
 a modal pop-up that scrolls when there are more items than fit on screen.
- **`SLIDER`** — entering a continuous analog value by dragging a finger along a
 track, the natural touch-screen counterpart of the read-only `GAUGE` and
 `BARGAUGE`.

Both are created with the `GUI` command and read or written with the `CtrlVal`
command and function, exactly like every other control. They require touch (a
resistive or capacitive panel, or a USB/Bluetooth mouse) and a display capable
of GUI controls, and `OPTION GUI CONTROLS nn` must be set so the firmware reserves
storage for the controls.

> **Prerequisite:** set the maximum number of controls once (it is stored in
> flash and survives a reboot), e.g. `OPTION GUI CONTROLS 20`.

---

## GUI LISTBOX

```
GUI LISTBOX #ref, array$(), x, y, w, h [, fc] [, bc] [, maxrows]
```

Creates a list-selection control. The control itself is drawn as a single
collapsed box (similar in appearance to a `DISPLAYBOX`) showing the currently
selected item, with a small down-pointing marker on the right. Touching the box
opens a pop-up list; touching an item selects it and closes the pop-up.

| Parameter   | Description |
|-------------|-------------|
| `#ref`      | Control reference number (1 … `OPTION CONTROLS` − 1) |
| `array$()`  | A one-dimensional string array holding the list items (see **Array binding** below) |
| `x, y`      | Top-left corner of the collapsed control |
| `w, h`      | Width and height of the collapsed control |
| `fc`        | Foreground (text and border) colour (default: last colour used) |
| `bc`        | Background colour (default: last colour used) |
| `maxrows`   | Optional. Maximum number of list rows the pop-up shows before it scrolls. Default: as many as fit in the available screen space. |

**Example:**
```basic
DIM fruit$(4) LENGTH 16
fruit$(0) = "Apple"  : fruit$(1) = "Banana" : fruit$(2) = "Cherry"
fruit$(3) = "Date"   : fruit$(4) = "Elderberry"

GUI LISTBOX #1, fruit$(), 40, 30, 200, 28, RGB(WHITE), RGB(BLUE)
```

### Array binding

The list contents are bound **live** to the BASIC string array: the control
reads the array's current contents each time it is drawn, so updating the array
elements and redrawing (for example with `CtrlVal`) updates what the list shows.
No copy is made.

Because the binding is live, **the array must remain in scope for the entire
life of the control**. Declare it at the program (module) level, or as a
`STATIC` array inside a subroutine — never as an ordinary local array that is
destroyed when a subroutine returns. If the bound array goes out of scope while
the control still exists, the behaviour is undefined.

The array may be of any length. The number of items is taken from the array's
dimensions (respecting `OPTION BASE`). Item text longer than the control or
pop-up width is clipped to fit.

### Selecting items and reading the result

The control stores the **0-based index** of the selected item, which you read
with the `CtrlVal` function:

```basic
i = CtrlVal(#1)              ' index of the selected item (-1 if the list is empty)
item$ = fruit$(CtrlVal(#1))  ' the selected text (your program owns the array)
```

> The listbox reports the selection **index**, not the text. To obtain the text,
> index your own array as shown above. This keeps the array under your control.

When the control is created, the selection defaults to item 0 (or −1 if the
array is empty). Set the selection from your program with the `CtrlVal` command;
the value is clamped to the valid range:

```basic
CtrlVal(#1) = 2              ' select "Cherry" and redraw the collapsed control
```

### The pop-up list and scrolling

Touching the collapsed control opens a modal pop-up immediately below it (or
above it, if there is not enough room below). While the pop-up is open the other
controls are greyed and do not respond to touch.

- Touch an item to select it. The pop-up closes, the collapsed control updates,
 and the touch "up" GUI interrupt fires (see **Interrupts**).
- Touch anywhere outside the pop-up to dismiss it without changing the
 selection.

When the list has more items than the pop-up can show (limited by `maxrows`
and/or the screen height), an **up-arrow** and a **down-arrow** appear as the
first and last rows of the pop-up:

- Tap an arrow to scroll one row; hold it for auto-repeat (continuous scroll).
- An arrow is greyed when the list is already at that end.
- When the pop-up opens, it scrolls automatically so that the current selection
 is visible.

The pop-up always fits on screen; on small displays it may show only a few rows
at a time but remains fully scrollable.

### GUI LISTBOX CANCEL

```
GUI LISTBOX CANCEL
```

Closes an open listbox pop-up from your program without changing the selection.
This is the listbox equivalent of `GUI NUMBERBOX CANCEL` / `GUI TEXTBOX CANCEL`.
It has no effect if no listbox pop-up is open.

### Complete example

' Pick an item from a scrollable list
Option Explicit
Dim integer i, lastsel = -2

' Module-level array: stays in scope for the life of the control.
Dim items$(11) Length 20
For i = 0 To 11 : items$(i) = "Item " + Str$(i + 1) : Next i

CLS
GUI LISTBOX    #1, items$(), 40, 30, 200, 26, RGB(white), RGB(blue), 5
GUI DISPLAYBOX #2, 40, 70, 200, 26, RGB(green), RGB(black)
CtrlVal(#2) = items$(CtrlVal(#1))

Do
 If CtrlVal(#1) <> lastsel Then
   lastsel = CtrlVal(#1)
   If lastsel >= 0 Then CtrlVal(#2) = items$(lastsel)
 EndIf
Loop


---

## GUI SLIDER

```
GUI SLIDER #ref, x, y, w, h [, fc] [, bc] [, min] [, max] [, inc]
```

Creates a slider: a draggable thumb on a track for entering a continuous value
by touch.

| Parameter | Description |
|-----------|-------------|
| `#ref`    | Control reference number (1 … `OPTION CONTROLS` − 1) |
| `x, y`    | Top-left corner of the control |
| `w, h`    | Width and height of the control |
| `fc`      | Foreground colour (track fill and thumb) (default: last colour used) |
| `bc`      | Background colour (default: last colour used) |
| `min`     | Optional. Value at the start of the track. Default: 0 |
| `max`     | Optional. Value at the end of the track. Default: 100 |
| `inc`     | Optional. Step size to snap to. Default: 0 (continuous, no snapping) |

### Orientation

The orientation is taken automatically from the control's shape:

- **Wider than tall** → **horizontal**: `min` at the left, `max` at the right.
- **Taller than wide** → **vertical**: `min` at the bottom, `max` at the top.

```basic
GUI SLIDER #1, 40,  40, 220, 30, RGB(CYAN),  RGB(BLACK), 0, 100      ' horizontal
GUI SLIDER #2, 280, 40,  30, 180, RGB(GREEN), RGB(BLACK), 0, 255      ' vertical
```

### Setting and reading the value

Drag the thumb, or simply tap anywhere on the track, to set the value — the
thumb jumps to the touch position and then follows the finger while it is held.
The value tracks continuously during the drag.

Read or set the value with `CtrlVal`, exactly like a `SPINBOX` or `GAUGE`:

```basic
v = CtrlVal(#1)              ' current value (between min and max)
CtrlVal(#1) = 50             ' move the thumb to 50 and redraw
```

Assigned values are clamped to the `min … max` range.

### Snapping with inc

If `inc` is greater than 0, the value snaps to the nearest multiple of `inc`
measured from `min`. For example, `min 0, max 10, inc 1` yields only whole
numbers 0–10; `inc 0` (the default) gives a smooth continuous value.

```basic
GUI SLIDER #3, 40, 110, 220, 30, RGB(YELLOW), RGB(BLACK), 0, 10, 1   ' whole steps 0..10
```

### Complete example


' Three sliders feeding a display box
Option Explicit
Dim string shown = "", s

CLS
GUI SLIDER     #1, 40,  40, 220, 30, RGB(cyan),   RGB(black), 0, 100
GUI SLIDER     #2, 40, 110, 220, 30, RGB(yellow), RGB(black), 0, 10, 1
GUI SLIDER     #3, 280, 40,  30, 180, RGB(green),  RGB(black), 0, 255
GUI DISPLAYBOX #4, 40, 170, 220, 26, RGB(white),  RGB(black)

Do
 s = "A=" + Str$(CtrlVal(#1),0,0) + " B=" + Str$(CtrlVal(#2),0,0) + " C=" + Str$(CtrlVal(#3),0,0)
 If s <> shown Then shown = s : CtrlVal(#4) = s
Loop


---

## Interrupts

Both controls work with the standard GUI touch interrupt set up with:

```
GUI INTERRUPT downsub [, upsub]
```

- **Slider:** the *down* interrupt fires repeatedly while the thumb is being
 dragged, giving live updates; the *up* interrupt fires when the finger is
 lifted.
- **Listbox:** the *up* interrupt fires when an item is selected (the pop-up
 closes). `Touch(LASTREF)` (or testing `CtrlVal` of your controls) identifies
 which control changed.

If no `GUI INTERRUPT` is set, simply poll `CtrlVal(#ref)` in your main loop, as
the examples above do.

---

## Reading and writing controls

| Operation | Listbox | Slider |
|-----------|---------|--------|
| `CtrlVal(#ref)` (function) | Selected item index (0-based, −1 if empty) | Current value (`min … max`) |
| `CtrlVal(#ref) = n` (command) | Set selection (clamped to valid range) | Set value (clamped to `min … max`) |

Both controls also respond to the usual control-management commands:
`GUI DISABLE`, `GUI ENABLE`, `GUI HIDE`, `GUI SHOW`, `GUI DELETE`,
`GUI FCOLOUR`, `GUI BCOLOUR`, and page selection via `GUI PAGE` / `PAGE`.

---

## Notes and limitations

- `OPTION CONTROLS nn` must be set before any GUI control is created.
- A listbox holds a **live pointer** into its bound array; keep the array in
 scope (module-level or `STATIC`) for the life of the control.
- A listbox reports the selection **index**; map it to text via your own array.
- Slider orientation is fixed by the width/height you give at creation; there is
 no separate orientation keyword.
- The slider's *down* interrupt firing continuously during a drag is by design
 (it mirrors the `SPINBOX` auto-repeat). If you only need the final value, act
 on the *up* interrupt or poll after the drag.
- Both controls are sub-keywords of the `GUI` command and add no reserved words
 to MMBasic.

---

## Error messages

| Error | Cause |
|-------|-------|
| `Maximum number of controls not set` | A GUI control command was used before `OPTION CONTROLS nn` was set |
| `GUI reference number #n is in use` | The `#ref` already belongs to another control |
| `Argument n must be a string array` | The second argument to `GUI LISTBOX` is not a 1D string array |
| `Syntax error` | Missing or malformed parameters |
 
JanVolk
Guru

Joined: 28/01/2023
Location: Netherlands
Posts: 384
Posted: 01:28pm 30 Jun 2026
Copy link to clipboard 
Print this post

Is this just me?


> update firmware
PicoMite MMBasic RP2350A V6.03.00RC26
Copyright 2011-2026 Geoff Graham
Copyright 2016-2026 Peter Mather

Formatting the A: drive
> memory
Program:
  0K ( 0%) Program (0 lines)
300K (100%) Free

Saved Variables:
 16K (100%) Free

RAM:
  0K ( 0%) 0 Variables
  0K ( 0%) General
347K (100%) Free
> files
A:/
  <DIR> .
  <DIR> ..
00:00 01-01-2024 4 boot count
2 directories, 1 file, 1822720 bytes free
> option list
PicoMite MMBasic RP2350A V6.03.00RC26
OPTION FLASH SIZE 4194304
OPTION COLOR CODE ON
OPTION CPU SPEED (KHz) 200000
> list pins
[LIBRARY] CLS
Error : Display not configured
>


An update was also done on the Olimex HDMIUSB.
The previous versions (V6.03.00RC23 – V6.03.00RC25) were unstable.
The issue was that spontaneous resets would occur, seemingly resulting in a loss of video signal—almost like an `OPTION RESET` had been triggered.
Sometimes I could fix it blindly by typing `OPTION RESET OLIMEX USB` (Enter) `Y` (Enter), but often I had to re-flash the firmware.
The PicoMiteHDMI MMBasic USB RP2350A Edition V6.03.00RC26 version has been much more stable so far; I haven't experienced any resets yet.
There is occasional jitter in the video signal in `MODE 3`, but everything returned to normal after a power cycle.
This phenomenon occurred a few times but hasn't been reproducible since. I did change `OPTION GUI CONTROLS` from 100 to 50.
I am using an automotive display; for my setup, `OPTION RESOLUTION 1280` and `OPTION DEFAULT MODE 3` provide the best readability.
I also noticed that `OPTION PLATFORM OLIMEX USB` no longer appears in the option list, though it can easily be added.
I also observed that the option disk save "file.opt" is no longer a fixed 896 bytes but is now variable in size and smaller.
I’ll let you know if there are any updates.


> option list
PicoMiteHDMI MMBasic USB RP2350A Edition V6.03.00RC26
OPTION SERIAL CONSOLE COM1,GP0,GP1
OPTION SYSTEM I2C GP20,GP21
OPTION FLASH SIZE 16777216
OPTION COLOURCODE ON
OPTION DEFAULT COLOURS GREEN, BLACK
OPTION MOUSE SENSITIVITY     1.0000
OPTION KEYBOARD US
OPTION HEARTBEAT OFF
OPTION RESOLUTION 1280x720 @ 372000KHz
OPTION DEFAULT MODE 3
OPTION DISPLAY 30, 80
OPTION HDMI PINS  1, 3, 7, 5
OPTION GUI CONTROLS 50
OPTION SDCARD GP22, GP6, GP7, GP4
OPTION AUDIO GP26,GP27', ON PWM CHANNEL 5
OPTION RTC AUTO ENABLE
OPTION MODBUFF ENABLE 192
OPTION F1 help
OPTION F5 list commands
OPTION F6 list functions
OPTION F7 list pins
OPTION F8 option list
OPTION F9 fm


Jan.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 11603
Posted: 02:25pm 30 Jun 2026
Copy link to clipboard 
Print this post

  Quote  Change to OPTION DISK LOAD and OPTION DISK SAVE (Not available in PICOMITEMIN). It now saves/loads a text file with just the options that are different to the RESET condition. This should make it robust across any future builds even if I change the underlying option structure
 
ville56
Guru

Joined: 08/06/2022
Location: Austria
Posts: 547
Posted: 02:33pm 30 Jun 2026
Copy link to clipboard 
Print this post

  Quote  > list pins
[LIBRARY] CLS
Error : Display not configured
>


Yes, CLS without a configured display throws an error. The library code could/should be changed to

if mm.display=1 then CLS
                                                                 
73 de OE1HGA, Gerald
 
mozzie
Guru

Joined: 15/06/2020
Location: Australia
Posts: 400
Posted: 05:39pm 30 Jun 2026
Copy link to clipboard 
Print this post

G'day,
Spent a bit of time playing around with different versions of the "list pins" code originally supplied by Peter, this is the latest version and seems to work on everything tested so far:

No Display
VGA / HDMI in different modes
ILI9341 / ILI9488 / ST7798 / ST7789 : Landscape / Portrait, Console / NoConsole, Scroll / NoScroll

This has been saved to the Library:
' sub to list pins
Sub ListPins
Local _q%
if mm.info$(LCDPANEL)<>"" then CLS
For _q%=0 To MM.Info(max gp)
 Print "GP"+Str$(_q%)+Choice(_q%<10,"  "," ");
 Print LEFT$(Str$(MM.Info(pinno "GP"+Str$(_q%)))+"  ",3);
 Print LEFT$(MM.Info(pin MM.Info(pinno "GP"+Str$(_q%))),mm.width-8)
 If (_q%+1) Mod (MM.HEIGHT-1)=0 And _q%<>0 Then
   Print "Press any key";
   Do
   Loop Until Inkey$<>""
   Print
 EndIf
Next
End Sub


Takes out as much whitespace as possible and aligns the columns on console and display output, also chops off anything that won't fit on the screen width.

Will allow large fonts on narrow displays within sensible (and not so sensible) limits. Will fit font 1 with 40 char width screen, no need for font 7 (I need more powerful glasses for that one)

I use this command quite a bit when messing around with ideas, hopefully someone finds it useful.

Ville56 - MM.Display is a better solution, must have missed that one.
Always learning new things on here  

Regards, Lyle.
Edited 2026-07-01 04:04 by mozzie
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 3316
Posted: 09:48pm 30 Jun 2026
Copy link to clipboard 
Print this post

@JanVolk
Random resets appear to be due to the RUN pin drifting low. Perhaps due to static charge at times of low humidity.

The cure is a 10k pullup resistor to 3V3 and/or 100nF capacitor to Gnd.
If there is no room on your PCB solder to the top of the Pico pins.
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 3316
Posted: 10:39pm 30 Jun 2026
Copy link to clipboard 
Print this post

A workaround for the firmware LIST PINS command on a Pico without a display attached is OPTION LCDPANEL VIRTUAL_M or _C. If you can spare the buffer memory.
> list pins
[LIBRARY] CLS
Error : Display not configured
> library list
>
> OPTION LCDPANEL VIRTUAL_M
> list pins
GP0      1      OFF
GP1      2      OFF
GP2      4      OFF
GP3      5      OFF
...
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 11603
Posted: 07:39am 01 Jul 2026
Copy link to clipboard 
Print this post

Though I'd fixed that. Will do a update to the release. I'll post on that thread when done.
 
Briano
Newbie

Joined: 20/01/2026
Location: Canada
Posts: 15
Posted: 06:17pm 04 Jul 2026
Copy link to clipboard 
Print this post

I'm having problems using STRUCT when there is a largish program in the Library.
I think the problem started with 6.03.00RC0.
I'm using a PicoCalc with a Pico 2W.
The problem occurs with the Website and the non-website versions.

Sample files are attached.

1) Run "abug.bas" with the library empty, and it works fine. A 16 but structure is created

2) Load "ulib2.bas" into the library, then run "abug.bas" and the structure created has size 0, then a heal error occurs.

The ABUG.BAS program doesn't even call and functions in ULIB2.
I have other programs which use the ULIB2 functions and they run fine (but they don't use structures)

I noticed with 6.02.02B6 and earlier, when I do a LIBRARY SAVE it tells me 6692 bytes saved.
With 6.03.00RC0 and beyond, LIBRARY SAVE tells me 7128 bytes saved.

In all cases MM.INFO(HEAP) says there is lots of heap space after the error.

Am I doing something wrong or is this a bug?

Oh...If I have a very small program in the library, there is no problem.

Thank you!

abug.zip
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 5975
Posted: 08:59pm 04 Jul 2026
Copy link to clipboard 
Print this post

The ARC command is not robust
Parameters a1 and a2 must be between 0 and 359, or you get an error RADIANS.

They mut be degrees. Not radians.
They cannot be the same.

Volhout
PicomiteVGA PETSCII ROBOTS
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 11603
Posted: 09:23pm 04 Jul 2026
Copy link to clipboard 
Print this post

  Quote  Parameters a1 and a2 must be between 0 and 359, or you get an error RADIANS.

From the manual
  Quote  Draws an arc of a circle with a given colour and width between two radials
(defined in degrees). Parameters for the ARC command are:
x: X coordinate of centre of arc
y: Y coordinate of centre of arc
r1: inner radius of arc
r2: outer radius of arc - can be omitted if 1 pixel wide
a1: start angle of arc in degrees
a2: end angle of arc in degrees
c: Colour of arc (if omitted it will default to the foreground colour)
Zero degrees is at the 12 o'clock position.


The error is RADIALS not RADIANS
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 5975
Posted: 06:13am 05 Jul 2026
Copy link to clipboard 
Print this post

Peter,

When used as a gauge, you have to prevent that a1 equals a2. Because this is not protected in mmbasic.

Maybe a note in the manual.

Volhout
PicomiteVGA PETSCII ROBOTS
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 11603
Posted: 09:26am 05 Jul 2026
Copy link to clipboard 
Print this post

  Quote  I'm having problems using STRUCT when there is a largish program in the Library.

Are you using the release version? Just tested and I can't replicate - works fine
 
Briano
Newbie

Joined: 20/01/2026
Location: Canada
Posts: 15
Posted: 05:00pm 05 Jul 2026
Copy link to clipboard 
Print this post

  matherp said  
  Quote  I'm having problems using STRUCT when there is a largish program in the Library.

Are you using the release version? Just tested and I can't replicate - works fine


Yes I am. I tried the webmite and non-web versions.
In my testing, I installed a firmware, then tested without setting any options.
6.02.02.B8 worked - Library Save says 6692 bytes saved
6.03.00RC0 failed - Library Save says 7128 bytes saved

With the latest 6.03, how many bytes get saved by LIBRARY SAVE ?
 
     Page 31 of 31    
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