Optional Push-Buttons Around Frame :: MFC

kuphryn

Senior member
Jan 7, 2001
400
0
0
Hi.

I have always wondered about having push-buttons at any specific place around the frame in a SDI architecture. I will explain as best I can about how the program might look like. Here is a typical SDI core GUI.

-----
Menu/Toolbar
-----
View
-----
Statusbar
-----

I would like to have something like this:

-----
Menu/Toolbar
-----
View
-----
Two Push-Buttons (Open | Exit) // open and exit is arbitrary
-----
Statusbar
-----

What is the best way to implement something like the GUI above? It is easy to add buttons and such inside a dialog box, but I have never be able to add push-buttons anywhere in the main frame.

I have one idea, but I am not completely sure on how to add the click mesages if the user clicks the button. Three weeks ago I posted a thread asking about added a progress bar insde the status bar. A member at CodeGuru posted a very unique technique that basically enable/disable the default status bar and enable/disable a CControlBar. It was such a cool technique. I am still using it.

I was thinking maybe I can implement the same setup, but this time, enable the CControlbar througout the program's lifetime. However, how will I be able to process messages if the user clicks a button? the use of CControlbar does not require deriving a class to encapsulate the dialog box. Thus, I have no way of processing messages cooresponding to the buttons inside the dialog box.

Do you have a better technique?

Thanks,
Kuphryn
 

EagleKeeper

Discussion Club Moderator<br>Elite Member
Staff member
Oct 30, 2000
42,589
5
0
The CToolBarCtrl allows you to dock it in a user or developer defined configuration.

The toolbar will provide a button click message to you just like the dialog box does.

From the MSDN on CToolBarCtrl


<< A Windows toolbar common control is a rectangular child window that contains one or more buttons. These buttons can display a bitmap image, a string, or both. When the user chooses a button, it sends a command message to the toolbar?s owner window. Typically, the buttons in a toolbar correspond to items in the application?s menu; they provide a more direct way for the user to access an application?s commands. >>

 

kuphryn

Senior member
Jan 7, 2001
400
0
0
Thanks.

I believe using the CControlbar might be more flexible since I can use Dialog Editor to create a button.

Kuphryn