Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » Flickering in CFormView anchored controls Collapse All
Subject Author Date
Sergio Del Valle Feb 23, 2005 - 6:28 AM

Hi all,


I have a MDI app, and am using a CFormView with some controls anchored as described in this forum, the problem is everytime I switch from on view to other, the controls flicker from the original size/position to the new ones. How can I avoid this to happen? BTW I’m using MDITabs to switch between view/documents.


Thanks in advance.

Technical Support Feb 23, 2005 - 9:06 AM

Dear Sergio,

We are sorry, but there is not enough information in your message to come to any conclusion about the problem you described. Could you send us a test project that reproduces this problem or, at least,the source code of your form view class?

Sergio Del Valle Feb 23, 2005 - 10:48 AM

View class declaration:

class CMyView : public CExtWA < CExtWS < CExtAFV < CFormView > > >
{
protected: // create from serialization only
   CMyView();
   DECLARE_DYNCREATE(CMyView)
 
public:
   //{{AFX_DATA(CMyView)
   enum { IDD = IDD_MYVIEW_FORM };
   CExtGroupBox  m_grpGroupBox1;
   CExtLabel	 m_lblLabel1;
   CExtEdit	  m_edtEdit1;
   CExtLabel	 m_lblLabel2;
   CExtEdit	  m_edtEdit2;
   CExtGroupBox  m_grpGroupBox2;
   //}}AFX_DATA
   CExtGridWnd   m_grdGrid;
 
// Attributes
public:
   CMyDoc* GetDocument();
 
// Operations
protected:
   void InitGrid();
 
// Overrides
   // ClassWizard generated virtual function overrides
   //{{AFX_VIRTUAL(CMyView)
   public:
   virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
   protected:
   virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
   virtual void OnInitialUpdate(); // called first time after construct
   virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint);
   //}}AFX_VIRTUAL
 
// Implementation
public:
   virtual ~CMyView();
#ifdef _DEBUG
   virtual void AssertValid() const;
   virtual void Dump(CDumpContext& dc) const;
#endif
 
protected:
 
// Generated message map functions
protected:
   //{{AFX_MSG(CPalmROMEditorView)
   afx_msg void OnSize(UINT nType, int cx, int cy);
   //}}AFX_MSG
   DECLARE_MESSAGE_MAP()
};

 View class implementation:

void CMyView::OnInitialUpdate()
{
   CFormView::OnInitialUpdate();
 
   AddAnchor(IDC_GROUPBOX1, __RDA_KEEP, __RDA_X);
   AddAnchor(IDC_GROUPBOX2, __RDA_KEEP, __RDA_BOTH);
 
   ShowSizeGrip(FALSE);
}
 
void CMyView::InitGrid()
{
   static INT arrHdrExtents[] = { 150, 50, 50, 100 };
   static LPCTSTR arrHdrTexts[] = { _T("Column1"), _T("Column2"), _T("Column3"),
	  _T("Column4") };
 
   m_grdGrid.SiwModifyStyle(__ESIW_ST_ITEM | __EGBS_FIXED_SIZE_ROWS |
	  __EGBS_SFB_CELLS | __EGBS_RESIZING_CELLS_OUTER_H |
	  __EGBS_DYNAMIC_RESIZING_H);
 
   m_grdGrid.OuterRowCountTopSet(1, false);
   m_grdGrid.ColumnAdd(4, false);
 
   for (LONG n = 0; n < 4; n++)
   {
	  CExtGridCellHeader* pCell = STATIC_DOWNCAST(CExtGridCellHeader,
		 m_grdGrid.GridCellGetOuterAtTop(n, 0,
		 RUNTIME_CLASS(CExtGridCellHeader)));
	  pCell->ExtentSet(arrHdrExtents[n]);
	  pCell->TextSet(arrHdrTexts[n]);
   }
}
 
void CMyView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint) 
{
   if (m_grdGrid.ColumnCountGet() == 0)
	  InitGrid();
 
   CMyDoc* pDocument = GetDocument();
 
   m_edtEdit1.SetWindowText(pDocument->GetData1());
   m_edtEdit2.SetWindowText(pDocument->GetData2());
 
   LONG numRows = pDocument->GetNumRows();
 
   m_grdGrid.RowRemoveAll(false);
   m_grdGrid.RowAdd(numRows, false);
 
   for (LONG index = 0; index < numRows; index++)
   {
	  CExtGridCellStringDM* pCell = STATIC_DOWNCAST(CExtGridCellStringDM,
		 m_grdGrid.GridCellGet(0, index, 0, 0,
		 RUNTIME_CLASS(CExtGridCellStringDM)));
	  pCell->TextSet(pDocument->GetCol0(index));
   }
 
   m_grdGrid.OnSwUpdateScrollBars();
   m_grdGrid.OnSwDoRedraw();
}
 
void CMyView::OnSize(UINT nType, int cx, int cy) 
{
   CWnd::OnSize(nType, cx, cy);
}
I’m having another problem with the grid, it isn’t displaying the scrollbars, the control was added to the form as a custom control, with class="ProfUIS-ScrollItemWindow", style=0x50010000, and ExStyle=0x20000. What did I miss?

Technical Support Feb 24, 2005 - 10:22 AM

Your source code looks correct. We may guess that you forgot to set on the "Clip children" option in the dialog resource.

As for the problem with scrollbars, please replace the following code in the CMyView::InitGrid() method

m_grdGrid.SiwModifyStyle(
    __ESIW_ST_ITEM 
        | __EGBS_FIXED_SIZE_ROWS
        | __EGBS_SFB_CELLS
        | __EGBS_RESIZING_CELLS_OUTER_H
        | __EGBS_DYNAMIC_RESIZING_H
);
with
m_grdGrid.SiwModifyStyle(
    __ESIS_STH_ITEM | __ESIS_STV_ITEM
        | __EGBS_FIXED_SIZE_ROWS
        | __EGBS_SFB_CELLS
        | __EGBS_RESIZING_CELLS_OUTER_H
        | __EGBS_DYNAMIC_RESIZING_H
);

Sergio Del Valle Feb 24, 2005 - 10:50 AM

I have set the Clip Children option, but then the controls inside the group boxes are not displayed when the first document is opened, when opening another document all the controls are correctly displayed on both views, but the flickering is still there, any other hint?

Technical Support Feb 24, 2005 - 11:05 AM

You should move the group box back in Z-order to see the controls "inside" it (of course, in fact, they are over it). We have no idea about flickering. If you send us your project, we will fix this problem.

Sergio Del Valle Feb 24, 2005 - 7:14 AM

Hi again,


I have already solved the problem with the grid scrollbars, I didn’t set correctly the style when calling SiwModifyStyle, but I’m still having the flickering problem.

Technical Support Feb 24, 2005 - 10:52 AM

Could you send us your project? We believe that this will clarify this problem.