[Gambas-user] What has happened to ValueBox
Benoît Minisini
gambas at ...1...
Fri Dec 17 18:24:31 CET 2010
> Benoit,
> On the line "Dim txtTemp as Valuebox = LAST" I get an error "Expecting
> valuebox got textbox" But the last control was a valuebox.
> It works if I change the code to "Dim txtTemp as Textbox" even though it
> is not a textbox firing the event.
OK I see!
The ValueBox of Gambas 2 inherits TextBox, and so when it raises events, LAST
is always a ValueBox.
The current ValueBox of Gambas 3 is actually a compound control (it inherits
UserControl), with a edit control inside that can be a TextBox or another
control. Events raised by the edit control are propagated as if the ValueBox
raise it. But then LAST is the read TextBox, not the ValueBox.
Moreover, the code of that ValueBox is somewhat dirty. So I plan to rewrite it
differently, and makes it inheriting TextBox again, or find a way to propagate
events and keep LAST to be the ValueBox.
Sorry for the inconvenience. It will disappear when the ValueBox will be
rewritten.
As a workaround, you can check the type of LAST. And when it is a TextBox,
take its parent to get the ValueBox.
Regards,
>
> Then I cannot read the "name" that I assigned to the valuebox.
> txtTemp.Name just returns "Textbox".
>
> I tried replacing the valuebox with a DateBox but this appears to have a
> bug. I can set the value of the DateBox in code and it displays
> correctly. I can pick a value from the DatePicker and it displays
> properly. But it does not have a .Text property to read so I read the
> .Value property and it always returns "00:00:00"
Maybe another bug then. I will investigate.
Regards,
--
Benoît Minisini
More information about the User
mailing list