"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

  • Live Event Date: August 20, 2014 @ 1:00 p.m. ET / 10:00 a.m. PT When you look at natural user interfaces as a developer, it isn't just fun and games. There are some very serious, real-world usage models of how things can help make the world a better place – things like Intel® RealSense™ technology. Check out this upcoming eSeminar and join the panel of experts, both from inside and outside of Intel, as they discuss how natural user interfaces will likely be getting adopted in a wide variety …

  • Savvy enterprises are discovering that the cloud holds the power to transform IT processes and support business objectives. IT departments can use the cloud to redefine the continuum of development and operations—a process that is becoming known as DevOps. Download the Executive Brief DevOps: Why IT Operations Managers Should Care About the Cloud—prepared by Frost & Sullivan and sponsored by IBM—to learn how IBM SmartCloud Application services provide a robust platform that streamlines …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds