Popup calendar is closed when year and month selector is shown

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #68357
    HeDiBo
    Participant

    In the accompanying test project, click on the button “Show Popup”. A calendar pops up. Then click on the year / month bar. A year selector pops up, but the popped up month calendar is already gone.

    Attachments:
    You must be logged in to view attached files.
    #68370
    Support
    Keymaster

    Popup window is closed because focus lost, I will try to find a solution.

    #68434
    HeDiBo
    Participant

    I saw your solution in the popup form of tsDateEdit:

    type
      TAccessCalendar = class(TsMonthCalendar);
    
    procedure TsPopupCalendar.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
    begin
      with TAccessCalendar(sMonthCalendar1) do
        CanClose := (PopMenu = nil) or (PopMenu.PopupComponent = nil);
    end;

    So, a simple public boolean property TsMonthCalendar.CloseInhibited would do the trick.

    #68435
    HeDiBo
    Participant

    I now realize that the label CloseInhibited is too geared toward a popup form. Keeping it restricted to the calendar itself, please implement this:

    public
    ...
    property PopupShown: Boolean read GetPopupShown;
    
    function TsMonthCalendar.GetPopupShown: boolean;
    begin
       Result :=  (PopMenu <> nil) and (PopMenu.PopupComponent <> nil);
    end;
    

    Thanks

    #68441
    Support
    Keymaster

    I have found an universal solution, any popup windows will not be closed automatically if popup menu is opened there. You can test it in the v15.02

    #68444
    HeDiBo
    Participant

    I already saw that in the modified sMonthCalendar you sent me. Thanks a million.

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Popup calendar is closed when year and month selector is shown’ is closed to new replies.