Re: Dialog box and Custom control

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Giovanni Dicanio ha scritto:
Ehsan Sadeghi ha scritto:

I created a dialog box, put a custom control on it, filled the properties , added headers( custom control) to the dialog box .h file, created a variable of the control,m_Grid, filled the DoDataExchange with DDX_Control(pDX,IDC_GRIDCONTROL,m_Grid) and

If you read the documentation on CodeProject site, you will find that you should replace DDX_Control with DDX_GridControl (see paragraph "Construction" here: http://www.codeproject.com/KB/miscctrl/gridctrl.aspx )

I just created a test VS2008 MFC SDI project and it seems that, including the aforementioned fix, the dialog-box with the grid control is correctly displayed.

You can download the simple test project here:

http://www.geocities.com/giovanni.dicanio/vc/TestGrid.zip

BTW: Note that I had some compiler errors in Chris Munder's original code (stable version 2.25), because of change in behaviour of scope of 'for' loop index in VS2008 with respect to older compilers (probably VC6).

i.e.

for (int i = 0; ... )
{
...
}
int j = i;

compiles fine in VC6 but fails in VS2008, because the scope of the 'i' variable is inside for loop in VS2008 (as C++ standard states).

The above code can be easily modified like this:

int i; // scope of 'i' outside for loop
for (i = 0; ... )
{
...
}
int j = i;

and it compiles fine in VS2008.

HTH,
Giovanni
.



Relevant Pages

  • Re: Custom control wont show in designer
    ... If it does, then since the custom control works fine in a test project, there is probably something wrong with the code that references the custom control. ... private ImageList imageList; ... private int imageListIndex; ... int imageLeft; ...
    (microsoft.public.dotnet.languages.csharp)
  • private functions
    ... you can have a function whose scope is purely within another function. ... Yet here I have a program which compiles without a peep under gcc4.2.1 ... int main ... Nevertheless, icc aborts the ...
    (comp.lang.c)
  • how to localize a web application which makes use of custom control???
    ... makes use of custom control. ... The facts as i know are - ... The scope of the set of resourcesor satellite assembly is limited ... extend to the custom controls also?? ...
    (microsoft.public.dotnet.framework.aspnet)