|
I think I've solved the problem.
Thanks everybody for your effort. I appreciate it.
My solution:
1. throw out that dynamic creation of menu items
2. create all my popup menus as one resource
3. Use the following:
CMenu MenuGroup;
MenuGroup.LoadMenu(IDR_POPUP_MENUS);
Menu=MenuGroup.GetSubMenu(<number of="" popup="" menu="" to="" use="">);
Menu->TrackPopupMenu(...);
Now I can use the class wizard to handle my menu commands.
I still feel strange about these grayed items. I think disabling them should not be the default action when there is no message handler - it would be better (as for me) to leave them enabled and take no action when user clicks them.
Well, I guess I'll never understand Mircosoft's way of coding.
Thank you very much again.
Greetings to all assembler dudes and especially for C64 demoscene!
|
|
|
|
|
It´s better to gray them out, so that even the managers know that it won´t work.
|
|
|
|
|
How the he@@ can I get the video adapter's name as shown in
'Display properties' dialog ( e.g.: 'Rege Fury/Xpert128/Xpert 2000' )???
Respect...
--BlackSmith--
"With the help of all mighty", 2001, Me.
|
|
|
|
|
With <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/devcons_2303.asp">EnumDisplayDevices</a> (not supported in Windows 95 and NT).
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
In certain situations I want to go right to a dialog after loading a dialog, and I'm wondering how to do this such that the parent dialog is drawn on screen first. For instance, I have dialog A with a button which, when clicked, loads another dialog B. In certain situations I want to pop up this child dialog B right away, as though the user clicked the button. If I set to true a member variable in dialog A, m_bPopupBRightAway, before calling DialogA::DoModal() and check this value at the end of DialogA::OnInitDialog(), dialog A isn't yet drawn on the screen when DialogB comes up. What's the best way to go about doing this so that I get the desired result?
Thanks!
- Jason
(SonorkID 100.611)
In the beginning, teachers taught the 5 W's: who, what, where, when, why. Now it's just a big damn G
|
|
|
|
|
void CMyDlg::OnPaint()
{
if (IsIconic())
{
...
}
else
{
CDialog::OnPaint();
if(m_bFirstTime){
m_bFirstTime=FALSE;
...
}
}
} Where m_bFirstTime is a member variable of the dialog initialized to TRUE .
Another method, suggested by Shog9, is to self-post a user-defined message from OnInitDialog in response to which the second dialog is launched.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Joaquín M López Muñoz wrote:
Another method, suggested by Shog9, is to self-post a user-defined message from OnInitDialog in response to which the second dialog is launched.
Ooh, I like it. Thanks a lot!
- Jason
(SonorkID 100.611)
In the beginning, teachers taught the 5 W's: who, what, where, when, why. Now it's just a big damn G
|
|
|
|
|
I thought I saw a thread on this once but couldnt track it down. I need to know how to get the height of the title bar of a CDialog dlg box. Is it the same function that will return the height for an MDI chld window?
Thanks,
ns
|
|
|
|
|
GetSystemMetrics(SM_CYCAPTION) should do, unless your dialog has somehow changed the default.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
If I call it from a certain dlg class (say in initdialog) this will then return the caption height of the object for that particular class? I guess I'm thinking I dont see something like:
pDlg->GetSystemMetrics, rather it looks like ::GetSystemMetrics, so I was wondering how it knows whose caption height to get. Is it the height of (this)?
Much appreciate your suggestions,
ns
|
|
|
|
|
To the best of my knowledge, all windows have the same caption height (or no caption at all). Windows with nonstandard captions are faking the effect by omitting the system-provided caption and painting something similar on the client area.
If I'm wrong, please someone correct me.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Howdy everyone,
Quick STL question for y'all...
I'm having lots of fun converting some old code from C arrays to std::vectors.
I've got a bool *m_abMatched, and at the start of a function the array must be initialised to false. At the moment this is done with memset( m_abMatched, false, m_cbMatched*sizeof(bool) ).
If I replaced the array with a std::vector<bool> how would I set all the elements of the vector to false? Is m_abMatched::assign( m_abMatched.size(), false ) the correct approach?
TIA,
Pete
|
|
|
|
|
Yes, this is correct.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Joaquin to the rescue again
Thanks!
|
|
|
|
|
it may be correct. but it is an absolutely horrible thing to do, IMO.
To explain Donald Knuth's relevance to computing is like explaining Paul's relevance to the Catholic Church. He isn't God, he isn't the Son of God, but he was sent by God to explain God to the masses. /. #3848917
|
|
|
|
|
how so? What would be a better technique???
|
|
|
|
|
it's true that std::vector is actually spec'd in such a way that running memset on it is perfectly legal, i don't argue that. and, i'm sure it was spec'd that way to specifically allow it to be used as a solid chunk of memory.
but to me, using memset is an abuse of the idea of a vector as an abstract container class. plus, there is an accepable STL/OOP friendly way to do what you're describing:
this will create a vector of 20 bool's all set to false.
std::vector<bool> m(20, false);
-c
To explain Donald Knuth's relevance to computing is like explaining Paul's relevance to the Catholic Church. He isn't God, he isn't the Son of God, but he was sent by God to explain God to the masses. /. #3848917
|
|
|
|
|
I wasn't asking about using memset, I was asking what to use to _replace_ memset on a C array.
I'm assuming using m_abMatched.assign( m_abMatched.size(), false ) would be a little bit quicker (and clearer) than m_abMatched = std::vector<bool>( m_abMatched.size(), false), right?
Thanks,
Pete
|
|
|
|
|
ah
yeah, that was my evil twin, trying to toss some confusion into other people's lives.
i'll send him away
-c
To explain Donald Knuth's relevance to computing is like explaining Paul's relevance to the Catholic Church. He isn't God, he isn't the Son of God, but he was sent by God to explain God to the masses. /. #3848917
|
|
|
|
|
Damn those evil twins. Mine causes no end of trouble
Anyways, std::fill() is more understandable than std::vector::assign() in this case
Pete
|
|
|
|
|
This is a more understandable form:
std::fill(v.begin(),v.end(),false); Nevertheless, the latter is less advisable in some pedantic subtle way, namely that std::vector::assign could be partially specialized to perform faster on some primitive types (not that VC++ does it, anyway.)
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
more understandable, and safer...
it's pretty easy to see memset flying off the end of the vector and writing into the stack somewhere.
-c
To explain Donald Knuth's relevance to computing is like explaining Paul's relevance to the Catholic Church. He isn't God, he isn't the Son of God, but he was sent by God to explain God to the masses. /. #3848917
|
|
|
|
|
?? Maybe you have misread the guy's question. He was asking about the suitability of
m_abMatched::assign(m_abMatched.size(), false) as a replacement of memset . And this (assign ) is perfectly safe.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hello,
I have a few questions I'd like to ask and see if anybody knows anything about this.
First of all, my MDI project starts with an open window. This is great. I want this window to be uncloseable. How do I disable the X (close) button? I want this window never to close.
Second, I get live images in one window, but I'd like to snap and have the image appear in a new window. Right now, the snap appears in the same type of window, so the same type of options apply to it (chaning the contrast or brightness or any example you can think of). I want the snap window to have a different set of avaible drop down options (i.e. I'd like to make some grayed out or unusable).
So I am thinking using a new document template would be the way to go here.
What do you guys think about that? And if you could answer how to gray out the options and how to make sure my first window never closes, I'd sure like to know how to do that. Pleas let me know if I am on the right track with using a new Document Template.
Thanks guys,
NickOne
You guys rock!
p.s. How can I tell if there is a memory leak? Sometimes my program, when I try to close the window crashes and becomes unresponsive. This is a feature I sure don't like!!! Any ideas?
Thanks again!!
|
|
|
|
|
NickWhoForgotHisPasswordToLogIn wrote:
NickWhoForgotHisPasswordToLogIn
Lookup your password here
Jon Sagara
"Me fail English? That's unpossible."
"Hello Supernintendo Chalmers. I'm lernding."
--- Ralph Wiggum ---
|
|
|
|