MFC

Started by
5 comments, last by Divide Overflow 23 years, 6 months ago
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
Advertisement
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.
~ The opinions stated by this individual are the opinions of this individual and not the opinions of her company, any organization she might be part of, her parrot, or anyone else. ~
CEdit *pEdt = (CEdit *)GetDlgItem(ID_OF_EDITBOX);
pEdt->SetWindowPos(some...new...position...);

That what you want to do?
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
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.
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
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
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

This topic is closed to new replies.

Advertisement