Archived

This topic is now archived and is closed to further replies.

Recommended Posts

Hey pplz, I''ve got some problems understanding MFC. How can I create an application with ReBars with an editbox, and change the editbox interactively with my program, or a listbox. Etc.. thnx, Divide Overflow@t!s

Share this post


Link to post
Share on other sites
felisandria    739
ReBars? You mean menus perhaps?

What compiler are you using? If it''s MSVC, just use the resource editor to put your stuff together, and take a look at MSDN help, as it will pretty much show you everything you need to know about MFC, on a simple level.

Share this post


Link to post
Share on other sites
Nopez, I ment the dialog bars, but I guess you can see them as quick-menus Anyway, the problem is that I can''t get the classwizard to work with them -> cannot trap any messages...

Divide Overflow

Share this post


Link to post
Share on other sites
Stoffel    250
MFC is set up so that menus will trigger commands as a response to the user selecting an item. I don''t know exactly what you mean by trap messages (perhaps you could write a lengthier description of what you''re trying to do.) If you mean you can''t get your program to respond to menu selections, this is how you do it:

- Add the menu item to the menu bar using the resource editor. Make sure you give it a useful ID. One convention is to do the following:
For menu Tools->Options->Do Something, ID = ID_TOOLS_OPTIONS_DOSOMETHING
- Figure out which class will be handling the menu selection. If you''re running a dialog-based app, it would probably be your dialog. If you''re running a SDI or MDI, probably one of the frame or view classes.
- Open the classwizard. If you haven''t used classwizard, it will ask you if you want to build it. Say yes. If you happen to be in the resource editor looking at your menu, it will ask you if you want to create a class for the menu. Say no.
- Select the "Message Maps" tab. Under "Class Name", select the class you want to handle the menu command.
- In the "Object IDs" list, you should see your ID_TOOLS_OPTIONS_DOSOMETHING. Click on it.
- In "Messages", you should see "COMMAND" and "UPDATE_COMMAND_UI". Click on "COMMAND", then hit the "Add Function" button to the right.
- Fill-in your function name, and voila! Next time you click that menu item, that function will be called.

Share this post


Link to post
Share on other sites
Shannon Barber    1681
I think he''s a ways before that point, I''m trying to beat a status bar into my program right now with little success.

There''s no resource for Rebars, you can''t just click and drop one on the dialog. You gotta build it OnInitDialog(), and add a pointer to a CReBar and/or another one to a CReBarCtrl to your dialog class. I haven''t done anything with SDI or MDI yet, so I have no idea how to add one to those types of programs.

http://msdn.microsoft.com/library/default.asp?URL=/library/devprods/vs6/visualc/vcmfc/_mfc_crebar.htm

Share this post


Link to post
Share on other sites
Sorry for the late reply. I''ve had an argument with windows. I wanted it to work but it felt otherwise...

Anyway, thanx for your replies. I finally found a way around the classwizard, to create CReBars (or dialogbars).

Divide Overflow

Share this post


Link to post
Share on other sites