Skip to main content
gamedev.net
🔒 Locked

MFC tabs

Started by hibikikonzaki 8 replies 600+ views
Original Post
hibikikonzaki
hibikikonzaki
Ok, I''m making an editor in C++ and MFC, and I want it to be able to edit two different kinds of units (units like stuff that can move, and buildings) and I want a tab control to switch between the two different types. I know how to check what button has been pushed and I''ve got the function for when it''s changed and everything, but I don''t know how to totally change all the input fields in the dialog box to something differnet (like I don''t want the building to have a unit type, attack, range, etc.) Any help would be greatly appreciated. Thanks. Hibiki Wheres the any key? www.geocities.com/dragongames123/home.html INSERT MY OVER-SIZED EXTRAVOGENT PIC HERE:
HibikiWheres the any key?www.geocities.com/dragongames123/home.htmlINSERT MY OVER-SIZED EXTRAVOGENT PIC HERE:
Cafall
Cafall
You need to recreate everything like buttons when switching tabs, or you could use somthing like http://www.codeproject.com/tabctrl/ctabctrlssl.asp witch automates it and you just provide different dialog resources.

Chozo
Chozo
The way I''ve done it in the past is to create a seperate window for each tab page, then when the user selects a tab, I hide all the windows except the one that needs to be shown. This has the benefit of not losing state information and the code is pretty short (you can also use dialog templates for each page).

I also think (can''t remember exactly) that if you make each window a child of the tab, you don''t have to track when the tab window is moved, you just have to resize all the windows on the main WM_SIZE.
hibikikonzaki
hibikikonzaki
CaFall, I went to that webpage, but the class it gave I couldn''t get to work.

Chozo, how would I hide the other dialog window and bring the second one back up again?

Gracias.

Hibiki
Wheres the any key?
www.geocities.com/dragongames123/home.html

INSERT MY OVER-SIZED EXTRAVOGENT PIC HERE:
HibikiWheres the any key?www.geocities.com/dragongames123/home.htmlINSERT MY OVER-SIZED EXTRAVOGENT PIC HERE:
hibikikonzaki
hibikikonzaki
Anyone? C''mon, I''ve searched google until 2 am and found nothing. I know someone knows.

Hibiki
Wheres the any key?
www.geocities.com/dragongames123/home.html

INSERT MY OVER-SIZED EXTRAVOGENT PIC HERE:
HibikiWheres the any key?www.geocities.com/dragongames123/home.htmlINSERT MY OVER-SIZED EXTRAVOGENT PIC HERE:
Chozo
Chozo
ShowWindow(hDlg, SW_SHOW) to show
ShowWindow(hDlg, SW_HIDE) to hide

when you show one, you hide all the others.
hibikikonzaki
hibikikonzaki
Ok, I''ve got the dialog I want to be the main window set up, and the one I want to use with the tab and a class for it, but when I click on the tab, instead of showing the smaller dialog, it says "debug assertion error." I have no clue whats wrong. When I take out Units.ShowWindow(SW_SHOW); (units is the new dialog class) it works fine. MFC really confuses me... Thanks for your help.

Hibiki
Wheres the any key?
www.geocities.com/dragongames123/home.html

INSERT MY OVER-SIZED EXTRAVOGENT PIC HERE:
HibikiWheres the any key?www.geocities.com/dragongames123/home.htmlINSERT MY OVER-SIZED EXTRAVOGENT PIC HERE:
Chozo
Chozo
Just out of curiosity (from the given info, I have no idea what''s wrong... sorry), why are you doing it with MFC? I know it''s more work to use the API, but I personally find it a bit easier to get things done with it, and I''m not sure if you''ve spent time with it, but I''ve heard learning the API before MFC makes everything a lot easier to pick up.
AdamMB
AdamMB
quote:
Original post by hibikikonzaki
Ok, I''ve got the dialog I want to be the main window set up, and the one I want to use with the tab and a class for it, but when I click on the tab, instead of showing the smaller dialog, it says "debug assertion error." I have no clue whats wrong. When I take out Units.ShowWindow(SW_SHOW); (units is the new dialog class) it works fine. MFC really confuses me... Thanks for your help.


The debug error sounds like it might be caused by not having the window initialized. From just that information, I can''t really offer much more help, but look back through your code for the hidden window that you are trying to show and make sure it is all setup just like normal before you call the ShowWindow func. You might also try making it the window that shows at first to make sure none of the controls you have on the window are causing the problem. Hope that gives you a little something to go on.

-Adam

hibikikonzaki
hibikikonzaki
Should I have created a new calss for the new dialog? Could that be it? I think everything is initialized right. When I tried to call teh other dialog''s create function, I get some error about an ambiguous overloaded function call, then when I try any other function with that class, I get the debug assertion error at run time.

Hibiki
Wheres the any key?
www.geocities.com/dragongames123/home.html

INSERT MY OVER-SIZED EXTRAVOGENT PIC HERE:
HibikiWheres the any key?www.geocities.com/dragongames123/home.htmlINSERT MY OVER-SIZED EXTRAVOGENT PIC HERE:

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.