Penso che questo codice dovrebbe funzionare anche in Gambas2:
' Gambas class file
Private $hFont As Font
Private hText As TextBox
Private hSpin As SpinBox
Private oPanel As Panel
Public Sub Form_Open()
oPanel = New Panel(Me)
oPanel.X = 50
oPanel.Y = 50
oPanel.W = 120
oPanel.H = 32
oPanel.Arrangement = Arrange.Horizontal
hText = New TextBox(oPanel)
hText.Expand = True
'hText.Font = Font["Ubuntu,bold,24"]
hSpin = New SpinBox(oPanel) As "SpinBox1"
hSpin.W = 16
hSpin.MaxValue = 100
hSpin.MinValue = -100
$hFont = hText.Font
hText.Text = hSpin.Text
'oPanel.Width = $hFont.TextWidth(hText.Text) + 24
If $hFont.TextHeight(hText.Text) > 32 Then oPanel.Height = $hFont.TextHeight(hText.Text)
End
Public Sub SpinBox1_Change()
hText.Text = hSpin.Text
'oPanel.Width = $hFont.TextWidth(htext.Text) + 24
End
Naturalmente lo devi adattare il tuo codice che tramuta l'intero in numero a virgola mobile.
Sappimi dire se funziona
:ciao: