"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

  • Lenovo recommends Windows 8 Pro. "I dropped my laptop getting out of the taxi." This probably sounds familiar to most IT professionals. If your employees are traveling, you know their devices are in for a rough go. Whether it's a trip to the conference room or a convention out of town, any time equipment leaves a user's desk it is at risk of being put into harm's way. Stay connected at all times, whether at the office or on the go, with agile, durable, and flexible devices like the Lenovo® …

  • When individual departments procure cloud service for their own use, they usually don't consider the hazardous organization-wide implications. Read this paper to learn best practices for setting up an internal, IT-based cloud brokerage function that service the entire organization. Find out how this approach enables you to retain top-down visibility and control of network security and manage the impact of cloud traffic on your WAN.

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date