Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.

Current day selection issue

Hi guys

It's been a while - which means we've been going along pretty nicely with your controls - so thanks for that!

The other day I saw an issue - basically we have a form with the date control within it (ORYXOLE_CALENDAR) which gets called as a dialog via a subclassed editline controls where relevant (setup in the PROMOTED_CREATE event).

We are also using your brilliant event framework, and validate typically via a LOSTFOCUS_PRE event.

So the sequence is:
1. set focus to a standard date field (editline) without any custom validation.
2. press the subclassed button (fires an OPTIONS event)
3. oryxole_calendar appears -> select current day or "today" button -> form closes via end_dialog...
4. LOSTFOCUS_PRE event fires for the relevant control, however the value from the dialog has not yet returned to the control, and upon a validation failure a msg() is being displayed (which should really be a tooltip, however this was some legacy code...)

.. in contrast to :
3. as above, but select any other day (i.e. not today)
4. LOSTFOCUS_PRE event fires, however the date has already been returned from the dialog, so validation progresses fine (even though a msg() is being shown).

In step 3 above, after the calendar control gets closed upon an "OnClick" event. I'm at a loss to explain why the behaviour would be different for days other than the current date.

Hopefully this is enough to be useful. Please ask any q's.

User: James Birnie


  • Hi James,

    Glad to hear that things are working for you most of the time. :-)

    I'm seeing your setup in my mind's eye but there are some missing pieces. I assume that the logic which closes the ORYXOLE_CALENDAR dialog is the same whether you click on the current date, the "today" button, or another date"? Have you actually debugged this process to confirm that the End_Dialog is, in fact, returning a date?

    What triggers the LOSTFOCUS_PRE event handler? Is this being triggered by the end user actually leaving the editline or are you causing this to trigger by setting the FOCUS elsewhere programmatically?
  • Another consideration.

    If you are ending the dialog based on the click event are you returning the 'date' parameter passed through the click event or are you first retrieving the 'selection' property?

    I haven't tested but I would assume that clicking the 'Today' button for example wouldn't have a value in the 'date' parameter and you could simply be returning null if you're not retrieving the selection deliberately.

    Admittedly, that wouldn't explain the clicking on the current selection failing.
  • Hi guys

    Thanks for the feedback!
    Hi Don - sorry I didn't really provide enough info, please don't look into this any further until I get a chance to better isolate the issue and sequence of events. The LOSTFOCUS_PRE is the promoted LOSTFOCUS event that happens immediately before the user leaves the control and I think may be being triggered by the msg() call in this case (which as I've mentioned should really be a tooltip). I'll look into this further next week and let you know.

    Hey Mark - I see what you mean about a potential sequencing issue, however the "Today" button doesn't fire the "OnClick" event, i.e. it's just updates the selection. Then when the user clicks on a date the code checks param4 - and will return this (if this variable contains a value).

    User: James Birnie
Sign In or Register to comment.