Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.

MDICLIENT

I have an OI 9.4 app that uses an MDICLIENT control. This is the main form in the app and is set as the entry point. It also uses menus, SRP buttons (as a button bar across the top of the main form) and s SRP StatusBar at the bottom of the form.

I want to convert this form to use the Ribbon control. However, I want to also to retain the menu and button bar and enable either the existing look and a new look using the Ribbon control and switch between the two use a command line argument or ini setting.

My initial thought was to add the Ribbon control and then disable the menu (using null text) and the OLE.Visible property, to show only the relevant controls.

However, when I do this the presence of the Ribbon control seems to automatically disable the menu, also seems to move the StatusBar control, and also modify the MDICLIENT size and location.

Does what I am seeing make sense or is something in my code causing this effect?

Does adding the Ribbon control have any automatic effects on any other controls?

How should the Ribbon be sized? As a strip across the top of the form, or should it take up the entire form?

Might a better way of approaching this to have two separate forms one with a menu etc., and the other with a Ribbon control and launch one or the other on startup?
«1

Comments

  • Jim - The Ribbon control is designed, out of necessity, to take over the entire form. In so doing it also replaces your menu bar. It will not replace your toolbar, but that's because regular controls are left alone.

    As you noted, the Ribbon control does move regular controls and the MDI client down to make room for itself. This is completely expected. If your StatusBar is bottom anchored then it should remain where you put it. Can you confirm how you have this configured?

    You can put the Ribbon control anywhere you want on the form. We generally resize it to be out of our way and off to the side. It won't care because it takes over and draws itself anyway.

    I think creating two forms and switching between the two upon startup is your best bet.
  • Thanks Don, let me experiment.
  • Hi Jim,

    Send me your email and I can show you what has have done with the ribbon and other SRP controls.

    chris@pbcit.com.au
  • I can't get the mdi frame and SRP status bar to position correctly. The status bar is not at the bottom of the window but rather about its own height away from the bottom of the window. The mdi frame no matter what I do, seems to not fill the entire space between the ribbon and the status bar.

    Any ideas on what I am doing wrong?
  • Is your statusbar bottom anchored?
  • Yes, bottom anchored.
  • edited May 29
    Use the Ribbon's LayoutChildControl method to tell it where to put the other controls in relation to the ribbon.
  • OK, let me give that a try.

    Totally separate question, when in form designer 9.4 the control that shows the position and size of a control has the bottom cutoff, do you know of a fix for this?


  • There is no convenient fix. I think I found a program years ago that can resize a window, but you have to run that program every time you open the Form Designer. It never felt worth it.
  • Ugh, it kind of drives me crazy.
  • Man, the ideas you guys put in my head. If you download OCX version 4.2.5.5 and register it, it will resize the toolbox IF there is an SRP OLE control somewhere on the loaded form.
  • When I save the form, it moves the status control from the bottom of the form up from the bottom, hence the code you suggested does not work as the control is not positioned at the bottom of the form.

    Here is what I did, made sure status control is at very bottom of form. Saved the form. Status control is still in the correct place. Open form, status control has moved up from the bottom of the form.

    Why is saving the form moving the control, any ideas?
  • edited May 29
    I'm not sure I can answer without seeing any code. This is what we do in FrameWorks' CREATE event.

    Size = Get_Property(@Window:".OLE_FRAME_STATUS", "ORIG_SIZE") Left = "0" ; // Achor left to client left Top = -Size<4> ; // Use control's original size to determine anchor from bottom Right = "-0" ; // Anchor right zero pixels from client right Bottom = "-0" ; // Anchor bottom zero pixels from client bottom Handle = Get_Property(@Window:".OLE_FRAME_STATUS", "HANDLE") Send_Message(@Window:".OLE_RIBBON", "OLE.LayoutChildControl", Handle, Left:@FM:Top:@FM:Right:@FM:Bottom)
  • See this thread on Form Designer

    HTH, M@
  • Thanks Matt.
  • Thanks Kevin, for the toolbox fix.
  • Kevin, let me put an example together and I'll send it to you.
  • Here is what is happening.
    I removed the ribbon control.
    I then sized the mdiclient and OLE status control, such that the status control was at the very bottom of the form and the mdiclient used everything from the top of the form to the status control.
    I then saved the form.
    Closed and opened the form, and everything still looks good.
    Added the ribbon control back, as soon as I did the status bar jumps a whole bunch of pixels up from the bottom of the screen, why? In the screenshot you can see the status bar is not at the bottom of the window, nor does moving it there and saving the form work. If you re-open the form, it jumps back up.
    The following code does not fix the issue.

    Set_Position_of_Control:
    **********************************************************************************
    **********************************************************************************
    * Set the desired position of the status bar during CREATE event. It should take care of itself after that
    StatusSize = Get_Property("MAIN.STATUS", "ORIG_SIZE")
    Left = "0" ; // Anchor left to client left
    Top = -StatusSize<4> ; // Use control's original height to determine anchor from bottom
    Right = "-0" ; // Anchor right zero pixels from client right
    Bottom = "-0" ; // Anchor bottom zero pixels from client bottom
    Handle = Get_Property("MAIN.STATUS", "HANDLE")
    Call Send_Message("MAIN.RIBBON", "OLE.LayoutChildControl", Handle, Left:@FM:Top:@FM:Right:@FM:Bottom)

    * Adjust the MDI client, taking the status bar into account
    Left = "0" ; // Anchor left to client left
    Top = "0" ; // Anchor top to pixel just beneath the ribbon bar
    Right = "-0" ; // Negative Zero means Zero pixels from the right
    Bottom = -StatusSize<4> ; // Anchor bottom to be just above the status bar
    Handle = Get_Property("MAIN.MDICLIENT", "HANDLE")
    Call Send_Message("MAIN.RIBBON", "OLE.LayoutChildControl", Handle, Left:@FM:Top:@FM:Right:@FM:Bottom)
    Return
  • So, this is a Form Designer screenshot, correct? Are you saying the above code does not work when running the form? Do you have a screenshot of that?
  • Correct that is from form designer. You can see the status bar has jumped up from the bottom.
    The screenshot below is from the app running.

    In the below code, new_size = old_size, it didn't move.

    Set_Position_of_Control:
    **********************************************************************************
    **********************************************************************************
    * Set the desired position of the status bar during CREATE event. It should take care of itself after that
    Old_Size = Get_Property("MAIN_TACTIC.STATUS", "SIZE")
    StatusSize = Get_Property("MAIN_TACTIC.STATUS", "ORIG_SIZE")
    Left = "0" ; // Anchor left to client left
    Top = -StatusSize<4> ; // Use control's original height to determine anchor from bottom
    Right = "-0" ; // Anchor right zero pixels from client right
    Bottom = "-0" ; // Anchor bottom zero pixels from client bottom
    Handle = Get_Property("MAIN_TACTIC.STATUS", "HANDLE")
    Call Send_Message("MAIN_TACTIC.RIBBON", "OLE.LayoutChildControl", Handle, Left:@FM:Top:@FM:Right:@FM:Bottom)
    New_Size = Get_Property("MAIN_TACTIC.STATUS", "SIZE")
    debug
    * Adjust the MDI client, taking the status bar into account
    Left = "0" ; // Anchor left to client left
    Top = "0" ; // Anchor top to pixel just beneath the ribbon bar
    Right = "-0" ; // Negative Zero means Zero pixels from the right
    Bottom = -StatusSize<4> ; // Anchor bottom to be just above the status bar
    Handle = Get_Property("MAIN_TACTIC.MDICLIENT", "HANDLE")
    Call Send_Message("MAIN_TACTIC.RIBBON", "OLE.LayoutChildControl", Handle, Left:@FM:Top:@FM:Right:@FM:Bottom)
    Return
  • Try initializing the ribbon with at least one tab. Don't worry about the Form Designer positions. Once you elect to use the Ribbon control, WYSIWYG design support is pretty much gone. It all has to be done in code.
  • OK, I'll try this later. Got to solve a customer issue first. Thanks for the help.
  • That "RUN WINDOWS_SERVICES 'SetSize', '', 'TbxWindowClass', '', 800, 100, 105, 336" that Don noted in the linked post is annoying to have to do everytime (well everytime you need to see the cut off info) but I now have linked the text to spit out via a hotkey so that takes a lot of sting out of it.
  • @Opto_Will - You are missing the big picture. Just make sure you have an SRP control on *every* form and you are golden.
  • I suppose you only need it on the first form you open, and then just don't exit the Form Designer completely until you are completely done with your OI session...unless I'm wrong about how this works. I haven't actually tested this feature yet (been buried in OI 10 work).
  • Don, the toolbox is created each time you open a form. It's a new window every time, with a unique window handle. So, you'd have to run that routine every time you open a form.
  • Aha...then I go back to my original idea: every form must have an SRP control. Full stop.
  • @DonBakke.
    Plans for world domination! I like it!

    I am not sure that is the case though. We, as a standard, drop the SubClass Control in pretty much every form and I still have to use my hotkey...
  • @Opto_Will. I just added this feature. See above.
  • @KevinFournier
    The ONE comment I seemed to have missed on the Post!!!! Good work!!!
    (and apologies to @DonBakke for doubting you)
Sign In or Register to comment.