[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ValueBox issue


Hi Bruce

The ValueBox.class-function 

Private Function Value_Read() As Variant
    ..... 
    Case {Currency}
        Return Val(Trim(Replace($hMaskBox.Text, GetCurrency(), "")))
    .....

seems to be one problem for getting a void Value-property. If $hMaskBox.Text provides strings like ".   .123,00 €" resp. "£ ,   ,123.00" the Val-function returns Null because of leading thousands-separators. After I stripped the _expression_ down with

    Dim sCurrVal As String

    Case {Currency}
       For i = 1 To Len($hMaskBox.Text)                 'Remove all leading characters
         If IsNumber(Mid$($hMaskBox.Text, i, 1)) Then 
           sCurrVal = Right$($hMaskBox.Text, -i + 1)
           Break
         Endif
       Next
       sCurrVal = Replace(sCurrVal, GetCurrency(), "")  'Remove the currency character
       Return Val(Trim(sCurrVal))

the value property returned something usable. However, this can hardly be a fix.

Claus

  

Am 09.08.26 um 11:21 schrieb Bruce Steers:
A side note:
Another bug for me is the ValueBox does not show anything at all unless it has focus, only then the text shows, (on both qt and gtk)

Respects
BruceS

On Sun, 9 Aug 2026 at 09:25, Bruce Steers <bsteers4@xxxxxxxxx> wrote:
I had a look at the code and tried to debug.
Got as far as the ValueBox Value_Write method setting Super.Text seems to fail (debugger does not show Me.Text has changed)

line 268 of ValueBox.Value_Write is this...
      $hMaskBox.Text = Format(Value, "$########0.00")

That goes to the MaskBox.Text_Write method and seems to not work as required.
the condition being met at line 940 "If $sMaskOrg Then"

My knowledge of using Format() and what exactly the MaskBox Text_Write method is doing has hit a wall.

This will require a Benoit level of understanding :)

Respects
BruceS



On Sat, 8 Aug 2026, 15:37 Charlie Ogier, <charlie@xxxxxxxxxx> wrote:
Hi,

I am having an issue with ValueBox when used for currency, extra commas appear and the contents are returned as NULL . Is this me or is it a bug?

Thanks,

Charlie 

The following code produces: - 



' Gambas class file

Private ValueBox1 As ValueBox

Public Sub Form_Open()

  With Me
    .Arrangement = Arrange.Vertical
    .Padding = 5
    .H = 60
    .W = 200
  End With
  
  With ValueBox1 = New ValueBox(Me) As "ValueBox1"
    .H = 35
    .Type = ValueBox.Currency
    .Text = "99.00"
  End With

End

******************************
SYSTEM INFORMATION

[System]
Gambas=3.22.0 785d493 (master)
OperatingSystem=Linux
Distribution=Linux Mint 22.3 (Zena)
Kernel=6.8.0-137-generic
Architecture=x86_64
Cores=8
Memory=7811M
Language=en_GB.UTF-8
Platform=x11
Desktop=CINNAMON
DesktopResolution=96
DesktopScale=7
WidgetTheme=mint-y-aqua
Font=Ubuntu,10
DarkTheme=False
[Programs]
dpkg=Debian 'dpkg' package management program version 1.22.6 (amd64).
gcc=gcc (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0
git=git version 2.43.0
msgmerge=msgmerge (GNU gettext-tools) 0.21
rpmbuild=RPM version 4.18.2
[Libraries]
Cairo=libcairo.so.2.11800.0
Curl=libcurl.so.4.8.0
DBus=libdbus-1.so.3.32.4
GDK2=libgdk-x11-2.0.so.0.2400.33
GDK3=libgdk-3.so.0.2409.32
GStreamer=libgstreamer-1.0.so.0.2402.0
GTK+2=libgtk-x11-2.0.so.0.2400.33
GTK+3=libgtk-3.so.0.2409.32
OpenGL=libGL.so.1.7.0
Poppler=libpoppler.so.134.0.0
QT5=libQt5Core.so.5.15.13
QT6=libQt6Core.so.6.4.2
RSvg=librsvg-2.so.2.50.0
SDL=libSDL2-2.0.so.0.3000.0
SQLite3=libsqlite3.so.0.8.6
[Environment]
CINNAMON_VERSION=6.6.9
CLUTTER_IM_MODULE=ibus
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
DESKTOP_SESSION=cinnamon
DISPLAY=:0
GB_GUI=gb.gtk3
GDMSESSION=cinnamon
GDM_LANG=en_GB
GIO_LAUNCHED_DESKTOP_FILE=/usr/share/applications/cinnamon.desktop
GIO_LAUNCHED_DESKTOP_FILE_PID=1928
GJS_DEBUG_OUTPUT=stderr
GJS_DEBUG_TOPICS=JS ERROR;JS LOG
GNOME_DESKTOP_SESSION_ID=this-is-deprecated
GPG_AGENT_INFO=/run/user/1000/gnupg/S.gpg-agent:0:1
GTK3_MODULES=xapp-gtk3-module
GTK_IM_MODULE=ibus
GTK_MODULES=gail:atk-bridge
HOME=<home>
LANG=en_GB.UTF-8
LANGUAGE=en_GB.UTF-8
LOGNAME=<user>
PATH=<home>/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
PWD=<home>
QT_ACCESSIBILITY=1
QT_IM_MODULE=ibus
QT_IM_MODULES=wayland;ibus
QT_LOGGING_RULES=*.debug=false
SESSION_MANAGER=local/<hostname>:@/tmp/.ICE-unix/1570,unix/<hostname>:/tmp/.ICE-unix/1570
SHELL=/bin/bash
SHLVL=0
SSH_AUTH_SOCK=/run/user/1000/keyring/ssh
TZ=:/etc/localtime
USER=<user>
XAUTHORITY=<home>/.Xauthority
XDG_CONFIG_DIRS=/etc/xdg/xdg-cinnamon:/etc/xdg
XDG_CURRENT_DESKTOP=X-Cinnamon
XDG_DATA_DIRS=/usr/share/cinnamon:<home>/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share
XDG_GREETER_DATA_DIR=/var/lib/lightdm-data/<user>
XDG_RUNTIME_DIR=/run/user/1000
XDG_SEAT=seat0
XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
XDG_SESSION_CLASS=user
XDG_SESSION_DESKTOP=cinnamon
XDG_SESSION_ID=c2
XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0
XDG_SESSION_TYPE=x11
XDG_VTNR=7
XMODIFIERS=@im=ibus


 

References:
ValueBox issueCharlie Ogier <charlie@xxxxxxxxxx>
Re: ValueBox issueBruce Steers <bsteers4@xxxxxxxxx>
Re: ValueBox issueBruce Steers <bsteers4@xxxxxxxxx>