Menu

IniFrame and m_rcPosition, m_ShowStatusBar, m_ShowToolBar

Help
2016-01-08
2016-01-12
  • Daniel Pantea

    Daniel Pantea - 2016-01-08

    Hi David,
    congratulation for 8.1 release. :-)

    I studied IniFrame sample and was wondering why doubling the parrent CFrame's members m_rcPosition, m_ShowStatusBar, m_ShowToolBar.
    Then I saw that they are private and there is no available setter: so this was the reason for not calling CFrame::PreCreate from CMainFrame::PreCreate.
    Why this approach? Could you please make CFrame's members protected or add needed setters so need for duplication?

    Also digging more, saw that m_ShowStatusBar is not updated when user toggles View -> StatusBar menu.
    There is no issue in CFrame::OnMenuUpdate which uses IsWindowVisible() so works even if m_ShowStatusBar was not updated; but there is an issue with all MDI frame samples because CMDIFrame::OnMenuUpdate will use the old m_ShowStatusBar.
    Suggest to update m_ShowStatusBar to bShow in CFrame::ShowStatusBar, what do you think?
    Same for m_ShowToolBar...
    Best regards,
    Daniel

     
  • David

    David - 2016-01-11

    Hi Daniel,

    Thanks for the suggestion.

    I've reworked the way the initial variables are stored when they are loaded from either the registry or an ini file. The following changes were made to CFrame:

    Added:
    CFrame::GetInitValues
    CFrame::SetInitValues

    Removed:
    CFrame::GetShowCmd
    CFrame::GetShowStatusBar
    CFrame::GetShowToolBar
    CFrame::SetShowCmd

    In the INIFrame sample, CMainFrame now uses CFrame::PreCreate and doesn't require a PreCreate function of its own.

    CMDIFrame::OnMenuUpdate now works as it should.

    Revision 2077 of the code submitted to SourceForge has these updates.

    Best regards,
    David

     
  • Daniel Pantea

    Daniel Pantea - 2016-01-11

    Hi David, thank you for the update. Tested and works as expected.
    In CMainFrame::OnCreate from INIFrame: I think you can also remove now ShowStatusBar and ShowToolBar too, because CFrame::OnCreate already calls them with the correct values, right?
    Best regards,
    Daniel

     
  • David

    David - 2016-01-12

    Hi Daniel,

    Yes those calls in CMainFrame::OnCreate were redundant. I've removed them

    Best regards,
    David

     

Log in to post a comment.