"Highlighted" EditBoxes For Over-Populated Input Dialog Sheets

-->

Those of you who struggle every day to produce user friendly (and not friendly user) MMI's, must have encountered the problem of placing lots of edit boxes together.

Most of the time, the user just looks at the screen and goes "huh??", and doesn't know where to begin to enter data. And usually while entering data, he loses his focus very easily, especially if he has to keep track of some other controls around the screen.

Anyway, giving the currently active input edit box an indication that it is active at the moment, is a good idea. You can, for instance, raise the edit box or simply make its border a 3D one. That's what we'll do here.

I created a class named CBorderEdit, which is derived from CEdit. In this class, I process WM_SETFOCUS and WM_KILLFOCUS and simply change the extended style of the edit box, using CWnd::ModifyStyleEx.


void CBorderEdit::OnSetFocus(CWnd* pOldWnd) 
{
 CEdit::OnSetFocus(pOldWnd);
 ModifyStyleEx(0, WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE |  WS_EX_RIGHT);
}

void CBorderEdit::OnKillFocus(CWnd* pNewWnd) 
{
 CEdit::OnKillFocus(pNewWnd);
 ModifyStyleEx(WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE | WS_EX_RIGHT, 0);
}

Note: For some odd reason, the style of the edit box doesn't change unless I throw in the WS_EX_RIGHT or WS_EX_RTLREADING extended styles. If anyone has any idea, please let me know.

Next, link a member variable of the type CBorderEdit to some edit box control that you put in the dialog resource (make sure you're using Class Wizard so it would use DDX_), and there you go!



Comments

  • ExEditors Library

    Posted by Legacy on 03/19/2002 12:00am

    Originally posted by: Mike Philips

    A complete collection of editors in a single file:
    
    

    http://www.exontrol.com/sg.jsp?content=products/exeditors

    Regards,
    Mike

    Reply
  • Good idea.

    Posted by Legacy on 04/18/2000 12:00am

    Originally posted by: Aykut

    This is a good idea. Also changing the background color with a soft tone with quick intervals for a few seconds when dialog appears can be a nice solution.

    Users want clever and good-looking interfaces.

    Aykut Kili�

    Reply
  • Thanks for the idea!

    Posted by Legacy on 03/22/1999 12:00am

    Originally posted by: Jamie Nordmeyer

    I'm building a service tracking program for my company, and there are a huge number of text boxes that need to be filled in. This will help greatly!

    Reply
  • WS_EX_RIGHT and WS_EX_RTLREADING ...

    Posted by Legacy on 01/18/1999 12:00am

    Originally posted by: Pierre GRENETTE

    You don't have to use these odd styles (WS_EX_RIGHT and WS_EX_RTLREADING) to reflect the frame changement.
    
    Instead, use the third (and optional) parameter of ModifyStyleEx which is a bit field for the SetWindowPos method. Use the SWP_FRAMECHANGED flag and it works great:

    void CBorderEdit::OnKillFocus(CWnd* pNewWnd)
    {
    CEdit::OnKillFocus(pNewWnd);

    // TODO: Add your message handler code here
    ModifyStyleEx(WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE, 0, SWP_FRAMECHANGED);
    }

    void CBorderEdit::OnSetFocus(CWnd* pOldWnd)
    {
    CEdit::OnSetFocus(pOldWnd);

    // TODO: Add your message handler code here
    ModifyStyleEx(0, WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE, SWP_FRAMECHANGED);
    }


    Regards,
    Pierre

    PS: this tip works also with ModifyStyle() and, of course, with SetWindowPos().

    Reply
  • Cool Idea!

    Posted by Legacy on 01/17/1999 12:00am

    Originally posted by: Bob

    Great idea! This will be implemented in future works! thanks!

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Today's agile organizations pose operations teams with a tremendous challenge: to deploy new releases to production immediately after development and testing is completed. To ensure that applications are deployed successfully, an automatic and transparent process is required. We refer to this process as Zero Touch Deployment™. This white paper reviews two approaches to Zero Touch Deployment--a script-based solution and a release automation platform. The article discusses how each can solve the key …

  • On-demand Event Event Date: December 18, 2014 The Internet of Things (IoT) incorporates physical devices into business processes using predictive analytics. While it relies heavily on existing Internet technologies, it differs by including physical devices, specialized protocols, physical analytics, and a unique partner network. To capture the real business value of IoT, the industry must move beyond customized projects to general patterns and platforms. Check out this webcast and join industry experts as …

Most Popular Programming Stories

More for Developers

RSS Feeds