- This topic has 4 replies, 2 voices, and was last updated 12 years, 3 months ago by
DarrenB.
-
AuthorPosts
-
January 3, 2013 at 3:38 pm #35554
DarrenB
ParticipantHi,
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
January 4, 2013 at 12:10 pm #49775Support
KeymasterHello!
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. 🙂
January 4, 2013 at 12:24 pm #49776DarrenB
ParticipantThankyou…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 🙂 )
January 4, 2013 at 1:28 pm #49777Support
Keymaster'DarrenB' wrote:I did thisif 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 🙂
January 4, 2013 at 1:39 pm #49778DarrenB
Participant'Support' wrote:Try this :
if sDateEdit1.FPopupWindow nil then TForm(sDateEdit1.FPopupWindow).Close;
Perfect, thanks 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.