[Gambas-devel] TimePicker

Benoît Minisini gambas at ...1...
Thu Nov 19 15:34:42 CET 2009


> Hi Benoît, days ago I was theaching Gambas and my students tell me that it
>  will be nice to have a TimePicker. Here is a first try to do that.
> 
> I would like to know you comments. I think is a nice control to add to
>  gb.form.
> 
> 
> 
>  Regards
> 
> 
> --
> David
> 

OK, but:

- Why making a popup? Put the three SpinBox directly inside the control. And 
create a ReadOnly property.

- If you prefer making a popup because you find that nicer, align its left to 
the left of the control, I think it's better. You should add a panel with a 
plain border as first popup child, so that the popup is clearly visible. And 
you should hide the popup as soon as it loose focus. Alas, there is a weird 
behaviour in gb.qt4: borderless windows prevent their children controls from 
raising focus events! As soon as it is fixed, you will be able to hide the 
popup correctly.

- The Value property seems to be a string. It must be a Date. The Date 
datatype includes both date and time, so you should use it for time values 
too.

- The time format is usually "hh:nn:ss" (Gambas Format$ syntax), but is it 
true in all languages? The control should analyze:

  Format(CDate("01:02:03"), gb.LongTime)

to see in which order it gets hours, minutes and seconds. And adapt the order 
of SpinBox controls accordingly.

- In the same way, you should follow the System.RightToLeft property, which 
tells you if the current language is right to left written. For such 
languages, the order of SpinBox will be reversed, as well as the alignment of 
the popup.

- The Format property should use two constants, not the 12 and 24 integer 
values.

- The ToSeconds/ToMinutes/ToHours properties should be removed. They are 
actually helper functions related to the Date datatype, not really related to 
the control itself. I don't say that they are not useful, but putting them 
inside the control source code is not a good idea.

Regards,

-- 
Benoît Minisini




More information about the Devel mailing list