<< Return to Main Index

< Return to Class Index

CGXGridHint::CGXGridHint

CGXGridHint(UINT id, int viewID = -1);

id

Specifies the update-method. (See CGXGridHint::m_id for a table of ids).

viewID

Specifies the view-id.

Remarks

Constructs a hint object.

See CGXGridCore::GetViewID for an example of using several view types as a browser view and a columns view.

The example shows the typical usage of a hint object.

Example

This example shows the usage of the hint-object for changing column widths.

void CGXGridCore::UpdateChangedColWidths(ROWCOL nFromCol, ROWCOL nToCol, GINT* anOldWidths, UINT flags, BOOL bCreateHint)
{
   ...

   if (bCreateHint && m_bHintsEnabled)
   {
      CGXGridHint hint(gxHintUpdateChangedColWidths, m_nViewID);
      hint.nCol1 = nFromCol;
      hint.nCol2 = nToCol;
      hint.vptr = anOldWidths;
      hint.flags = flags;

      UpdateAllViews(this, 0, &hint);
   }
}

void CGXGridView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
{
   if (pHint == NULL || !pHint->IsKindOf(RUNTIME_CLASS(CGXGridHint)))
   {
      Invalidate();
      return;
   }

   CGXGridHint &info = *((CGXGridHint*) pHint);

   // check view-id
   if (info.nViewID != -1 && info.nViewID != m_nViewID)
      return;
   
   switch (info.m_id)
   {
   ...
   case gxHintUpdateChangedColWidths:
      UpdateChangedColWidths(
         info.nCol1,
         info.nCol2,
         (GINT*) info.vptr,
         info.flags,
         FALSE
         );
      break;
   ...
}

See Also

CGXGridHint::m_id CGXGridHint::nViewID CGXGridCore::GetViewID

CGXGridHint

Class Overview | Class Members