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?
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?
Comments
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.
Send me your email and I can show you what has have done with the ribbon and other SRP controls.
chris@pbcit.com.au
Any ideas on what I am doing wrong?
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?
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?
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)
HTH, M@
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
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
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...
The ONE comment I seemed to have missed on the Post!!!! Good work!!!
(and apologies to @DonBakke for doubting you)