P1R
asked on
PropertyPage disappears mysteriously
I have a PropertySheet with 5 PropertyPages in my SDI-app. If I just do the following:
1) Open the PropertySheet.
2) Select PropertyPage 4.
3) Close the PropertySheet.
and repeating this about 30 to 40 times then the PropertyPage 4 disappears when trying to select that page.
* The other pages still work as usual. The order of the pages does not matter, i.e. if I put the page as number 5 it still disappears.
* The page only contains some buttons and a lot of checkboxes (2 Group Boxes, 4 Push buttons, 69 Check Boxes).
* If I reduce the number of Check Boxes to 50 then it seems OK, but 51 Check Boxes gives the same error.
* I do not get any warnings about memory leaks and the CPU and memory usage is the same.
* I am using VC++6 and MFC.
I have put a trace on the WindowProc(UINT message, WPARAM wParam, LPARAM lParam) function for the PropertyPage.
The following messages are received when everything is OK:
WM_NCCREATE
WM_NCCALCSIZE
WM_CREATE
WM_SIZE
WM_MOVE
WM_SETFONT
WM_INITDIALOG
... and a lot more.
When it fails the following messages are received:
WM_NCCREATE
WM_NCCALCSIZE
WM_CREATE
WM_SIZE
WM_MOVE
WM_SETFONT
WM_DESTROY
WM_NCDESTROY
Does anybody have any ideas about what is causing this problem or have any suggestions about how to find out more about what is causing this?
This is very annoying and confusing and I am totally stuck here so any kind of help/suggestions would be very much appreciated. Thanks!
/P1R
1) Open the PropertySheet.
2) Select PropertyPage 4.
3) Close the PropertySheet.
and repeating this about 30 to 40 times then the PropertyPage 4 disappears when trying to select that page.
* The other pages still work as usual. The order of the pages does not matter, i.e. if I put the page as number 5 it still disappears.
* The page only contains some buttons and a lot of checkboxes (2 Group Boxes, 4 Push buttons, 69 Check Boxes).
* If I reduce the number of Check Boxes to 50 then it seems OK, but 51 Check Boxes gives the same error.
* I do not get any warnings about memory leaks and the CPU and memory usage is the same.
* I am using VC++6 and MFC.
I have put a trace on the WindowProc(UINT message, WPARAM wParam, LPARAM lParam) function for the PropertyPage.
The following messages are received when everything is OK:
WM_NCCREATE
WM_NCCALCSIZE
WM_CREATE
WM_SIZE
WM_MOVE
WM_SETFONT
WM_INITDIALOG
... and a lot more.
When it fails the following messages are received:
WM_NCCREATE
WM_NCCALCSIZE
WM_CREATE
WM_SIZE
WM_MOVE
WM_SETFONT
WM_DESTROY
WM_NCDESTROY
Does anybody have any ideas about what is causing this problem or have any suggestions about how to find out more about what is causing this?
This is very annoying and confusing and I am totally stuck here so any kind of help/suggestions would be very much appreciated. Thanks!
/P1R
I have the same feeling as joghurt - resources not being freed up. 75 controls should not be hitting a limit.
Are you doing anything special with the controls on this page (owner draw for example, creating dynamically in code).
Are you doing anything special with the controls on this page (owner draw for example, creating dynamically in code).
ASKER
* I have only seen the problem in WinXP.
* The CPropertyPage objects are declared as members of the derived CPropertySheet class and should thus be destroyed by the default destructor.
I am aware of that a GUI with many check boxes is not very nice, but in this case there are a lot of features that could be selected and I am not sure if it would be more intuitive if I split them into additional PropertyPages instead. (Suggestions?)
* The CPropertyPage objects are declared as members of the derived CPropertySheet class and should thus be destroyed by the default destructor.
I am aware of that a GUI with many check boxes is not very nice, but in this case there are a lot of features that could be selected and I am not sure if it would be more intuitive if I split them into additional PropertyPages instead. (Suggestions?)
ASKER
I am not doing anything special with the controls. Originally there are control variables (DDX_Check) for each check box, but I have tried to comment out that part but with the same result.
Have you used the system monitor to track resource usage as you perform this action?
Suggestions?
Check list box (or a few with common items grouped together)
Combo with predefined 'styles' that set/unset / hide/show numbers of checkbox's at one go.
Suggestions?
Check list box (or a few with common items grouped together)
Combo with predefined 'styles' that set/unset / hide/show numbers of checkbox's at one go.
ASKER
I have used the system monitor but there is no difference when the PropertyPage is shown or when it fails. The memory and CPU usage is almost constant during the entire test.
resource handles not system memory
ASKER
Do you mean the number of threads and processes? Those are constant during the test.
NOOO. Resource and GDI handles such are window handles, bitmap handles, brush handles, etc. And the size of the resource and the GDI heap.
Most people know about the 64k (in fact, 60k) GDI heap limit on Win9x because internally they use the old 16-bit subsystem.
However, most people think that it's all solved in NT/2k/XP because they have real 32-bit system so you have 2 gigabytes for resources.
Not quite. In fact you have only about 2 megabytes that can be easily exhausted if you leak resources in numbers and use XP's fancy stuff.
Most people know about the 64k (in fact, 60k) GDI heap limit on Win9x because internally they use the old 16-bit subsystem.
However, most people think that it's all solved in NT/2k/XP because they have real 32-bit system so you have 2 gigabytes for resources.
Not quite. In fact you have only about 2 megabytes that can be easily exhausted if you leak resources in numbers and use XP's fancy stuff.
The is a utility - performance monitor - There you can select from a horrendous array of things to monitor. Try selecting handles (or others) and see what happens as you switch to/from this tab.
ASKER
OK now I have found the performance monitor (thanks). I have selected my process and handles and threads. Both handles and threads are rather constant during the test.
I have also tried to split the property page into two pages, but the result is still the same.
I have also tried to split the property page into two pages, but the result is still the same.
can you post the code of this page4 here? (not just a little bit of the page, the whole lot).
ASKER
OK, here it comes. First the .h file and then the .cpp file.
#if !defined(AFX_RESULTSVIEWSE LECTIONPAG E_H__CDAC1 C53_04CD_1 1D1_99F4_0 020AF563EB 1__INCLUDE D_)
#define AFX_RESULTSVIEWSELECTIONPA GE_H__CDAC 1C53_04CD_ 11D1_99F4_ 0020AF563E B1__INCLUD ED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// ResultsViewSelectionPage.h : header file
//
////////////////////////// ////////// ////////// ////////// ////////// ////////// /
// CResultsViewSelectionPage dialog
class CResultsViewSelectionPage : public CPropertyPage
{
friend class CResultsSheet;
DECLARE_DYNCREATE(CResults ViewSelect ionPage)
// Construction
public:
void setSelectedObjectParams(__ int64 params);
void setSelectedFieldParams(__i nt64 params);
CResultsViewSelectionPage( );
~CResultsViewSelectionPage ();
// Dialog Data
//{{AFX_DATA(CResultsViewS electionPa ge)
enum { IDD = IDD_RESULTS_VIEW_SELECTION _PAGE };
BOOL fieldAreaOfRoi;
BOOL fieldAreaInRoi;
BOOL fieldAreaFraction;
BOOL fieldArea;
BOOL fieldPerimeter;
BOOL fieldFeretX;
BOOL fieldFeretY;
BOOL fieldFeretMinDiameter;
BOOL fieldFeretMinAngle;
BOOL fieldFeretMaxDiameter;
BOOL fieldFeretMaxAngle;
BOOL fieldFeretMeanDiameter;
BOOL fieldFeretElongation;
BOOL fieldConvexPerimeter;
BOOL fieldCompactness;
BOOL fieldNumberOfHoles;
BOOL fieldRoughness;
BOOL fieldLength;
BOOL fieldBreadth;
BOOL fieldElongation;
BOOL fieldSumPixel;
BOOL fieldMinPixel;
BOOL fieldMaxPixel;
BOOL fieldMeanPixel;
BOOL fieldSigmaPixel;
BOOL fieldSumPixelSquared;
BOOL fieldCenterOfGravityX;
BOOL fieldCenterOfGravityY;
BOOL fieldCount;
BOOL fieldObjectCount;
BOOL fieldFeretMinVolume;
BOOL fieldFeretMaxVolume;
BOOL fieldFeretMeanVolume;
BOOL fieldInnerDiameter;
BOOL fieldInnerVolume;
BOOL fieldCorrespondingSphere;
BOOL fieldCorrespondingDiameter ;
BOOL objectArea;
BOOL objectPerimeter;
BOOL objectFeretX;
BOOL objectFeretY;
BOOL objectFeretMinDiameter;
BOOL objectFeretMinAngle;
BOOL objectFeretMaxDiameter;
BOOL objectFeretMaxAngle;
BOOL objectFeretMeanDiameter;
BOOL objectFeretElongation;
BOOL objectConvexPerimeter;
BOOL objectCompactness;
BOOL objectNumberOfHoles;
BOOL objectRoughness;
BOOL objectLength;
BOOL objectBreadth;
BOOL objectElongation;
BOOL objectSumPixel;
BOOL objectMinPixel;
BOOL objectMaxPixel;
BOOL objectMeanPixel;
BOOL objectSigmaPixel;
BOOL objectSumPixelSquared;
BOOL objectCenterOfGravityX;
BOOL objectCenterOfGravityY;
BOOL objectFeretMinVolume;
BOOL objectFeretMaxVolume;
BOOL objectFeretMeanVolume;
BOOL objectInnerDiameter;
BOOL objectInnerVolume;
BOOL objectCorrespondingSphere;
BOOL objectCorrespondingDiamete r;
//}}AFX_DATA
// Overrides
// ClassWizard generate virtual function overrides
//{{AFX_VIRTUAL(CResultsVi ewSelectio nPage)
public:
virtual BOOL OnKillActive();
virtual BOOL OnSetActive();
protected:
virtual void DoDataExchange(CDataExchan ge* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
CResultViewSelection* selection;
void setData();
void getData();
// Generated message map functions
//{{AFX_MSG(CResultsViewSe lectionPag e)
afx_msg void OnSelectAllFieldParams();
afx_msg void OnSelectAllObjectParams();
afx_msg void OnSelectNoFieldParams();
afx_msg void OnSelectNoObjectParams();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_RESULTSVIEWSE LECTIONPAG E_H__CDAC1 C53_04CD_1 1D1_99F4_0 020AF563EB 1__INCLUDE D_)
// ResultsViewSelectionPage.c pp : implementation file
//
#include "stdafx.h"
#include "ImageAnalysis.h"
#include "ResultsViewSelectionPage. h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
////////////////////////// ////////// ////////// ////////// ////////// ////////// /
// CResultsViewSelectionPage property page
IMPLEMENT_DYNCREATE(CResul tsViewSele ctionPage, CPropertyPage)
CResultsViewSelectionPage: :CResultsV iewSelecti onPage() : CPropertyPage(CResultsView SelectionP age::IDD)
{
//{{AFX_DATA_INIT(CResults ViewSelect ionPage)
fieldAreaOfRoi = FALSE;
fieldAreaInRoi = FALSE;
fieldAreaFraction = FALSE;
fieldArea = FALSE;
fieldPerimeter = FALSE;
fieldFeretX = FALSE;
fieldFeretY = FALSE;
fieldFeretMinDiameter = FALSE;
fieldFeretMinAngle = FALSE;
fieldFeretMaxDiameter = FALSE;
fieldFeretMaxAngle = FALSE;
fieldFeretMeanDiameter = FALSE;
fieldFeretElongation = FALSE;
fieldConvexPerimeter = FALSE;
fieldCompactness = FALSE;
fieldNumberOfHoles = FALSE;
fieldRoughness = FALSE;
fieldLength = FALSE;
fieldBreadth = FALSE;
fieldElongation = FALSE;
fieldSumPixel = FALSE;
fieldMinPixel = FALSE;
fieldMaxPixel = FALSE;
fieldMeanPixel = FALSE;
fieldSigmaPixel = FALSE;
fieldSumPixelSquared = FALSE;
fieldCenterOfGravityX = FALSE;
fieldCenterOfGravityY = FALSE;
fieldCount = FALSE;
fieldObjectCount = FALSE;
fieldFeretMinVolume = FALSE;
fieldFeretMaxVolume = FALSE;
fieldFeretMeanVolume = FALSE;
fieldInnerDiameter = FALSE;
fieldInnerVolume = FALSE;
fieldCorrespondingSphere = FALSE;
fieldCorrespondingDiameter = FALSE;
objectArea = FALSE;
objectPerimeter = FALSE;
objectFeretX = FALSE;
objectFeretY = FALSE;
objectFeretMinDiameter = FALSE;
objectFeretMinAngle = FALSE;
objectFeretMaxDiameter = FALSE;
objectFeretMaxAngle = FALSE;
objectFeretMeanDiameter = FALSE;
objectFeretElongation = FALSE;
objectConvexPerimeter = FALSE;
objectCompactness = FALSE;
objectNumberOfHoles = FALSE;
objectRoughness = FALSE;
objectLength = FALSE;
objectBreadth = FALSE;
objectElongation = FALSE;
objectSumPixel = FALSE;
objectMinPixel = FALSE;
objectMaxPixel = FALSE;
objectMeanPixel = FALSE;
objectSigmaPixel = FALSE;
objectSumPixelSquared = FALSE;
objectCenterOfGravityX = FALSE;
objectCenterOfGravityY = FALSE;
objectFeretMinVolume = FALSE;
objectFeretMaxVolume = FALSE;
objectFeretMeanVolume = FALSE;
objectInnerDiameter = FALSE;
objectInnerVolume = FALSE;
objectCorrespondingSphere = FALSE;
objectCorrespondingDiamete r = FALSE;
//}}AFX_DATA_INIT
m_psp.dwFlags &= ~(PSP_HASHELP);
}
CResultsViewSelectionPage: :~CResults ViewSelect ionPage()
{
}
void CResultsViewSelectionPage: :DoDataExc hange(CDat aExchange* pDX)
{
CPropertyPage::DoDataExcha nge(pDX);
//{{AFX_DATA_MAP(CResultsV iewSelecti onPage)
DDX_Check(pDX, IDC_F_AREA_OF_ROI, fieldAreaOfRoi);
DDX_Check(pDX, IDC_F_AREA_IN_ROI, fieldAreaInRoi);
DDX_Check(pDX, IDC_F_AREA_FRACTION, fieldAreaFraction);
DDX_Check(pDX, IDC_F_AREA, fieldArea);
DDX_Check(pDX, IDC_F_PERIMETER, fieldPerimeter);
DDX_Check(pDX, IDC_F_FERET_X, fieldFeretX);
DDX_Check(pDX, IDC_F_FERET_Y, fieldFeretY);
DDX_Check(pDX, IDC_F_FERET_MIN_DIAMETER, fieldFeretMinDiameter);
DDX_Check(pDX, IDC_F_FERET_MIN_ANGLE, fieldFeretMinAngle);
DDX_Check(pDX, IDC_F_FERET_MAX_DIAMETER, fieldFeretMaxDiameter);
DDX_Check(pDX, IDC_F_FERET_MAX_ANGLE, fieldFeretMaxAngle);
DDX_Check(pDX, IDC_F_FERET_MEAN_DIAMETER, fieldFeretMeanDiameter);
DDX_Check(pDX, IDC_F_FERET_ELONGATION, fieldFeretElongation);
DDX_Check(pDX, IDC_F_CONVEX_PERIMETER, fieldConvexPerimeter);
DDX_Check(pDX, IDC_F_COMPACTNESS, fieldCompactness);
DDX_Check(pDX, IDC_F_NUMBER_OF_HOLES, fieldNumberOfHoles);
DDX_Check(pDX, IDC_F_ROUGHNESS, fieldRoughness);
DDX_Check(pDX, IDC_F_LENGTH, fieldLength);
DDX_Check(pDX, IDC_F_BREADTH, fieldBreadth);
DDX_Check(pDX, IDC_F_ELONGATION, fieldElongation);
DDX_Check(pDX, IDC_F_SUM_PIXEL, fieldSumPixel);
DDX_Check(pDX, IDC_F_MIN_PIXEL, fieldMinPixel);
DDX_Check(pDX, IDC_F_MAX_PIXEL, fieldMaxPixel);
DDX_Check(pDX, IDC_F_MEAN_PIXEL, fieldMeanPixel);
DDX_Check(pDX, IDC_F_SIGMA_PIXEL, fieldSigmaPixel);
DDX_Check(pDX, IDC_F_SUM_PIXEL_SQUARED, fieldSumPixelSquared);
DDX_Check(pDX, IDC_F_COG_X, fieldCenterOfGravityX);
DDX_Check(pDX, IDC_F_COG_Y, fieldCenterOfGravityY);
DDX_Check(pDX, IDC_F_COUNT, fieldCount);
DDX_Check(pDX, IDC_F_OBJECT_COUNT, fieldObjectCount);
DDX_Check(pDX, IDC_F_FERET_MIN_VOLUME, fieldFeretMinVolume);
DDX_Check(pDX, IDC_F_FERET_MAX_VOLUME, fieldFeretMaxVolume);
DDX_Check(pDX, IDC_F_FERET_MEAN_VOLUME, fieldFeretMeanVolume);
DDX_Check(pDX, IDC_F_INNER_DIAMETER, fieldInnerDiameter);
DDX_Check(pDX, IDC_F_INNER_VOLUME, fieldInnerVolume);
DDX_Check(pDX, IDC_F_CORRESPONDING_SPHERE , fieldCorrespondingSphere);
DDX_Check(pDX, IDC_F_CORRESPONDING_DIAMET ER, fieldCorrespondingDiameter );
DDX_Check(pDX, IDC_O_AREA, objectArea);
DDX_Check(pDX, IDC_O_PERIMETER, objectPerimeter);
DDX_Check(pDX, IDC_O_FERET_X, objectFeretX);
DDX_Check(pDX, IDC_O_FERET_Y, objectFeretY);
DDX_Check(pDX, IDC_O_FERET_MIN_DIAMETER, objectFeretMinDiameter);
DDX_Check(pDX, IDC_O_FERET_MIN_ANGLE, objectFeretMinAngle);
DDX_Check(pDX, IDC_O_FERET_MAX_DIAMETER, objectFeretMaxDiameter);
DDX_Check(pDX, IDC_O_FERET_MAX_ANGLE, objectFeretMaxAngle);
DDX_Check(pDX, IDC_O_FERET_MEAN_DIAMETER, objectFeretMeanDiameter);
DDX_Check(pDX, IDC_O_FERET_ELONGATION, objectFeretElongation);
DDX_Check(pDX, IDC_O_CONVEX_PERIMETER, objectConvexPerimeter);
DDX_Check(pDX, IDC_O_COMPACTNESS, objectCompactness);
DDX_Check(pDX, IDC_O_NUMBER_OF_HOLES, objectNumberOfHoles);
DDX_Check(pDX, IDC_O_ROUGHNESS, objectRoughness);
DDX_Check(pDX, IDC_O_LENGTH, objectLength);
DDX_Check(pDX, IDC_O_BREADTH, objectBreadth);
DDX_Check(pDX, IDC_O_ELONGATION, objectElongation);
DDX_Check(pDX, IDC_O_SUM_PIXEL, objectSumPixel);
DDX_Check(pDX, IDC_O_MIN_PIXEL, objectMinPixel);
DDX_Check(pDX, IDC_O_MAX_PIXEL, objectMaxPixel);
DDX_Check(pDX, IDC_O_MEAN_PIXEL, objectMeanPixel);
DDX_Check(pDX, IDC_O_SIGMA_PIXEL, objectSigmaPixel);
DDX_Check(pDX, IDC_O_SUM_PIXEL_SQUARED, objectSumPixelSquared);
DDX_Check(pDX, IDC_O_COG_X, objectCenterOfGravityX);
DDX_Check(pDX, IDC_O_COG_Y, objectCenterOfGravityY);
DDX_Check(pDX, IDC_O_FERET_MIN_VOLUME, objectFeretMinVolume);
DDX_Check(pDX, IDC_O_FERET_MAX_VOLUME, objectFeretMaxVolume);
DDX_Check(pDX, IDC_O_FERET_MEAN_VOLUME, objectFeretMeanVolume);
DDX_Check(pDX, IDC_O_INNER_DIAMETER, objectInnerDiameter);
DDX_Check(pDX, IDC_O_INNER_VOLUME, objectInnerVolume);
DDX_Check(pDX, IDC_O_CORRESPONDING_SPHERE , objectCorrespondingSphere) ;
DDX_Check(pDX, IDC_O_CORRESPONDING_DIAMET ER, objectCorrespondingDiamete r);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CResults ViewSelect ionPage, CPropertyPage)
//{{AFX_MSG_MAP(CResultsVi ewSelectio nPage)
ON_BN_CLICKED(IDC_SELECT_A LL_FIELD_P ARAMS, OnSelectAllFieldParams)
ON_BN_CLICKED(IDC_SELECT_A LL_OBJECT_ PARAMS, OnSelectAllObjectParams)
ON_BN_CLICKED(IDC_SELECT_N O_FIELD_PA RAMS, OnSelectNoFieldParams)
ON_BN_CLICKED(IDC_SELECT_N O_OBJECT_P ARAMS, OnSelectNoObjectParams)
ON_WM_DESTROY()
ON_WM_KILLFOCUS()
ON_WM_LBUTTONDOWN()
ON_WM_PAINT()
ON_WM_SHOWWINDOW()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
////////////////////////// ////////// ////////// ////////// ////////// ////////// /
// CResultsViewSelectionPage message handlers
BOOL CResultsViewSelectionPage: :OnKillAct ive()
{
getData();
return CPropertyPage::OnKillActiv e();
}
BOOL CResultsViewSelectionPage: :OnSetActi ve()
{
setData();
return CPropertyPage::OnSetActive ();
}
////////////////////////// ////////// ////////// ////////// ////////// ////////// /
void CResultsViewSelectionPage: :setData()
{
ASSERT(selection != NULL);
fieldCount = selection->fieldCount;
fieldObjectCount = selection->fieldObjectCoun t;
fieldAreaOfRoi = selection->fieldAreaOfRoi;
fieldAreaInRoi = selection->fieldAreaInRoi;
fieldAreaFraction = selection->fieldAreaFracti on;
fieldArea = selection->fieldArea;
fieldPerimeter = selection->fieldPerimeter;
fieldFeretX = selection->fieldFeretX;
fieldFeretY = selection->fieldFeretY;
fieldFeretMinDiameter = selection->fieldFeretMinDi ameter;
fieldFeretMinAngle = selection->fieldFeretMinAn gle;
fieldFeretMaxDiameter = selection->fieldFeretMaxDi ameter;
fieldFeretMaxAngle = selection->fieldFeretMaxAn gle;
fieldFeretMeanDiameter = selection->fieldFeretMeanD iameter;
fieldFeretElongation = selection->fieldFeretElong ation;
fieldFeretMinVolume = selection->fieldFeretMinVo lume;
fieldFeretMaxVolume = selection->fieldFeretMaxVo lume;
fieldFeretMeanVolume = selection->fieldFeretMeanV olume;
fieldConvexPerimeter = selection->fieldConvexPeri meter;
fieldCompactness = selection->fieldCompactnes s;
fieldNumberOfHoles = selection->fieldNumberOfHo les;
fieldRoughness = selection->fieldRoughness;
fieldLength = selection->fieldLength;
fieldBreadth = selection->fieldBreadth;
fieldElongation = selection->fieldElongation ;
fieldSumPixel = selection->fieldSumPixel;
fieldMinPixel = selection->fieldMinPixel;
fieldMaxPixel = selection->fieldMaxPixel;
fieldMeanPixel = selection->fieldMeanPixel;
fieldSigmaPixel = selection->fieldSigmaPixel ;
fieldSumPixelSquared = selection->fieldSumPixelSq uared;
fieldCenterOfGravityX = selection->fieldCenterOfGr avityX;
fieldCenterOfGravityY = selection->fieldCenterOfGr avityY;
fieldInnerDiameter = selection->fieldInnerDiame ter;
fieldInnerVolume = selection->fieldInnerVolum e;
fieldCorrespondingSphere = selection->fieldCorrespond ingSphere;
fieldCorrespondingDiameter = selection->fieldCorrespond ingDiamete r;
// Object
objectArea = selection->objectArea;
objectPerimeter = selection->objectPerimeter ;
objectFeretX = selection->objectFeretX;
objectFeretY = selection->objectFeretY;
objectFeretMinDiameter = selection->objectFeretMinD iameter;
objectFeretMinAngle = selection->objectFeretMinA ngle;
objectFeretMaxDiameter = selection->objectFeretMaxD iameter;
objectFeretMaxAngle = selection->objectFeretMaxA ngle;
objectFeretMeanDiameter = selection->objectFeretMean Diameter;
objectFeretElongation = selection->objectFeretElon gation;
objectFeretMinVolume = selection->objectFeretMinV olume;
objectFeretMaxVolume = selection->objectFeretMaxV olume;
objectFeretMeanVolume = selection->objectFeretMean Volume;
objectConvexPerimeter = selection->objectConvexPer imeter;
objectCompactness = selection->objectCompactne ss;
objectNumberOfHoles = selection->objectNumberOfH oles;
objectRoughness = selection->objectRoughness ;
objectLength = selection->objectLength;
objectBreadth = selection->objectBreadth;
objectElongation = selection->objectElongatio n;
objectSumPixel = selection->objectSumPixel;
objectMinPixel = selection->objectMinPixel;
objectMaxPixel = selection->objectMaxPixel;
objectMeanPixel = selection->objectMeanPixel ;
objectSigmaPixel = selection->objectSigmaPixe l;
objectSumPixelSquared = selection->objectSumPixelS quared;
objectCenterOfGravityX = selection->objectCenterOfG ravityX;
objectCenterOfGravityY = selection->objectCenterOfG ravityY;
objectInnerDiameter = selection->objectInnerDiam eter;
objectInnerVolume = selection->objectInnerVolu me;
objectCorrespondingSphere = selection->objectCorrespon dingSphere ;
objectCorrespondingDiamete r = selection->objectCorrespon dingDiamet er;
UpdateData(FALSE);
}
void CResultsViewSelectionPage: :getData()
{
ASSERT(selection != NULL);
UpdateData();
selection->fieldCount = fieldCount;
selection->fieldObjectCoun t = fieldObjectCount;
selection->fieldAreaOfRoi = fieldAreaOfRoi;
selection->fieldAreaInRoi = fieldAreaInRoi;
selection->fieldAreaFracti on = fieldAreaFraction;
selection->fieldArea = fieldArea;
selection->fieldPerimeter = fieldPerimeter;
selection->fieldFeretX = fieldFeretX;
selection->fieldFeretY = fieldFeretY;
selection->fieldFeretMinDi ameter = fieldFeretMinDiameter;
selection->fieldFeretMinAn gle = fieldFeretMinAngle;
selection->fieldFeretMaxDi ameter = fieldFeretMaxDiameter;
selection->fieldFeretMaxAn gle = fieldFeretMaxAngle;
selection->fieldFeretMeanD iameter = fieldFeretMeanDiameter;
selection->fieldFeretElong ation = fieldFeretElongation;
selection->fieldFeretMinVo lume = fieldFeretMinVolume;
selection->fieldFeretMaxVo lume = fieldFeretMaxVolume;
selection->fieldFeretMeanV olume = fieldFeretMeanVolume;
selection->fieldConvexPeri meter = fieldConvexPerimeter;
selection->fieldCompactnes s = fieldCompactness;
selection->fieldNumberOfHo les = fieldNumberOfHoles;
selection->fieldRoughness = fieldRoughness;
selection->fieldLength = fieldLength;
selection->fieldBreadth = fieldBreadth;
selection->fieldElongation = fieldElongation;
selection->fieldSumPixel = fieldSumPixel;
selection->fieldMinPixel = fieldMinPixel;
selection->fieldMaxPixel = fieldMaxPixel;
selection->fieldMeanPixel = fieldMeanPixel;
selection->fieldSigmaPixel = fieldSigmaPixel;
selection->fieldSumPixelSq uared = fieldSumPixelSquared;
selection->fieldCenterOfGr avityX = fieldCenterOfGravityX;
selection->fieldCenterOfGr avityY = fieldCenterOfGravityY;
selection->fieldInnerDiame ter = fieldInnerDiameter;
selection->fieldInnerVolum e = fieldInnerVolume;
selection->fieldCorrespond ingSphere = fieldCorrespondingSphere;
selection->fieldCorrespond ingDiamete r = fieldCorrespondingDiameter ;
// Object
selection->objectArea = objectArea;
selection->objectPerimeter = objectPerimeter;
selection->objectFeretX = objectFeretX;
selection->objectFeretY = objectFeretY;
selection->objectFeretMinD iameter = objectFeretMinDiameter;
selection->objectFeretMinA ngle = objectFeretMinAngle;
selection->objectFeretMaxD iameter = objectFeretMaxDiameter;
selection->objectFeretMaxA ngle = objectFeretMaxAngle;
selection->objectFeretMean Diameter = objectFeretMeanDiameter;
selection->objectFeretElon gation = objectFeretElongation;
selection->objectFeretMinV olume = objectFeretMinVolume;
selection->objectFeretMaxV olume = objectFeretMaxVolume;
selection->objectFeretMean Volume = objectFeretMeanVolume;
selection->objectConvexPer imeter = objectConvexPerimeter;
selection->objectCompactne ss = objectCompactness;
selection->objectNumberOfH oles = objectNumberOfHoles;
selection->objectRoughness = objectRoughness;
selection->objectLength = objectLength;
selection->objectBreadth = objectBreadth;
selection->objectElongatio n = objectElongation;
selection->objectSumPixel = objectSumPixel;
selection->objectMinPixel = objectMinPixel;
selection->objectMaxPixel = objectMaxPixel;
selection->objectMeanPixel = objectMeanPixel;
selection->objectSigmaPixe l = objectSigmaPixel;
selection->objectSumPixelS quared = objectSumPixelSquared;
selection->objectCenterOfG ravityX = objectCenterOfGravityX;
selection->objectCenterOfG ravityY = objectCenterOfGravityY;
selection->objectInnerDiam eter = objectInnerDiameter;
selection->objectInnerVolu me = objectInnerVolume;
selection->objectCorrespon dingSphere = objectCorrespondingSphere;
selection->objectCorrespon dingDiamet er = objectCorrespondingDiamete r;
}
////////////////////////// ////////// ////////// ////////// ////////// ////////// /
void CResultsViewSelectionPage: :OnSelectA llFieldPar ams()
{
ASSERT(selection != NULL);
getData();
selection->selectAllFieldP arams();
setData();
}
void CResultsViewSelectionPage: :OnSelectN oFieldPara ms()
{
ASSERT(selection != NULL);
getData();
selection->deSelectAllFiel dParams();
setData();
}
void CResultsViewSelectionPage: :OnSelectA llObjectPa rams()
{
ASSERT(selection != NULL);
getData();
selection->selectAllObject Params();
setData();
}
void CResultsViewSelectionPage: :OnSelectN oObjectPar ams()
{
ASSERT(selection != NULL);
getData();
selection->deSelectAllObje ctParams() ;
setData();
}
// -------------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- -
void CResultsViewSelectionPage: :setSelect edFieldPar ams(__int6 4 params)
{
selection->setSelectedFiel dParams(pa rams);
}
void CResultsViewSelectionPage: :setSelect edObjectPa rams(__int 64 params)
{
selection->setSelectedObje ctParams(p arams);
}
#if !defined(AFX_RESULTSVIEWSE
#define AFX_RESULTSVIEWSELECTIONPA
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// ResultsViewSelectionPage.h
//
//////////////////////////
// CResultsViewSelectionPage dialog
class CResultsViewSelectionPage : public CPropertyPage
{
friend class CResultsSheet;
DECLARE_DYNCREATE(CResults
// Construction
public:
void setSelectedObjectParams(__
void setSelectedFieldParams(__i
CResultsViewSelectionPage(
~CResultsViewSelectionPage
// Dialog Data
//{{AFX_DATA(CResultsViewS
enum { IDD = IDD_RESULTS_VIEW_SELECTION
BOOL fieldAreaOfRoi;
BOOL fieldAreaInRoi;
BOOL fieldAreaFraction;
BOOL fieldArea;
BOOL fieldPerimeter;
BOOL fieldFeretX;
BOOL fieldFeretY;
BOOL fieldFeretMinDiameter;
BOOL fieldFeretMinAngle;
BOOL fieldFeretMaxDiameter;
BOOL fieldFeretMaxAngle;
BOOL fieldFeretMeanDiameter;
BOOL fieldFeretElongation;
BOOL fieldConvexPerimeter;
BOOL fieldCompactness;
BOOL fieldNumberOfHoles;
BOOL fieldRoughness;
BOOL fieldLength;
BOOL fieldBreadth;
BOOL fieldElongation;
BOOL fieldSumPixel;
BOOL fieldMinPixel;
BOOL fieldMaxPixel;
BOOL fieldMeanPixel;
BOOL fieldSigmaPixel;
BOOL fieldSumPixelSquared;
BOOL fieldCenterOfGravityX;
BOOL fieldCenterOfGravityY;
BOOL fieldCount;
BOOL fieldObjectCount;
BOOL fieldFeretMinVolume;
BOOL fieldFeretMaxVolume;
BOOL fieldFeretMeanVolume;
BOOL fieldInnerDiameter;
BOOL fieldInnerVolume;
BOOL fieldCorrespondingSphere;
BOOL fieldCorrespondingDiameter
BOOL objectArea;
BOOL objectPerimeter;
BOOL objectFeretX;
BOOL objectFeretY;
BOOL objectFeretMinDiameter;
BOOL objectFeretMinAngle;
BOOL objectFeretMaxDiameter;
BOOL objectFeretMaxAngle;
BOOL objectFeretMeanDiameter;
BOOL objectFeretElongation;
BOOL objectConvexPerimeter;
BOOL objectCompactness;
BOOL objectNumberOfHoles;
BOOL objectRoughness;
BOOL objectLength;
BOOL objectBreadth;
BOOL objectElongation;
BOOL objectSumPixel;
BOOL objectMinPixel;
BOOL objectMaxPixel;
BOOL objectMeanPixel;
BOOL objectSigmaPixel;
BOOL objectSumPixelSquared;
BOOL objectCenterOfGravityX;
BOOL objectCenterOfGravityY;
BOOL objectFeretMinVolume;
BOOL objectFeretMaxVolume;
BOOL objectFeretMeanVolume;
BOOL objectInnerDiameter;
BOOL objectInnerVolume;
BOOL objectCorrespondingSphere;
BOOL objectCorrespondingDiamete
//}}AFX_DATA
// Overrides
// ClassWizard generate virtual function overrides
//{{AFX_VIRTUAL(CResultsVi
public:
virtual BOOL OnKillActive();
virtual BOOL OnSetActive();
protected:
virtual void DoDataExchange(CDataExchan
//}}AFX_VIRTUAL
// Implementation
protected:
CResultViewSelection* selection;
void setData();
void getData();
// Generated message map functions
//{{AFX_MSG(CResultsViewSe
afx_msg void OnSelectAllFieldParams();
afx_msg void OnSelectAllObjectParams();
afx_msg void OnSelectNoFieldParams();
afx_msg void OnSelectNoObjectParams();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_RESULTSVIEWSE
// ResultsViewSelectionPage.c
//
#include "stdafx.h"
#include "ImageAnalysis.h"
#include "ResultsViewSelectionPage.
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//////////////////////////
// CResultsViewSelectionPage property page
IMPLEMENT_DYNCREATE(CResul
CResultsViewSelectionPage:
{
//{{AFX_DATA_INIT(CResults
fieldAreaOfRoi = FALSE;
fieldAreaInRoi = FALSE;
fieldAreaFraction = FALSE;
fieldArea = FALSE;
fieldPerimeter = FALSE;
fieldFeretX = FALSE;
fieldFeretY = FALSE;
fieldFeretMinDiameter = FALSE;
fieldFeretMinAngle = FALSE;
fieldFeretMaxDiameter = FALSE;
fieldFeretMaxAngle = FALSE;
fieldFeretMeanDiameter = FALSE;
fieldFeretElongation = FALSE;
fieldConvexPerimeter = FALSE;
fieldCompactness = FALSE;
fieldNumberOfHoles = FALSE;
fieldRoughness = FALSE;
fieldLength = FALSE;
fieldBreadth = FALSE;
fieldElongation = FALSE;
fieldSumPixel = FALSE;
fieldMinPixel = FALSE;
fieldMaxPixel = FALSE;
fieldMeanPixel = FALSE;
fieldSigmaPixel = FALSE;
fieldSumPixelSquared = FALSE;
fieldCenterOfGravityX = FALSE;
fieldCenterOfGravityY = FALSE;
fieldCount = FALSE;
fieldObjectCount = FALSE;
fieldFeretMinVolume = FALSE;
fieldFeretMaxVolume = FALSE;
fieldFeretMeanVolume = FALSE;
fieldInnerDiameter = FALSE;
fieldInnerVolume = FALSE;
fieldCorrespondingSphere = FALSE;
fieldCorrespondingDiameter
objectArea = FALSE;
objectPerimeter = FALSE;
objectFeretX = FALSE;
objectFeretY = FALSE;
objectFeretMinDiameter = FALSE;
objectFeretMinAngle = FALSE;
objectFeretMaxDiameter = FALSE;
objectFeretMaxAngle = FALSE;
objectFeretMeanDiameter = FALSE;
objectFeretElongation = FALSE;
objectConvexPerimeter = FALSE;
objectCompactness = FALSE;
objectNumberOfHoles = FALSE;
objectRoughness = FALSE;
objectLength = FALSE;
objectBreadth = FALSE;
objectElongation = FALSE;
objectSumPixel = FALSE;
objectMinPixel = FALSE;
objectMaxPixel = FALSE;
objectMeanPixel = FALSE;
objectSigmaPixel = FALSE;
objectSumPixelSquared = FALSE;
objectCenterOfGravityX = FALSE;
objectCenterOfGravityY = FALSE;
objectFeretMinVolume = FALSE;
objectFeretMaxVolume = FALSE;
objectFeretMeanVolume = FALSE;
objectInnerDiameter = FALSE;
objectInnerVolume = FALSE;
objectCorrespondingSphere = FALSE;
objectCorrespondingDiamete
//}}AFX_DATA_INIT
m_psp.dwFlags &= ~(PSP_HASHELP);
}
CResultsViewSelectionPage:
{
}
void CResultsViewSelectionPage:
{
CPropertyPage::DoDataExcha
//{{AFX_DATA_MAP(CResultsV
DDX_Check(pDX, IDC_F_AREA_OF_ROI, fieldAreaOfRoi);
DDX_Check(pDX, IDC_F_AREA_IN_ROI, fieldAreaInRoi);
DDX_Check(pDX, IDC_F_AREA_FRACTION, fieldAreaFraction);
DDX_Check(pDX, IDC_F_AREA, fieldArea);
DDX_Check(pDX, IDC_F_PERIMETER, fieldPerimeter);
DDX_Check(pDX, IDC_F_FERET_X, fieldFeretX);
DDX_Check(pDX, IDC_F_FERET_Y, fieldFeretY);
DDX_Check(pDX, IDC_F_FERET_MIN_DIAMETER, fieldFeretMinDiameter);
DDX_Check(pDX, IDC_F_FERET_MIN_ANGLE, fieldFeretMinAngle);
DDX_Check(pDX, IDC_F_FERET_MAX_DIAMETER, fieldFeretMaxDiameter);
DDX_Check(pDX, IDC_F_FERET_MAX_ANGLE, fieldFeretMaxAngle);
DDX_Check(pDX, IDC_F_FERET_MEAN_DIAMETER,
DDX_Check(pDX, IDC_F_FERET_ELONGATION, fieldFeretElongation);
DDX_Check(pDX, IDC_F_CONVEX_PERIMETER, fieldConvexPerimeter);
DDX_Check(pDX, IDC_F_COMPACTNESS, fieldCompactness);
DDX_Check(pDX, IDC_F_NUMBER_OF_HOLES, fieldNumberOfHoles);
DDX_Check(pDX, IDC_F_ROUGHNESS, fieldRoughness);
DDX_Check(pDX, IDC_F_LENGTH, fieldLength);
DDX_Check(pDX, IDC_F_BREADTH, fieldBreadth);
DDX_Check(pDX, IDC_F_ELONGATION, fieldElongation);
DDX_Check(pDX, IDC_F_SUM_PIXEL, fieldSumPixel);
DDX_Check(pDX, IDC_F_MIN_PIXEL, fieldMinPixel);
DDX_Check(pDX, IDC_F_MAX_PIXEL, fieldMaxPixel);
DDX_Check(pDX, IDC_F_MEAN_PIXEL, fieldMeanPixel);
DDX_Check(pDX, IDC_F_SIGMA_PIXEL, fieldSigmaPixel);
DDX_Check(pDX, IDC_F_SUM_PIXEL_SQUARED, fieldSumPixelSquared);
DDX_Check(pDX, IDC_F_COG_X, fieldCenterOfGravityX);
DDX_Check(pDX, IDC_F_COG_Y, fieldCenterOfGravityY);
DDX_Check(pDX, IDC_F_COUNT, fieldCount);
DDX_Check(pDX, IDC_F_OBJECT_COUNT, fieldObjectCount);
DDX_Check(pDX, IDC_F_FERET_MIN_VOLUME, fieldFeretMinVolume);
DDX_Check(pDX, IDC_F_FERET_MAX_VOLUME, fieldFeretMaxVolume);
DDX_Check(pDX, IDC_F_FERET_MEAN_VOLUME, fieldFeretMeanVolume);
DDX_Check(pDX, IDC_F_INNER_DIAMETER, fieldInnerDiameter);
DDX_Check(pDX, IDC_F_INNER_VOLUME, fieldInnerVolume);
DDX_Check(pDX, IDC_F_CORRESPONDING_SPHERE
DDX_Check(pDX, IDC_F_CORRESPONDING_DIAMET
DDX_Check(pDX, IDC_O_AREA, objectArea);
DDX_Check(pDX, IDC_O_PERIMETER, objectPerimeter);
DDX_Check(pDX, IDC_O_FERET_X, objectFeretX);
DDX_Check(pDX, IDC_O_FERET_Y, objectFeretY);
DDX_Check(pDX, IDC_O_FERET_MIN_DIAMETER, objectFeretMinDiameter);
DDX_Check(pDX, IDC_O_FERET_MIN_ANGLE, objectFeretMinAngle);
DDX_Check(pDX, IDC_O_FERET_MAX_DIAMETER, objectFeretMaxDiameter);
DDX_Check(pDX, IDC_O_FERET_MAX_ANGLE, objectFeretMaxAngle);
DDX_Check(pDX, IDC_O_FERET_MEAN_DIAMETER,
DDX_Check(pDX, IDC_O_FERET_ELONGATION, objectFeretElongation);
DDX_Check(pDX, IDC_O_CONVEX_PERIMETER, objectConvexPerimeter);
DDX_Check(pDX, IDC_O_COMPACTNESS, objectCompactness);
DDX_Check(pDX, IDC_O_NUMBER_OF_HOLES, objectNumberOfHoles);
DDX_Check(pDX, IDC_O_ROUGHNESS, objectRoughness);
DDX_Check(pDX, IDC_O_LENGTH, objectLength);
DDX_Check(pDX, IDC_O_BREADTH, objectBreadth);
DDX_Check(pDX, IDC_O_ELONGATION, objectElongation);
DDX_Check(pDX, IDC_O_SUM_PIXEL, objectSumPixel);
DDX_Check(pDX, IDC_O_MIN_PIXEL, objectMinPixel);
DDX_Check(pDX, IDC_O_MAX_PIXEL, objectMaxPixel);
DDX_Check(pDX, IDC_O_MEAN_PIXEL, objectMeanPixel);
DDX_Check(pDX, IDC_O_SIGMA_PIXEL, objectSigmaPixel);
DDX_Check(pDX, IDC_O_SUM_PIXEL_SQUARED, objectSumPixelSquared);
DDX_Check(pDX, IDC_O_COG_X, objectCenterOfGravityX);
DDX_Check(pDX, IDC_O_COG_Y, objectCenterOfGravityY);
DDX_Check(pDX, IDC_O_FERET_MIN_VOLUME, objectFeretMinVolume);
DDX_Check(pDX, IDC_O_FERET_MAX_VOLUME, objectFeretMaxVolume);
DDX_Check(pDX, IDC_O_FERET_MEAN_VOLUME, objectFeretMeanVolume);
DDX_Check(pDX, IDC_O_INNER_DIAMETER, objectInnerDiameter);
DDX_Check(pDX, IDC_O_INNER_VOLUME, objectInnerVolume);
DDX_Check(pDX, IDC_O_CORRESPONDING_SPHERE
DDX_Check(pDX, IDC_O_CORRESPONDING_DIAMET
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CResults
//{{AFX_MSG_MAP(CResultsVi
ON_BN_CLICKED(IDC_SELECT_A
ON_BN_CLICKED(IDC_SELECT_A
ON_BN_CLICKED(IDC_SELECT_N
ON_BN_CLICKED(IDC_SELECT_N
ON_WM_DESTROY()
ON_WM_KILLFOCUS()
ON_WM_LBUTTONDOWN()
ON_WM_PAINT()
ON_WM_SHOWWINDOW()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//////////////////////////
// CResultsViewSelectionPage message handlers
BOOL CResultsViewSelectionPage:
{
getData();
return CPropertyPage::OnKillActiv
}
BOOL CResultsViewSelectionPage:
{
setData();
return CPropertyPage::OnSetActive
}
//////////////////////////
void CResultsViewSelectionPage:
{
ASSERT(selection != NULL);
fieldCount = selection->fieldCount;
fieldObjectCount = selection->fieldObjectCoun
fieldAreaOfRoi = selection->fieldAreaOfRoi;
fieldAreaInRoi = selection->fieldAreaInRoi;
fieldAreaFraction = selection->fieldAreaFracti
fieldArea = selection->fieldArea;
fieldPerimeter = selection->fieldPerimeter;
fieldFeretX = selection->fieldFeretX;
fieldFeretY = selection->fieldFeretY;
fieldFeretMinDiameter = selection->fieldFeretMinDi
fieldFeretMinAngle = selection->fieldFeretMinAn
fieldFeretMaxDiameter = selection->fieldFeretMaxDi
fieldFeretMaxAngle = selection->fieldFeretMaxAn
fieldFeretMeanDiameter = selection->fieldFeretMeanD
fieldFeretElongation = selection->fieldFeretElong
fieldFeretMinVolume = selection->fieldFeretMinVo
fieldFeretMaxVolume = selection->fieldFeretMaxVo
fieldFeretMeanVolume = selection->fieldFeretMeanV
fieldConvexPerimeter = selection->fieldConvexPeri
fieldCompactness = selection->fieldCompactnes
fieldNumberOfHoles = selection->fieldNumberOfHo
fieldRoughness = selection->fieldRoughness;
fieldLength = selection->fieldLength;
fieldBreadth = selection->fieldBreadth;
fieldElongation = selection->fieldElongation
fieldSumPixel = selection->fieldSumPixel;
fieldMinPixel = selection->fieldMinPixel;
fieldMaxPixel = selection->fieldMaxPixel;
fieldMeanPixel = selection->fieldMeanPixel;
fieldSigmaPixel = selection->fieldSigmaPixel
fieldSumPixelSquared = selection->fieldSumPixelSq
fieldCenterOfGravityX = selection->fieldCenterOfGr
fieldCenterOfGravityY = selection->fieldCenterOfGr
fieldInnerDiameter = selection->fieldInnerDiame
fieldInnerVolume = selection->fieldInnerVolum
fieldCorrespondingSphere = selection->fieldCorrespond
fieldCorrespondingDiameter
// Object
objectArea = selection->objectArea;
objectPerimeter = selection->objectPerimeter
objectFeretX = selection->objectFeretX;
objectFeretY = selection->objectFeretY;
objectFeretMinDiameter = selection->objectFeretMinD
objectFeretMinAngle = selection->objectFeretMinA
objectFeretMaxDiameter = selection->objectFeretMaxD
objectFeretMaxAngle = selection->objectFeretMaxA
objectFeretMeanDiameter = selection->objectFeretMean
objectFeretElongation = selection->objectFeretElon
objectFeretMinVolume = selection->objectFeretMinV
objectFeretMaxVolume = selection->objectFeretMaxV
objectFeretMeanVolume = selection->objectFeretMean
objectConvexPerimeter = selection->objectConvexPer
objectCompactness = selection->objectCompactne
objectNumberOfHoles = selection->objectNumberOfH
objectRoughness = selection->objectRoughness
objectLength = selection->objectLength;
objectBreadth = selection->objectBreadth;
objectElongation = selection->objectElongatio
objectSumPixel = selection->objectSumPixel;
objectMinPixel = selection->objectMinPixel;
objectMaxPixel = selection->objectMaxPixel;
objectMeanPixel = selection->objectMeanPixel
objectSigmaPixel = selection->objectSigmaPixe
objectSumPixelSquared = selection->objectSumPixelS
objectCenterOfGravityX = selection->objectCenterOfG
objectCenterOfGravityY = selection->objectCenterOfG
objectInnerDiameter = selection->objectInnerDiam
objectInnerVolume = selection->objectInnerVolu
objectCorrespondingSphere = selection->objectCorrespon
objectCorrespondingDiamete
UpdateData(FALSE);
}
void CResultsViewSelectionPage:
{
ASSERT(selection != NULL);
UpdateData();
selection->fieldCount = fieldCount;
selection->fieldObjectCoun
selection->fieldAreaOfRoi = fieldAreaOfRoi;
selection->fieldAreaInRoi = fieldAreaInRoi;
selection->fieldAreaFracti
selection->fieldArea = fieldArea;
selection->fieldPerimeter = fieldPerimeter;
selection->fieldFeretX = fieldFeretX;
selection->fieldFeretY = fieldFeretY;
selection->fieldFeretMinDi
selection->fieldFeretMinAn
selection->fieldFeretMaxDi
selection->fieldFeretMaxAn
selection->fieldFeretMeanD
selection->fieldFeretElong
selection->fieldFeretMinVo
selection->fieldFeretMaxVo
selection->fieldFeretMeanV
selection->fieldConvexPeri
selection->fieldCompactnes
selection->fieldNumberOfHo
selection->fieldRoughness = fieldRoughness;
selection->fieldLength = fieldLength;
selection->fieldBreadth = fieldBreadth;
selection->fieldElongation
selection->fieldSumPixel = fieldSumPixel;
selection->fieldMinPixel = fieldMinPixel;
selection->fieldMaxPixel = fieldMaxPixel;
selection->fieldMeanPixel = fieldMeanPixel;
selection->fieldSigmaPixel
selection->fieldSumPixelSq
selection->fieldCenterOfGr
selection->fieldCenterOfGr
selection->fieldInnerDiame
selection->fieldInnerVolum
selection->fieldCorrespond
selection->fieldCorrespond
// Object
selection->objectArea = objectArea;
selection->objectPerimeter
selection->objectFeretX = objectFeretX;
selection->objectFeretY = objectFeretY;
selection->objectFeretMinD
selection->objectFeretMinA
selection->objectFeretMaxD
selection->objectFeretMaxA
selection->objectFeretMean
selection->objectFeretElon
selection->objectFeretMinV
selection->objectFeretMaxV
selection->objectFeretMean
selection->objectConvexPer
selection->objectCompactne
selection->objectNumberOfH
selection->objectRoughness
selection->objectLength = objectLength;
selection->objectBreadth = objectBreadth;
selection->objectElongatio
selection->objectSumPixel = objectSumPixel;
selection->objectMinPixel = objectMinPixel;
selection->objectMaxPixel = objectMaxPixel;
selection->objectMeanPixel
selection->objectSigmaPixe
selection->objectSumPixelS
selection->objectCenterOfG
selection->objectCenterOfG
selection->objectInnerDiam
selection->objectInnerVolu
selection->objectCorrespon
selection->objectCorrespon
}
//////////////////////////
void CResultsViewSelectionPage:
{
ASSERT(selection != NULL);
getData();
selection->selectAllFieldP
setData();
}
void CResultsViewSelectionPage:
{
ASSERT(selection != NULL);
getData();
selection->deSelectAllFiel
setData();
}
void CResultsViewSelectionPage:
{
ASSERT(selection != NULL);
getData();
selection->selectAllObject
setData();
}
void CResultsViewSelectionPage:
{
ASSERT(selection != NULL);
getData();
selection->deSelectAllObje
setData();
}
// --------------------------
void CResultsViewSelectionPage:
{
selection->setSelectedFiel
}
void CResultsViewSelectionPage:
{
selection->setSelectedObje
}
I don't see anything obvious in there apart from this selection pointer which is a protected var and never being set to any value. What happens if you have
selection=NULL;
in your constructor?
selection=NULL;
in your constructor?
ASKER
The selection pointer is set in the constructor for the PropertySheet, see below.
CResultsSheet::CResultsShe et(CCatego ryList* list, CFieldIdentityList* fieldIDList, CResultViewSelection* currentSelection, UINT nIDCaption, CSelectedStatisticValues& selectedStatisticValues, CDocument* pDoc, CWnd* pParentWnd, UINT iSelectPage)
:CPropertySheet(nIDCaption , pParentWnd, iSelectPage)
{
ASSERT(list != NULL);
ASSERT(currentSelection != NULL);
m_psh.dwFlags |= PSH_NOAPPLYNOW;
m_psh.dwFlags &= ~(PSH_HASHELP);
showPage.categoryList = list;
showPage.fieldIdentityList = fieldIDList;
showPage.selection = currentSelection;
showPage.doc=pDoc;
AddPage(&showPage);
histogramPage.categoryList = list;
histogramPage.selection = currentSelection;
AddPage(&histogramPage);
exportPage.categoryList = list;
exportPage.fieldIdentityLi st = fieldIDList;
exportPage.selection = currentSelection;
AddPage(&exportPage);
viewSelectionPage.selectio n = currentSelection;
AddPage(&viewSelectionPage );
statisticsSelectionPage.se lection = &selectedStatisticValues;
AddPage(&statisticsSelecti onPage);
}
CResultsSheet::CResultsShe
:CPropertySheet(nIDCaption
{
ASSERT(list != NULL);
ASSERT(currentSelection != NULL);
m_psh.dwFlags |= PSH_NOAPPLYNOW;
m_psh.dwFlags &= ~(PSH_HASHELP);
showPage.categoryList = list;
showPage.fieldIdentityList
showPage.selection = currentSelection;
showPage.doc=pDoc;
AddPage(&showPage);
histogramPage.categoryList
histogramPage.selection = currentSelection;
AddPage(&histogramPage);
exportPage.categoryList = list;
exportPage.fieldIdentityLi
exportPage.selection = currentSelection;
AddPage(&exportPage);
viewSelectionPage.selectio
AddPage(&viewSelectionPage
statisticsSelectionPage.se
AddPage(&statisticsSelecti
}
OK. That looks in order.
I'm puzzled. To me it looks like you are running out of resources somewhere but there doesn't seem to be any obvious allocation that should be giving this problem. You are just opening and closing, not performing button presses as well so that the 4 event handlers are not actually being used.
Can you track the state of this 'currentSelection' as you open/close the property sheet?
I'm puzzled. To me it looks like you are running out of resources somewhere but there doesn't seem to be any obvious allocation that should be giving this problem. You are just opening and closing, not performing button presses as well so that the 4 event handlers are not actually being used.
Can you track the state of this 'currentSelection' as you open/close the property sheet?
Two other simple things to try.
comment out all of the DoDataExchange routine. (No interaction with the selection). Does it still fail?
instead of
CResultsSheet dlg(...)
dlg.DoModal();
use
CResultsSheet* pDlg = new CResultsSheet();
pDlg->DoModal();
delete pDlg;
or vice-versa to modify where the memory comes from and see if you still experience this behaviour.
comment out all of the DoDataExchange routine. (No interaction with the selection). Does it still fail?
instead of
CResultsSheet dlg(...)
dlg.DoModal();
use
CResultsSheet* pDlg = new CResultsSheet();
pDlg->DoModal();
delete pDlg;
or vice-versa to modify where the memory comes from and see if you still experience this behaviour.
Two other simple things to try.
comment out all of the DoDataExchange routine. (No interaction with the selection). Does it still fail?
instead of
CResultsSheet dlg(...)
dlg.DoModal();
use
CResultsSheet* pDlg = new CResultsSheet();
pDlg->DoModal();
delete pDlg;
or vice-versa to modify where the memory comes from and see if you still experience this behaviour.
comment out all of the DoDataExchange routine. (No interaction with the selection). Does it still fail?
instead of
CResultsSheet dlg(...)
dlg.DoModal();
use
CResultsSheet* pDlg = new CResultsSheet();
pDlg->DoModal();
delete pDlg;
or vice-versa to modify where the memory comes from and see if you still experience this behaviour.
ASKER
I noticed those unused event handlers that I forgot to remove, but those were only used for tracing and were not there when the problem first occured.
I have tried to comment out the DoDataExchange routine, but it still fails.
I have also tried new/delete as you suggested, but with the same result.
I have tried to comment out the DoDataExchange routine, but it still fails.
I have also tried new/delete as you suggested, but with the same result.
I am stumped. Bug in OP system?
Do you have the latest service packs for VC and OP system installed? Does it fail on another PC in the same way'
If I think of anything else I post another comment.
Do you have the latest service packs for VC and OP system installed? Does it fail on another PC in the same way'
If I think of anything else I post another comment.
ASKER
My OS is WinXP Home edition 2002 SP1 and I am using Visual C++ 6.0. The problem has occured on at least two other computers, both using WinXP. I am not sure which SP I have to VC++, but I will try to install SP5.
I have tried to strip all functions from any actions. Removed all other PropertyPages, all DataExchange and function calls on the PropertyPage but still the same result.
CResultsSheet::CResultsShe et(UINT nIDCaption, CWnd* pParentWnd, UINT iSelectPage)
:CPropertySheet(nIDCaption , pParentWnd, iSelectPage)
{
AddPage(&viewSelectionPage );
}
void CImageAnalysisDoc::OnResul tsShow()
{
CResultsSheet resultsSheet(IDS_RESULTS);
if(resultsSheet.DoModal() == IDOK)
{
}
else
{
}
}
I have tried to strip all functions from any actions. Removed all other PropertyPages, all DataExchange and function calls on the PropertyPage but still the same result.
CResultsSheet::CResultsShe
:CPropertySheet(nIDCaption
{
AddPage(&viewSelectionPage
}
void CImageAnalysisDoc::OnResul
{
CResultsSheet resultsSheet(IDS_RESULTS);
if(resultsSheet.DoModal() == IDOK)
{
}
else
{
}
}
I had designed in my earlier project a PropertyPage which had more than 255 controls in a single page. I guess there is no problem of resources unless you create them on heap. As I can see they are all statically created.
Only problem could arise is from DoDataExchange() and the selection pointer as pointed out by AndyAinscow
One more pointed i noticed is DDX_Check takes parameter as a reference to an integer. You have defined them as BOOL. I checked out that in one of the defines that BOOL is defined as int so there should be no problem. But ideally all must be type casted to boolean value whenever you assign any value.
Only problem could arise is from DoDataExchange() and the selection pointer as pointed out by AndyAinscow
One more pointed i noticed is DDX_Check takes parameter as a reference to an integer. You have defined them as BOOL. I checked out that in one of the defines that BOOL is defined as int so there should be no problem. But ideally all must be type casted to boolean value whenever you assign any value.
ASKER
akalmani>> I have tried to comment out the DoDataExchange() part but the proplem still occurs.
When trying on a Win2000 computer the problem does not occur! Could it be something that is not compatible between WinXP and VC++ 6.0?
When trying on a Win2000 computer the problem does not occur! Could it be something that is not compatible between WinXP and VC++ 6.0?
ASKER
I did some more testing on my Win2000 computer and the problem occured after about 70 attempts! (The test procedure of this is very boring...). I have installed VisualStudion 6.0 SP5 but that did not help.
Are you using any API's which are not supported on XP ? Usually MS supports its API's but crosscheck once if they are really supported?
Ohh please ignore my last comments...I did not read it thoroughly...Sorry...
ASKER
If I make a loop to show the PropertySheet then the problem does not occur - at least not after 150 attempts...
void CImageAnalysisDoc::OnResul tsShow()
{
while(resultsShow());
}
bool CImageAnalysisDoc::results Show()
{
bool idok=false;
CResultsSheet resultsSheet(&categoryList , &fieldIdentityList, &selectedParameters, IDS_RESULTS, selectedStatisticValues, this);
if(resultsSheet.DoModal() == IDOK)
{
idok=true;
}
return idok;
}
void CImageAnalysisDoc::OnResul
{
while(resultsShow());
}
bool CImageAnalysisDoc::results
{
bool idok=false;
CResultsSheet resultsSheet(&categoryList
if(resultsSheet.DoModal() == IDOK)
{
idok=true;
}
return idok;
}
If I make a loop to show the PropertySheet then the problem does not occur - at least not after 150 attempts...
Please post the code of how you do it manually, or is your resultsShow function called from a button press?
Please post the code of how you do it manually, or is your resultsShow function called from a button press?
ASKER
The resultsShow function is called from a button press. If you change while(resultsShow()); into resultsShow(); in OnResultsShow() above then you have the normal function call.
ASKER
I think I've got it now!
My main menu has two recent file lists in two pop-up menus. It also has a pop-up menu that should not be shown to all users. This recent file lists are updated and the pop-up menu is removed in an OnUpdate...() function call. Since I have two different recent file lists I have not used the AddToRecentFileList() function. Instead I have four extra items in the two pop-up menus and removing those that have empty strings. For some reason that I don't understand I need to update this list for each OnUpdate...() call instead of only when a new file is opened.
If I use two separate menus, one with the extra pop-up menu (IDR_MAINFRAME_EXTRA) and one without (IDR_MAINFRAME) and use one of those instead of removing the pop-up menu then everything works. I still don't know why this would destroy my PropertyPage, but as long as it works I'm satisfied...
My main menu has two recent file lists in two pop-up menus. It also has a pop-up menu that should not be shown to all users. This recent file lists are updated and the pop-up menu is removed in an OnUpdate...() function call. Since I have two different recent file lists I have not used the AddToRecentFileList() function. Instead I have four extra items in the two pop-up menus and removing those that have empty strings. For some reason that I don't understand I need to update this list for each OnUpdate...() call instead of only when a new file is opened.
If I use two separate menus, one with the extra pop-up menu (IDR_MAINFRAME_EXTRA) and one without (IDR_MAINFRAME) and use one of those instead of removing the pop-up menu then everything works. I still don't know why this would destroy my PropertyPage, but as long as it works I'm satisfied...
Somewhere in that code you are probably leaking resources (and may still be doing so) hence this failure.
ASKER
Here's the modified menu update code. Is it still leaking resources?
void CImageAnalysisDoc::OnUpdat eMacroRun( CCmdUI* pCmdUI)
{
macroUpdateMenu();
}
void CImageAnalysisDoc::macroUp dateMenu()
{
CMenu menu;
if(!extraLicensed)
menu.LoadMenu(IDR_MAINFRAM E);
else
menu.LoadMenu(IDR_MAINFRAM E_EXTRA);
int i=0, found=-1;
CString menuItem;
while(i<menu.GetMenuItemCo unt( ) && found <0)
{
menu.GetMenuString(i, menuItem, MF_BYPOSITION);
if(menuItem.Find("M&acro") >=0)
{
int pos;
CString fName;
CMenu *pSubMenu=menu.GetSubMenu( i);
if(macroFile4.GetLength()= =0)
{
pSubMenu->RemoveMenu(ID_MA CROFILE4, MF_BYCOMMAND);
}
if(macroFile3.GetLength()= =0)
{
pSubMenu->RemoveMenu(ID_MA CROFILE3, MF_BYCOMMAND);
}
if(macroFile2.GetLength()= =0)
{
pSubMenu->RemoveMenu(ID_MA CROFILE2, MF_BYCOMMAND);
}
if(macroFile1.GetLength()= =0)
{
pSubMenu->RemoveMenu(ID_MA CROFILE1, MF_BYCOMMAND);
pSubMenu->RemoveMenu(pSubM enu->GetMe nuItemCoun t()-1, MF_BYPOSITION);
}
CMainFrame* wnd = (CMainFrame*)AfxGetMainWnd ();
wnd->SetMenu( &menu );
wnd->DrawMenuBar();
found=i;
}
else
i++;
}
}
void CImageAnalysisDoc::OnUpdat
{
macroUpdateMenu();
}
void CImageAnalysisDoc::macroUp
{
CMenu menu;
if(!extraLicensed)
menu.LoadMenu(IDR_MAINFRAM
else
menu.LoadMenu(IDR_MAINFRAM
int i=0, found=-1;
CString menuItem;
while(i<menu.GetMenuItemCo
{
menu.GetMenuString(i, menuItem, MF_BYPOSITION);
if(menuItem.Find("M&acro")
{
int pos;
CString fName;
CMenu *pSubMenu=menu.GetSubMenu(
if(macroFile4.GetLength()=
{
pSubMenu->RemoveMenu(ID_MA
}
if(macroFile3.GetLength()=
{
pSubMenu->RemoveMenu(ID_MA
}
if(macroFile2.GetLength()=
{
pSubMenu->RemoveMenu(ID_MA
}
if(macroFile1.GetLength()=
{
pSubMenu->RemoveMenu(ID_MA
pSubMenu->RemoveMenu(pSubM
}
CMainFrame* wnd = (CMainFrame*)AfxGetMainWnd
wnd->SetMenu( &menu );
wnd->DrawMenuBar();
found=i;
}
else
i++;
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Andy for all the help. I think I have got it working completely now. I reduced the number of SetMenu calls to just one in the initialization and work with GetMenu() directly instead when updating the menus.
There's a resource size and control number limit you may have reached.
Do you properly destroy your resources and objects?
Btw, it's probably not a memory leak but a resource leak. And there are much more possibilities for either kind of leaks than Visual Studio gives warning for.
As a private note (as a would-be user of your property page) is that a page with 69 check boxes is a nightmare, a sure sign of a bad user interface design.