|
The most reliable way I've found of doing this is by hand, using the text editor.
Copy/paste the resources out of the .RC file and into the destination. Don't forget to copy/paste the DESIGNINFO section if there is one. You mentioned menus; you'll have to copy the menu as well.
Copy the resource ID's from the original resource.h into the destination. You may need to renumber the resource ID's so that they don't conflict.
The IDE (VC6, VS.NET 2002, and VS.NET 2003) will let you cut/paste controls, but it's not terribly smart about whole dialogs.
Software Zen: delete this;
|
|
|
|
|
Hi all,
I posted yesterday morning to try and get my menu item to be checked and unchecked as one of my dialogs is displayed via the menu item. I kinda need this to be accomplished soon, so i figured i could post it again because the original post is 5 or 6 pages into the message board.
Beer26 was kind enough to help me with this solution.
in the new dialog class add this function. Now the new dialogs will control that menu item in it's parent.
void MyClass::checkmymenuitem(int checked)
{
CMenu* pMainMenu = GetParent()->GetMenu();
CMenu *submenu = pMainMenu->GetSubMenu(1); // replace 1 by the horizontal menu position
UINT g = submenu->GetMenuItemID(3); // replace 3 by the actual vertical item position
CString mnustr;
submenu->GetMenuString(3, mnustr, MF_BYPOSITION); // replace 3 by the actual vertical item position
// you can optionally change mnustr to a text here
if (checked) submenu->ModifyMenu(3, MF_BYPOSITION | MF_STRING | MF_CHECKED, g, mnustr);
else submenu->ModifyMenu(3, MF_BYPOSITION | MF_STRING | MF_UNCHECKED, g, mnustr);
}
in initdialog
checkmymenuitem(true);
then in onclose
checkmymenuitem(false);
It works fine the first time the app is started(menu item unchecked), when the menu item is selected the first time (checked), and when the dialog is closed the first time(unchecked). BUT it doesn't update the menu at all after the first time it is selected and the dialog is closed.
Can anyone help me figure this out PLEASE. I was originally trying to use a pointer to the dialog being displayed, but that led to the same result.
|
|
|
|
|
(haven't looked at the original question)
can't you simply add a ON_UPDATE_COMMAND_UI command handler for the menu item ?
and use :
void MyClass::OnUpdateYourMenuItem( CCmdUI* pCmdUI )
{
pCmdUI ->SetCheck( IsYourDialogVisible() );
}
Maximilien Lincourt
"Never underestimate the bandwidth of a station wagon filled with backup tapes." ("Computer Networks" by Andrew S Tannenbaum )
|
|
|
|
|
I think he said his main app was dialog based, and as we all know the VC++6 generator has that bug that makes updating UI on menu items not work on dialog based apps.
I forgot what the fix was for that but you can look it up on codeguru.com
|
|
|
|
|
Thank you for your help. I figured it out, and with your code it works great.
The problem was that I just had to destroy the window when closing the window.
|
|
|
|
|
Hi
I urgently need a class for READING a CSV file.
Has anyone writen a simple class to do that job? (any links are always welcome)
greets
Jens
|
|
|
|
|
It's a Comma Separated Value (i.e., comma delimited) file. What part are you having trouble with?
|
|
|
|
|
There is a whole section on parsing waiting to be looked at at:
C++/MFC , Parsing[^]
Iain.
|
|
|
|
|
It's a Comma Separated Value (i.e., comma delimited) file. What part are you having trouble with?
---
I was searching for a class which parses the CSV file and returns a pointer to a user-defined class (or something that will fix the problem) for every line.
Like for example:
The class contains a dynamic number of elements X.
Each element X is one field.
This element X should contain the value of the field(of course) and alsoo the type of value. (text, number, date)
of course the class must have a .next() function to read the next line etc
i thought of fixing the problem like this, i don't know if it's a good solution or not. Thats why the post.
greetings
jens
|
|
|
|
|
Hi every body,
I'm looking for documentation about the WMF file format.
I would like to create WMF file by myself, but not from existing bitmap pictures.
This file will contains commands to create lines, rectangle, circle, to draw text... But for now, i have some trouble to draw text, select font...
does anybody knows where i can get doc about this, or where i can get some sample code to understand how WMF files work.
I would like to use standard C++ code, to make it works under Windows or/and UNIX.
thanks for your help
Jauss
|
|
|
|
|
|
thanks a lot
this will help me to understand how works WMF files
Jauss
|
|
|
|
|
I have some problem with creating a new class...
Here is what i encountered..
I inserted a new Dialog in my MFC application and when i clicked on it , I got the "Add a Class" Dialog box and i clicked ok for create new class.. i gave a name for the new class ..Starting with a 'C' (like Cmyone, I also tried CmyoneDlg) but i got a message saying "Unable to open files E:.......myone.h and... myone.cpp for class Cmyone..
I dont know why this problem occurs..
Can anyone explain me why?
Thanks
Deepak Samuel
|
|
|
|
|
Yeah had it a few times... bug in Visual C++ I guess... check if your files have been generated (then add them to your project) or try again!
|
|
|
|
|
i never head anything about that problem, but try creating empty myone.cpp/.h before adding the class, maybe it works.. dunno
Don't try it, just do it!
|
|
|
|
|
I've seen it a few times. It was actually incorrect, though, because the files were actually created and were added to the project. Ignore it and move on, I guess.
|
|
|
|
|
If i ignore and move on I couldnt include any more controls in the dialog box..infact even the buttons existing by default (ok &cancel) do not appear in object id section in the class wizard..
|
|
|
|
|
At that point, delete the project's temporary files (i.e., .NCB, .CLW, .APS) and let VS rebuild them.
|
|
|
|
|
Hiw to resize a control on the form in C++ (mfc) ?
for ex. , if my form is maximized then all control has not resizing
sorry for the language english
i am french
tHanKs =)
|
|
|
|
|
Salut Mon Gars!
Ok it is a bit of a common problem... you need to override OnSize in your form, and then call MoveWindow for each of your controls (best to call GetClientRect of your form to get its size first)
By the way, there are a few examples on CodeProject where this can be done automatically
Good luck
|
|
|
|
|
ok ! thanks
this website is a very profesional
vraiment
congraluation
|
|
|
|
|
Hi
I want to make Minesweeper game in VC++.
Thanks
|
|
|
|
|
good for you ...
Is there anything in particular you want to ask ?
Compilation errors ?, GDI problem ? UI question , design question ?
Maximilien Lincourt
"Never underestimate the bandwidth of a station wagon filled with backup tapes." ("Computer Networks" by Andrew S Tannenbaum )
|
|
|
|
|
Sorry
This is not an error, Sir have u ever played a game in Computer, where u will find.
|
|
|
|
|
Sure, we all have. Now what's your Visual C++ question?
|
|
|
|