[Gambas-user] Problem with lcdnumber - don't show decimal point
jj at ...1636...
jj at ...1636...
Fri Feb 9 09:00:03 CET 2007
Perfect Steve! Thank you!
Example code:
# Gambas Form File 1.0
{ Form Form
MoveScaled(0,0,31,31)
'Move(0,0,341,341)
Text = ("")
{ Button1 Button botones
Name = "Button1"
MoveScaled(5,5,5,3)
'Move(55,55,55,33)
Tag = "1"
Text = ("1")
}
{ Button2 Button botones
Name = "Button2"
MoveScaled(11,5,6,3)
'Move(121,55,66,33)
Tag = "2"
Text = ("2")
}
{ Button3 Button botones
Name = "Button3"
MoveScaled(18,5,6,3)
'Move(198,55,66,33)
Tag = "3"
Text = ("3")
}
{ Button4 Button botones
Name = "Button4"
MoveScaled(5,9,5,3)
'Move(55,99,55,33)
Tag = "4"
Text = ("4")
}
{ Button5 Button botones
Name = "Button5"
MoveScaled(11,9,6,3)
'Move(121,99,66,33)
Tag = "5"
Text = ("5")
}
{ Button6 Button botones
Name = "Button6"
MoveScaled(18,9,6,3)
'Move(198,99,66,33)
Tag = "6"
Text = ("6")
}
{ Button7 Button botones
Name = "Button7"
MoveScaled(5,13,5,3)
'Move(55,143,55,33)
Tag = "c"
Text = ("c")
}
{ Button9 Button botones
Name = "Button9"
MoveScaled(18,13,6,3)
'Move(198,143,66,33)
Tag = "."
Text = (".")
}
{ display LCDNumber
MoveScaled(5,17,19,8)
'Move(55,187,209,88)
Background = &HD0D0D0&
Foreground = &HFFFFFF&
Digits = 10
SmallDecimalPoint = True
}
}
The class:
' Gambas class file
PRIVATE mTPVString AS String
PUBLIC SUB _new()
END
PUBLIC SUB Form_Open()
END
PUBLIC SUB botones_Click()
SELECT CASE LAST.tag
CASE "0" TO "9"
IF Len(mTPVString) + Len(LAST.tag) < 10 THEN
mTPVString = mTPVString & LAST.tag
display.Value = CFloat(mTPVString)
END IF
CASE "c"
display.value = "0"
mTPVString = ""
CASE "."
IF (InStr(CString(display.Value), ".") = 0) THEN
mTPVString = mTPVString & "."
END IF
END SELECT
END
More information about the User
mailing list