| | | | Browse by category |
Article ID: 471
Last updated: 25 Apr, 2018
Problem
Can I have What's this? type context-sensitive help on a per cell basis?
Cause
Action
You can register an user attribute in the grid (let's say IDS_UA_HELPID) and assign this help ID to cells, rows, or columns. For example,
SetStyleRange(CGXRange().SetCols(1), CGXStyle().SetUserAttribute(IDS_UA_HELP, szhelpId)); |
To implement the What's this functionality, you have to process the WM_HELPHITTEST function which is described in MFC Technote 28.
To do this:
- Include afxpriv.h
- Add declaration
-
afx_msg LRESULT OnHelpHitTest(WPARAM wParam, LPARAM lParam); - Add to message map
-
ON_MESSAGE(WM_HELPHITTEST, OnHelpHitTest) - Implementation of this method
-
LRESULT COGLView::OnHelpHitTest(WPARAM, LPARAM lParam)
{CPoint ptTest(LOWORD(lParam), HIWORD(lParam)); ASSERT_VALID(this);
ROWCOL nRow = CalcClientRowFromPt(ptTest);
ROWCOL nCol = CalcClientColFromPt(ptTest);
LRESULT nID = 0;if (nRow != GX_INVALID && nCol != GX_INVALID)
{TRACE(OnHelpHitTest: nRow %lu, nCol %lu , GetRow(nRow), GetCol(nCol)); CGXStyle style;
ComposeStyleRowCol(GetRow(nRow), GetCol(nCol), &style);nID = atol(style.GetUserAttribute(IDS_UA_HELP));
} return nID;
}
This article was:
Helpful |
Not helpful
Report an issue
Article ID: 471
Last updated: 25 Apr, 2018
Revision: 3
Views: 1572
Posted: 24 Jan, 2001 by
Meltreger B.
Updated: 25 Apr, 2018 by
Meltreger B.
Others in this category
Powered by KBPublisher (Knowledge base software)