Superclassed edit control; custom notifications

This is a discussion on Superclassed edit control; custom notifications within the Windows Programming forums, part of the Platform Specific Boards category; OK, my problem's as follows; a while back I wrote a custom windowproc function to superclass my edit controls to ...

  1. #1
    Registered User
    Join Date
    Mar 2002
    Posts
    125

    Superclassed edit control; custom notifications

    OK, my problem's as follows; a while back I wrote a custom windowproc function to superclass my edit controls to simulate dialog-box style tabbing (along with the same functionality when pressing enter, and being able to go to previous editboxes by backspacing in an empty box) in a regular window.
    I did this by calling
    Code:
    SetFocus( GetDlgItem( GetParent(hwnd), GetDlgCtrlID(hwnd)+1) );
    in the modded windowproc itself, but needless to say this gives it very limited functionality; it only works for editboxes that have IDs in a row and the parent window has no control over the whole process whatsoever.
    Now I want to expand this functionality by not having the edit control's windowproc itself call SetFocus, but instead send a notification to the parent window saying "select the previous/next editbox" or "the user pressed enter in this editbox, check it's contents now" so that I can take care of it differently for different parent windows. I was thinking of doing this by calling
    Code:
    SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(hwnd), ???), (LPARAM)hwnd);
    but I'm not sure what to put in the place of the question marks. I can go define my own notification code, but it seems there'd be no guarantee that the code would be a unique one, and there's a good chance the original editproc (which is still called from my modded proc) will also send a message with that identifier to the parent, causing a false alarm so to speak. How can I be sure I'm using a unique notification code? Or is there some cleaner way to send a custom notification to the parent window? (if so, how?)
    Thanks in advance!
    Typing stuff in Code::Blocks 8.02, compiling stuff with MinGW 3.4.5.

  2. #2
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    Probably the easiest solution is to use your own messsage rather than WM_COMMAND. You can safely use a message in the range WM_APP to 0xBFFF (eg. WM_APP + 1).

    You may also wish to look into the GetNextDlgTabItem function. This should work for normal windows as well as dialog boxes if IsDialogMessage is called in the message loop.

  3. #3
    Registered User
    Join Date
    Mar 2002
    Posts
    125
    It looks that the WM_APP + X message is exactly what I was looking for. Thanks a bunch!
    Typing stuff in Code::Blocks 8.02, compiling stuff with MinGW 3.4.5.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. line number on a rich edit control
    By rakan in forum Windows Programming
    Replies: 1
    Last Post: 02-18-2008, 06:58 AM
  2. brace-enclosed error
    By jdc18 in forum C++ Programming
    Replies: 53
    Last Post: 05-03-2007, 05:49 PM
  3. Appending text to an edit control
    By dit6a9 in forum Windows Programming
    Replies: 3
    Last Post: 08-13-2004, 09:52 PM
  4. Controlling an edit control
    By master5001 in forum Windows Programming
    Replies: 2
    Last Post: 10-16-2001, 03:08 PM
  5. Rich edit control example Win API
    By Echidna in forum Windows Programming
    Replies: 1
    Last Post: 09-17-2001, 02:12 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21