|
|
Hello,
I have created a menu like the following code
CMenu Data1;
Data1.CreateMenu();
Data1.AppendMenu(MF_STRING ,DataP, "Demand");
CMenu M;
M.CreateMenu();
M.AppendMenu(MF_POPUP ,(UINT)Data1.m_hMenu, "Data");
M.AppendMenu(MF_STRING, Model_EntityP,"Model Entity");
M.AppendMenu(MF_STRING ,EditP, "Edit");
pFrame->SetMenu(&M);
The above code works if I remove the popup Data1 option and then execute the program.
It doesn't allow me to create popups.
Where exactly popups should be added for me to see after I click on the topline menu?
Prithaa
|
|
|
|
|
CMenu Data1;
Data1.CreatePopupMenu();// try this code
Data1.AppendMenu(MF_STRING ,DataP, "Demand");
|
|
|
|
|
prithaa wrote: M.AppendMenu(MF_POPUP ,(UINT)Data1.m_hMenu, "Data");
modify it as below
M.AppendMenu(MF_POPUP ,(UINT)Data1.Detach(), "Data");
nave
|
|
|
|
|
Hello,
Thanks .
I did the required changes in the code and now I am getting the pull down menu which is grayed and not active.
How do I activate the pull down ?
I have written the following code for the pull down
M.AppendMenu(MF_STRING | MF_ENABLED ,DEMAND_ID, "DEMAND");
M.AppendMenu(MF_STRING | MF_ENABLED ,COST_ID, "COST");
Prithaa
|
|
|
|
|
Hi pritha..
overide the OnCmdMsg() function of the view class and return true when the
nID == DEMAND_ID or nId == COST_ID
and
nCode == CN_COMMAND
nave
|
|
|
|
|
Hello,
What ever you have asked me to do it has worked for me .But I don't understand why I have done that.
Especially the OnCmdMsg().Why this method when I have set the nFlags as MF_ENABLED.
You can give me any reference on the topics if explaining the whole thing is tedious.
Thanks It works
Prithaa
|
|
|
|
|
prithaa wrote: Why this method when
Actaully MFC didnt says to do so. In MSDN they are telling to add dummy command handler if we want a menu to be active.
from MSDN:
Disabling the Automatic Disabling of Button Controls
If you place a button control on a dialog bar, or in a dialog using where you are calling CWnd::UpdateDialogControls on your own, you will notice that buttons which do not have ON_COMMAND or ON_UPDATE_COMMAND_UI handlers will be automatically disabled for you by the framework. In some cases, you will not need to have a handler, but you will want the button to remain enabled. The easiest way to achieve this is to add a dummy command handler (easy to do with ClassWizard) and do nothing in it.
nave
|
|
|
|
|
prithaa wrote: What ever you have asked me to do it has worked for me
If any of the answers post by any one was help full for you, please vote for it.
nave
|
|
|
|
|
Hello,
What is this vote for ? I haven't done that before.
Prithaa
|
|
|
|
|
Good morning pritha
in the bottom of message you can find something like.
"Rate this message: 1 2 3 4 5 (out of 5)". Thats called voting.
Well where r u in India?
nave
|
|
|
|
|
Hello
I voted 5 but why is that for?
I am in Mumbai.Where r u?
Pritha
|
|
|
|
|
prithaa wrote: I voted 5 but why is that for?
Actaully for most of the answers we post, we dont gets any replay even though if they got the correct answers. So we dont know whether it helped them or not and so will not be getting any satisfaction in doing this. Voting is just another method of telling how much that post helped him.
prithaa wrote: I am in Mumbai.Where r u?
Basically am from kerala. Working in technopark. but now in Japan doing some onsite work for Tohiba.
nave
|
|
|
|
|
Hello,
Oh that is it. But usually I make it a point to reply back with a many thanks even if it doesn't solve my particular problem since I think that is the least I can do to get my problem solved.Till now I have not answered any questions for codeproject so at least a thanks letter is a must.
I didn't vote till now but my messages end with my message with a thanking note and the person answering my question knows that the topic is done.
All the best for you project.
Thanks Naveen
|
|
|
|
|
Can anybody send me some useful articles (particularly VC++) on
1)motion detection
2)video recording on motion detection
i m waiting for response....
NT
|
|
|
|
|
See Here[^] or here[^]
Regards,
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
My Blog: ^_^
|
|
|
|
|
|
|
Hi,
I am declaring some global variable which i need to use in many .cpp files in the project. Can anyone tell me which is the best place to declare global variable.
Anurag Gandhi.
|
|
|
|
|
declare in .h file and using #include "xxx.h" at cpp files.
|
|
|
|
|
Thanks
Will .cpp file work? because i want some initialization also at the time of declaration.
Anurag Gandhi.
|
|
|
|
|
Anurag Gandhi wrote: Will .cpp file work?
Not by itself. As you are not including a .CPP (You are not, are you?), no other code chunks would know about your global.
Anurag Gandhi wrote: because i want some initialization also at the time of declaration.
Sufficiently recent compilers allow static constants to be initialized in the .h.
If not, you declare in the .H you include everywhere, and define ONCE in a .CPP
Failure is not an option - it's built right in.
|
|
|
|
|
No, Don't put your global in a .h file unless it is a static inside a class. If it's a straight global at file scope you will get a different copy in every compilation unit (.cpp file) that includes the header, not a global variable at all!
Instead put the global in one .cpp file and then declare it as extern in any other where you want to use it, this is the old fashioned 'C' way but it still works.
#include "stdafx.h"<br />
int g_MyGlobal = 5;<br />
#include "stdafx.h"<br />
extern int g_Myglobal;<br />
This is considered very naughty these days as globals are bad Objects . You could consider using a Singleton pattern class instance or static class members for this sort of data.;)
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
I have done it as follows:
Stdafx.cpp
//...
CMyDoc* m_pDoc = NULL;
And then:
CMyView::OnInitialUpdate ()
{
extern CMyDoc* m_pDoc;
m_pDoc = GetDocument ();
}
Then you can use the reference to the ACTUAL document from everywhere, putting the "extern CMyDoc* m_pDoc" anywhere (CObject derived, Dialogs, CFormViews...).
For me it works, so I think it can be used with other type of variables.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
I draged and droped an added registered activex control FPCapX on simple dialog in dialog based application used to display image from hardware attached.
When I start using any of its method which interact with hardware ,it gives this assert in debug mode,and in release mode it simply does not work.Control works very simply in VB applications. Actually each of this methods internally calls InvokeHelper function where the assert comes. When I searched on google about bug I found that
Activex Control is not initialised. Can anyone help on this please.
In google search only one relevant article comes Actually in that article one is trying to set values to activex control before its dialog gets initialised. but I am trying to use capture mwthod of activex far after dialog is loaded and when user clicks button capture. One more point i want to tell you, if instead of drag and drop from control toolbar if I create control using create function of it,it doesnot give assertion but it simply does nothing
|| ART OF LIVING ||
|
|
|
|