"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

  • You probably have several goals for your patient portal of choice. Is "community" one of them? With a bevy of vendors offering portal solutions, it can be challenging for a hospital to know where to start. Fortunately, YourCareCommunity helps ease the decision-making process. Read this white paper to learn more. "3 Ways Clinicians can Leverage a Patient Portal to Craft a Healthcare Community" is a published document owned by www.medhost.com

  • Today's competitive marketplace requires the organization to frequently release and deploy applications at the pace of user demands, with reduced cost, risk, and increased quality. This book defines the basics of application release and deployment, and provides best practices for implementation with resources for a deeper dive. Inside you will find: The business and technical drivers behind automated application release and deployment. Evaluation guides for application release and deployment solutions. …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds