Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » Verify Toolbar Combo when Enter pressed Collapse All
Subject Author Date
Neville Franks Jun 28, 2004 - 4:10 AM

Hi,
I’ve got a combo box on a toolbar and I’d like to validate what the user types into the edit area when Enter is pressed. If it is invalid I want focus to remain in the combo edit area. I’m using CMainFrame::OnTextFieldVerify() but this is called for each keypress and doesn’t tell me what key the user pressed (eg. Enter).


I’ve looked at CExtBarTextFieldButton::CInPlaceEditWnd::WindowProc() which does verify for VK_RETURN however it exits the combo regardless of what is returned by CMainFrame::OnTextFieldVerify().


Any suggestions?

Technical Support Jun 28, 2004 - 10:12 AM

Dear Neville,

You should override the CExtCustomizeSite::OnTextFieldInplaceTextSet method. The default implementation of this method in the ExtCustomize.cpp file assigns a new string value to the text field:

sTextFieldBuffer = sTextNew;
If your method does not do this, the text field will have the previous value. Of course, you can use any verified or corrected string value instead of that which is stored in the sTextNew parameter.

Neville Franks Jun 28, 2004 - 2:42 PM

Hi,
I already override CExtCustomizeSite::OnTextFieldInplaceTextSet() with CMainFrame::OnTextFieldInplaceTextSet() however I don’t see how this lets me resolve my issue as it is called when Enter is pressed and the edit session is ending.


What I want is to:



  1. When Enter is pressed validate what the user typed.

  2. If it is invalid continue with inplace editing. I use a popup tip to tell the user what the problem is.

  3. If it is valid end editing and return focus to parent window as normal.

Thanks,
Neville

Technical Support Jun 29, 2004 - 3:34 AM

Dear Neville,

To catch the VK_RETURN key event you can override the CExtCustomizeSite::OnTextFieldWndProcHook virtual method, which should work both for text/combo fields in toolbars and for popup menus. Beside you may display a tooltip somewhere next to the edit control. Please note, your tooltip must be the topmost window (i.e. having the WS_EX_TOPMOST extended window style) and appear on screen as a non-active window.