Jump to content
  • Advertisement

Archived

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

wise_Guy

Questions about MFC

This topic is 6586 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Well I have finally begun work on an MFC level editor and I must say.... sigh! I am having some difficulties about grasping the whole architecture of the thing. I have some example problems which I am uncertain about and would love some guidance on. - If I want a dialog / window / resource of some kind containing a selection of tiles that the user can draw with, how should this be carried out. I was thinking of a new window but I can''t get new windows to work - the WS_STYLES cause ASSERT failures - If I have a dialog bar on the side of my program with various options (at the moment only a check box), is it possible to update the look of these components? I know that you can change things for menus like ticks next to things, but if i change the checkbox in one view and then click on another view, I want to update the checkbox based on whether it is on or off in this view. How do I get access, from the CLevelEditorView class, to change these GUI details? Any solutions to these problems would be much appreciated!

Share this post


Link to post
Share on other sites
Advertisement
This an MDI wizardarooski?

If you''ve never worked with MFC before you might want to grab a Learn in 21 days books...

You will probably want to start with a Dialog app, it''s a lot less confusing (but still confusing...)

...
There''s a picture resource that''s good for marking off an area of a window to use as a render target. You could either make a big "picture" area and use (some of) your existing Dx code to blit the tiles using a ->GetSafeHwnd()
Or you could create a bunch of picture windows the same of your titles (plus border) and blit each one seperately, if you have some dx support for multiple windows.

The ''picture'' object is really a CStatic.

You can hunt down the mfc fog example on msdn, which shows how to use dx & mfc together.

If you want the tiles to float, like a toolbar, then you at least need to construct a modeless dialog box (which you can set to the toolbox look). I''d get them statically on the main dialog first.

If you attack the dragon head-on, and create an MDI app, you can construct an actual toolbar (supports that annoying snap to the sides crap) and toss the tiles on it, again, using picture resources.

There are mfc examples showing how to construct modal & modeless dialogs as well.

If you have a decent understanding of views (then you may know more about MDI than I do :p), there''s a, a.. a second event attached to menu type, checkbox type, & & & type objects called Update_Command_UI (wap ctrl-w), you can add code to those event handlers to alter the functionality of the control. (a pointer to the control comes to you via pCmdUI, and a different handler is called for each view) (I learned this earlier today at work)

Share this post


Link to post
Share on other sites
Yes it is done in a wizard.

First of all - for the Update_Command_UI message, this only appears on things like menus, not on combo boxes (at least not in the class wizard)

And I don''t really need to use DirectX because I can draw all the tiles at the moment using BitBlt and that is working fine.

If I had the available tiles on the same view as the level editor then it would be hard to scroll them, wouldn''t it?

My main prolbem at the moment is creating a second type of window - everything the app wizard generates is very zen. I can''t find any code for the NewView button on the menu. I have made a new ClassWizard view class but I still can''t get it to appear using

AddView(....)

unless I use the window styles such as AFX_WS_DEFAULT_LEFT kind of thing.


wise_guy

p.s. I have a 21 days book from informit.com but it suffers from the problems all these books have and just sticks on specific topics - usually with dialog apps - and doesn''t give you the main theory behind it.

Share this post


Link to post
Share on other sites
Aha! I have made a modeless dialog and that is working pretty well. I was just curious though, is it "bad practise" to make your own variable inside the dialog to use as a pointer to the document? You know, like how some things just "aren''t done".

Thanks

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!