dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: OnCreateClient

  1. #1
    Join Date
    Jun 2007
    Location
    MA-USA
    Posts
    247

    OnCreateClient

    Hello, I am using a CSplitterWnd in my CMainFrame derived class.
    I would like the splitter to divide the client area into four equal parts.
    I am creating the splitter in the frame windows OnCreateClient.
    OnCreateClient is called when OnCreate first calls the base class.
    At this time, the toolbar and statusbar have not been created.
    How can i get the toolbar height and statusbar height if they don't exist?

  2. #2
    Join Date
    Feb 2000
    Location
    San Diego, CA
    Posts
    10,354

    Re: OnCreateClient

    Why would you want those sizes at that time ? The framework handles most of the resizing when your OnCreateClient has done creating the splitter windows. Perhaps , you can explain any problems you are seeing ?

  3. #3
    Join Date
    Jun 2007
    Location
    MA-USA
    Posts
    247

    Re: OnCreateClient

    I understand that within OnCreateClient i can just assign the splitter panes some default size values.
    Now we have returned to OnCreate and create the toolbar and statusbar.
    When i use GetClientRect on the mainframe it doesnt calculate these.
    Can i now use GetWindowRect for the statusbar and toolbar, then subtract the top from the bottom of each to get their height.
    And maybe use GetSystemMetrics(SM_CYMENU) to get the menu height?
    Do i then use SetRowInfo and SetColumnInfo to adjust the panes?

  4. #4
    Join Date
    Feb 2000
    Location
    San Diego, CA
    Posts
    10,354

    Re: OnCreateClient

    am not sure why you want to do all that. If you crank out a sample SDI/MDI app, you see none of this done. Again, the calculation of the statusbar, toolbar sizes happens during Recalclayout and this gets triggered as often as there is a potential for size changes due to resizing of the frame, showing of hiding of toolbar/statusbar and such. Why exactly are you interested in the sizes in OnCreate ?

  5. #5
    Join Date
    Jun 2007
    Location
    MA-USA
    Posts
    247

    Re: OnCreateClient

    Doing this in the OnCreate seems like the best place.
    My splitter window has 2 rows and 2 columns.
    What i would like to do is split the client area into four equal panes.
    When i say client area i mean the area not obscured by the menu, statusbar or toolbar.
    This should be done when the main window is created and before it is visible.
    I am not asking you to understand why, i am asking you how to...

  6. #6
    Join Date
    Feb 2000
    Location
    San Diego, CA
    Posts
    10,354

    Re: OnCreateClient

    Quote Originally Posted by bitshifter420
    I am not asking you to understand why, i am asking you how to...
    If you insist on doing it in OnCreate, your how cannot simply be answered and hence the why is important. Programming is a lot about asking why a certain thing has to be done a particular way and should not be done a certain way and not just how, isn't it? Anyways, that said, your hint is not to attempt to do it in OnCreate, but in WM_SIZE handler of the framewindow. Here, if you want to do it only the first time, maintain a variable for that purpose. Also, WM_SIZE will come even before your statusbars and toolbars are created and will keep coming later on. So, you have to check for the GetSafeHWnds of the toolbar and statusbar both to be valid before you try to set row and column infos.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)