News | Articles | Libraries | Developer Tools | Books | Forum Links | Search   
Sections:
 

QA: How to disable red dots in the list control?

By Nicholas Tsipanov, February 12, 2004.
Print version

Question

I have a list control in my application. This listbox does not need a context menu, and therefore I don't want running red dots to appear while the user holds the stylus on the control.

Red dots in a list control

Answer

The solution is simple:

You have to answer with TRUE to NM_RECOGNIZEGESTURE notification message in its parent window.

We can notice that this applies not only to list control but to tree view as well.

There is a pitfall here though: NM_RECOGNIZEGESTURE has different values on Pocket PC 2002 and Pocket PC 2003!

Thus, for Pocket PC 2002 it is defined as

#define NM_FIRST (0U- 0U) // generic to all controls ...SKIPPED.... #define NM_RECOGNIZEGESTURE (NM_FIRST-16)

while for Pocket PC 2003 the value is :

#define NM_FIRST (0U- 0U) // generic to all controls ...SKIPPED.... #define NM_RECOGNIZEGESTURE (NM_FIRST-50)

So the MFC code sample is (we are trying to handle both 2002 and 2003 cases):

BOOL CMyDlg::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) { int idCtrl = (int) wParam; LPNMHDR pnmh = (LPNMHDR) lParam; //Avoid red dots - we do want not the context menu, //notice the NM_RECOGNIZEGESTURE is different on 2002 and 2003 if (pnmh->code == NM_FIRST-16 || pnmh->code == NM_FIRST-50) { *pResult = 1; return TRUE; } return CDialog::OnNotify(wParam, lParam, pResult); }

Related resources:

Discuss

Discuss this article. Here you can write your comments and read comments of other developers.
Rate this article:     Poor Excellent    
 12345 
© 2001-2005 Pocket PC Developer Network, a division of Spb Software House