How do I close popup of TsDateEdit

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #35554
    DarrenB
    Participant

    Hi,

    I need to close the popup part (the calendar that appears when you click the icon) of the TsDateEdit programatically…how do I do that?

    I'm experiencing some strange 'quirk' when using the control. To test this, create a new project with 2 forms…set both forms FormStyle to StayOnTop, and their popup mode to pmExplicit. This most closely resembles my own forms. Skin Manager on form1, SkinProviders etc. On the first form place a button that calls form2.hide

    On the second form, place a TsDateEdit.

    Run the program and display both forms.

    Click the icon on the DateEdit that brings up the popup calendar, but leave it showing. Now click on the form1 button that calls the form2.hide event. Form2 disappears but the popup calendar doesn't. Can anyone confirm/deny this behaviour? Note that if you place a button on form2 which calls the form2.hide event, and repeat the above steps…the popup calendar correctly 'hides' when the form is hidden. It seems that this quirk only arises when the Hide event of the form is called from another form?

    Thanks

    Darren

    #49775
    Support
    Keymaster

    Hello!

    This code can help you to close a popup calendar :

    Code:
    if sDateEdit1.FPopupWindow nil then TForm(sDateEdit1.FPopupWindow).Close;

    I will research a described strange behaviour (I can reproduce it) and I'll fix it soon. 🙂

    #49776
    DarrenB
    Participant

    Thankyou…as long as I know you can reproduce it I know you will fix it!

    Your temporary code fix did work in removing the popup in the situation I described, however when 'coming back' to the form (making it visible again) and clicking on the DateEdit icon again, I get an Access Violation. In any case this isn't a biggie right now will wait a fix 🙂

    I did this

    if assigned(form2.sDateEdit1.FPopupWindow) then

    FreeAndNil(form2.sDateEdit1.FPopupWindow);

    in the form hide…don't know if the check for assigned is necessary.

    Happy New Year (a bit late, but still 🙂 )

    #49777
    Support
    Keymaster
    'DarrenB' wrote:
    I did this

    if assigned(form2.sDateEdit1.FPopupWindow) then

    FreeAndNil(form2.sDateEdit1.FPopupWindow);

    Try this :

    if sDateEdit1.FPopupWindow nil then TForm(sDateEdit1.FPopupWindow).Close;

    Quote:
    Happy New Year (a bit late, but still 🙂 )

    Thanks 🙂

    #49778
    DarrenB
    Participant
    'Support' wrote:

    Try this :

    if sDateEdit1.FPopupWindow nil then TForm(sDateEdit1.FPopupWindow).Close;

    Perfect, thanks 🙂

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.