Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to trap characters in Objective Grid Combobox

Status
Not open for further replies.

Technokrat

Programmer
Jul 20, 2001
92
US
I need to trap characters in Objective Grid Combobox, when the dropdown is active.

The way the control currently works it that it is only catching and jumpting to the list based on one character.

For example, lets say the user wants to select MUSTARD from the list and this is the 17th item in the M's section. They would have to hit the M key 17 times to reach the MUSTARD option. What they want to do is to start to type the word one char at a time until they hit it (eg- they might have to type M, U, and S to reach MUSTARD, but 3 keystrokes is still better than 17).

How can I trap the keystrokes when the dropdown for the combobox is active. Currently, the keypressed function only fires when the dropdown is NOT active.

 
Alright, I think I'm a little closer, I have the following code in place.

Code:
BOOL cGridComboBox::OnCommand(WPARAM wParam, LPARAM lParam)
{

	MSG msg;
	::PeekMessage( &msg, NULL,0,0,PM_NOREMOVE ); 

	if ( GetDroppedState() )				// is the grid combo in dropdown mode?
	{
	   TRACE(_T("GetDroppedState\n"));

		if( msg.message == WM_CHAR || msg.message == WM_KEYDOWN )
		{
			short chCharCode = (TCHAR) wParam;    // character code 
			long lKeyData = lParam;              // key data 
			TRACE( _T("Char\n") );
		}
	}
	
	return true;
}

However, the message isn't the keystroke the user hit, but it looks like a message indicating the scrollbar has moved in the combo dropdown. Any ideas?

[dazed]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top