Letting the user choose a time

Posted by ojfoggin on 28-Dec-2011 09:12

I have a window that allows the user to schedule an event for a given time.

However, at the moment the time is chosen by entering the INT equivalent (i.e. seconds past midnight).

Now, I don't know many people who tell the time using seconds past midnight   Is there a more sensible way of presenting the user with a way to select a time (not a datetime) without haveing to splice together buttons, combo boxes and fill-ins?

If there is please could you point me in the right direction.

Oh, using Progress 10.2B (or something) and AppBuilder.

Thanks

Oliver

All Replies

Posted by Admin on 28-Dec-2011 09:18

In the ADM2 I'd put together a SmartDataField, in GUI for .NET a UserControl and expose the Value.

But I'm pretty sure, there is no out of the box ABL component for that.

Posted by ojfoggin on 28-Dec-2011 09:23

Thanks for the reply.

I thought you might say that.

I've put together a fill-in with a 99:99 format and the following leave trigger...

IF SELF:SCREEN-VALUE = "  :  " THEN
        SELF:SCREEN-VALUE = "00:00".

    DEF VAR li-hour AS INT NO-UNDO.
    DEF VAR li-minute AS INT NO-UNDO.
                                              
    li-hour = INT(ENTRY(1, SELF:SCREEN-VALUE, ":")).
    li-minute = INT(ENTRY(2, SELF:SCREEN-VALUE, ":")).
                      
    IF li-minute > 59
    OR li-hour > 23 THEN
    DO:
        MESSAGE "Time not valid" SKIP "Please enter a valid time"
            VIEW-AS ALERT-BOX INFO BUTTONS OK.
        APPLY "ENTRY" TO SELF.
        RETURN NO-APPLY.
    END.

    li-time = li-hour * 3600 + li-minute * 60.

It does the trick for now and lets the user enter a time using the keyboard.

That should be fine for now.

Thanks

Oliver

Posted by rbf on 28-Dec-2011 09:30

In Outlook this is solved by providing the user with an editable combo-box that contains all half-hours times of a day (48 items I guess).

The user can select these and edit if necessary.

Note that the user can enter *any* value, if not valid it is simply cleared on leave.

I guess if that works for Outlook, it can work for your app.

-peter

Posted by Peter Judge on 28-Dec-2011 10:08

mikefe wrote:

In the ADM2 I'd put together a SmartDataField, in GUI for .NET a UserControl and expose the Value.

But I'm pretty sure, there is no out of the box ABL component for that.

There is the ADM2 Time SmartDataField (adm2/timesdfv.w), which has been around for some time.

-- peter

Posted by Admin on 28-Dec-2011 11:18

There is the ADM2 Time SmartDataField (adm2/timesdfv.w), which has been around for some time.

True - now that you are reminding me. All those 10.1x ADM2 enhancements were the best kept secret for a long. Like the DataView.

This thread is closed