Date Time Picker

Hello Everyone.

I’m trying to integrate the DateTimePicker into our User Interface, however I’m having a problem.

Is there any way the user selects the date and that date they have selected goes to a  separate Edit Field ?

Below is an image, that explains what I mean….

The date already in the Edit Field is TODAYS DATE. If the user changes the date from the DateTimePicker the Edit Field does not change.

The date already in the Edit Field is TODAYS DATE. If the user changes the date from the DateTimePicker the Edit Field does not change.

I wrote this function that can read what is already in the DateTimePicker… However if the user changes the date, whats in the Edit Field does not change….

Advertisements

25 thoughts on “Date Time Picker

  1. Without looking at the manual for the techy details, I’d say you need to attach a callback to the Select event of the DateTimePicker. In that callback function you put program code to read the date value from the DateTimePicker object, format it, and then put it in the Edit field.

  2. Ah, seeing your own reply, I’d say you need to look more closely at the list of possible events in the DateTimePicker, find the events that fit the user making changes in the “Picker”, and hook your callback to those events too.

  3. Ah, sorry. You see no change in the Edit field because you don’t assign the formatted value to the Text property of the Edit field.

  4. Well, I was taught GUI in Dyalog APL before the introduction of the “dot” syntax. It means I would do it like this:
    ‘NameOfEditFieldObj’⎕WS’Event’ ‘Select’ ‘NameOfCallbackFunction’
    Using the “dot”-syntax, I guess this is how (somebody please correct me if I’m wrong):
    NameOfEditFieldObj.Event←’Select’ ‘NameOfCallbackFunction’

  5. Your code sets the Text property only when the Edit field is created. You need a function to change the Text property, which is executed every time the user selects a new date. This is done by assigning event name (“Select” in this case) and name of callback function to the Event property.

  6. Whoops, my code is wrong. The event and callback should be assigned to the “Picker”:
    NameOfDateTimePickerObj.Event←’Select’ ‘NameOfCallbackFunction’

  7. In your CMMMDD function you need to assign the formatted date to the Text property of the Edit field, like this:
    FRM.PS.PP2.FileName1.Text←cMMMdd

  8. Hmm, my best guess is that my use of the dot syntax to assign a callback is plain wrong. Try this instead:
    FRM.PS.PP2.DPCMMMDD.onSelect←’CMMMDD’

  9. It’s the event. “Select” is not the one you want. You’d want to use the DateTimeChange event. So the event assignment should be:
    FRM.PS.PP2.DPCMMMDD.onDateTimeChange←’CMMMDD’

  10. same… this what the language help says: I cant make much sense of it though…

    For a Button with Style’Push’ this event is generated when the user “pushes” the button. This can be done by clicking the left mouse button, or by pressing the Enter key or the space bar when the Button has the focus. The Select event can also be generated when the Button does not have the focus, by pressing the Enter key when its Default property is 1 or by pressing the ESC key when its Cancel property is 1.

    For a Button with Style’Radio’ or ‘Check’ this event is generated when the user toggles the button from one state to another. This can be achieved by clicking the left mouse button or by pressing the space bar when the Button has the focus.

    For a Combo or List object, a Select event is generated when the user selects an item from the list, whether by pressing the arrow keys or by clicking the left mouse button.

    For a MenuItem, a Select event is generated when the user chooses the item.

    For all other objects, this event is generated when the user presses the keys associated with the object’s Accelerator property.

    The event message reported as the result of ⎕DQ, or supplied as the right argument to your callback function, is a 2-element vector as follows :

    [1] Object ref or character vector
    [2] Event Event code

  11. Maybe the Select event is supposed to come from the optional checkbox, but I cannot make that generate the Select event.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s