[Gambas-user] What has happened to ValueBox

Michael mdavies5 at ...169...
Sat Dec 18 12:58:54 CET 2010


Benoit,
Here is more information to help you rewrite the valuebox. I had a 
ValueBox set to date and it was in a VBox. If I set the "Expand" 
property to TRUE then I could never see the text. If I set Expand to 
False then it was ok. I experimented with resizing the form and found 
that the text was disappearing off the bottom. It appears not to like a 
ValueBox.Height > 24.
Also if I set "Expand" to False the DatePicker did not appear on the 
ValueBox even though the ValueBox.Width was quite large. If I enlarged 
the form it appeared. Then I closed the form to it's original size and 
the DatePicker remained visible.
If it was possible it would be nice to have a property to hide the 
DatePicker. I personally find these a nuisance in a production 
environment. Users can type a date much quicker. The ValueBox in Gambas 
2 was perfect in this regard.

Regarding your suggestion to use the LAST.Parent to get the object name. 
I am attaching a screenshot of the properties of the LAST Valuebox. You 
will see it shows name as "TextBox" and Parent as "Panel". I shall wait 
for the revised version.
ValueBox.png

Regards
Michael


On 18/12/10 04:24, Benoît Minisini wrote:
>> 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,
>



More information about the User mailing list