Objective Grid: Subclassing CGXTabBeam when the associated CGXTabWnd is embedded in a dialog

Article ID: 537
Last updated: 16 Apr, 2018
Article ID: 537
Last updated: 16 Apr, 2018
Revision: 3
Views: 1906
Posted: 24 Jan, 2001
by Meltreger B.
Updated: 16 Apr, 2018
by Meltreger B.

Problem


How can I subclass the CGXTabBeam when the associated CGXTabWnd is embedded in a dialog?
 


Cause



Action


Here is a sample OnInitDialog() function.
Try replacing this function in dlgsamp3.cpp in gridapp to see how it works.
 

BOOL CSample3Dialog::OnInitDialog()
{
CDialog::OnInitDialog();
CWnd* pGridFrame = GetDlgItem(IDC_GRIDWND3);

if (pGridFrame)
{

// Retrive the size of the frame 
// and convert the co-ordinated to
// use the Dialog coordinates 
// (from screen coordinates).
CRect rect;
pGridFrame->GetWindowRect( &rect );
ScreenToClient(&rect);

DWORD dwFlags = WS_TABSTOP | WS_BORDER | WS_VISIBLE;

#if _MFC_VER >= 0x0400
// Draw grid with sunken borders
dwFlags |= WS_EX_CLIENTEDGE;
#endif
// CGXTabWnd* m_pTabWnd
// Here you can use CMyTabBeam instead
m_pTabWnd = new CGXTabWnd(RUNTIME_CLASS(CGXTabBeam));

m_pTabWnd->CWnd::Create(NULL, NULL, dwFlags, rect, this, 21000);

m_wndGrid.Create(WS_CHILD, rect, m_pTabWnd, 21000);

m_pTabWnd->AttachWnd(&m_wndGrid, _T(Grid 1));
m_wndGrid.Initialize();
m_wndGrid.SetRowCount(256);
m_wndGrid.SetColCount(52);

// Mminimumn, maximum value
m_wndGrid.SetStyleRange(CGXRange().SetTable(),

CGXStyle()
.SetUserAttribute(GX_IDS_UA_VALID_MIN, _T(0))

.SetUserAttribute(GX_IDS_UA_VALID_MAX, _T(100))

.SetUserAttribute(GX_IDS_UA_VALID_MSG, _T(Please enter a value between 0 and 100!))

);
m_wndGrid.SetCurrentCell(1,1);

return FALSE;

}

return TRUE; // return TRUE unless you set the focus to a control

}


 

This article was:   Helpful | Not helpful
Report an issue
Article ID: 537
Last updated: 16 Apr, 2018
Revision: 3
Views: 1906
Posted: 24 Jan, 2001 by Meltreger B.
Updated: 16 Apr, 2018 by Meltreger B.

Others in this category