"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: October 29, 2014 @ 11:00 a.m. ET / 8:00 a.m. PT Are you interested in building a cognitive application using the power of IBM Watson? Need a platform that provides speed and ease for rapidly deploying this application? Join Chris Madison, Watson Solution Architect, as he walks through the process of building a Watson powered application on IBM Bluemix. Chris will talk about the new Watson Services just released on IBM bluemix, but more importantly he will do a step by step cognitive …

  • Live Event Date: October 29, 2014 @ 1:00 p.m. ET / 10:00 a.m. PT It's well understood how critical version control is for code. However, its importance to DevOps isn't always recognized. The 2014 DevOps Survey of Practice shows that one of the key predictors of DevOps success is putting all production environment artifacts into version control. In this eSeminar, Gene Kim will discuss these survey findings and will share woeful tales of artifact management gone wrong! Gene will also share examples of how …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds