Thread: Edit box(es), and specialized onmouseover

  1. #1
    The Defective GRAPE Lurker's Avatar
    Join Date
    Feb 2003
    Posts
    949

    Edit box(es), and specialized onmouseover

    Sorry, more questions!

    1. How could I have 2 edit boxes, both being open and resizable, like in word, you could have 2 files open but the program itself is only open once. (Confused yet? I am )

    2. How could I change the text of a status bar onmouseover of a button on the toolbar? Like, onmouseover of the save button, the Status Bar would display "Save", and onmouseout, it would return to normal?

    Thanks again, this is a real help !
    Do not make direct eye contact with me.

  2. #2
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    1. Multiple document interface (mdi).
    2. Assuming you have tooltips on that toolbar then typically you would handle the WM_NOTIFY for the toolbar parent and look for a TTN_GETDISPINFO notification message. When you set the tooltip text you can send an SB_SETTEXT message to the status bar to update its text with what you need.

    edit: links
    Last edited by Ken Fitlike; 05-24-2003 at 12:29 PM.

  3. #3
    The Defective GRAPE Lurker's Avatar
    Join Date
    Feb 2003
    Posts
    949
    Thanks for response Ken, but a few questions.
    1. How would I create tooltips
    2. Is there any other way besides MDI? Ill probably use it, but you know...
    Do not make direct eye contact with me.

  4. #4
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    1. They are common controls: tooltip start.
    2. Not if you want "both being open and resizable, like in word, you could have 2 files open but the program itself is only open once."

  5. #5
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    You need to size the mdiclient window to fill the frame window's client area:
    Code:
    case WM_SIZE:
    {
    /*stuff you have*/
    /*replace value of 40 with toolbar height, use SetWindowPos if you prefer */
    MoveWindow(g_hMDIClient, 0, 40, LOWORD(lParam), HIWORD (lParam)-40, 1); 
    /*resize the status bar when main (frame) window is resized*/
    SendMessage(GetDlgItem(hwnd,ID_MAIN_STATUS), WM_SIZE, 0, 0);
    }
    You might also want to move the edit control that's parked over the toolbar as it prevents user access to the toolbar. (hEdit, WM_CREATE, main (frame) window).

    Hope that helps.

    edit: editing. ps please warn me in future if you compile with borland; #pragma resource threw me for a bit.

    edit2: You might want to consider removing the WS_EX_CLIENTEDGE style from the mdiclient window, too, because it seems to cause a double border to appear in mdichild windows when they are maximised.
    Last edited by Ken Fitlike; 05-24-2003 at 09:28 PM.

  6. #6
    The Defective GRAPE Lurker's Avatar
    Join Date
    Feb 2003
    Posts
    949
    A few simple problems:

    1. Wont cut, copy or paste
    2. Wont save
    3. How can I make the edit box the same size as the MDI window?

    THANKS!!!!
    Do not make direct eye contact with me.

  7. #7
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    1 & 2 are the result of the same problem: your DoFileSave fn is called for the main window in response to menu selection so when you attempt to get the handle of the mdichild edit control with GetDlgItem, you get NULL because you are using the frame window handle as the parent. You may also encounter other problems later with this GetDlgItem approach because of the control id: what happens when you have multiple child windows open and each of them has an edit control with the same id?

    3. Same as you would anywhere else - handle WM_SIZE for the mdichild window and MoveWindow or SetWindwPos on the edit to fill the mdichild window client area. You need to put in a call to DefMdiChildProc here too (before MoveWindow etc is fine) to ensure that the mdichild draws itself properly when maximised.

    It might also be an idea to put the following in your mdichild window procedure to reduce flicker when resizing the mdichild window:
    Code:
    case WM_ERASEBKGND: return 1;
    which just stops the system from repainting the mdichild client area.

    edit: typos
    Last edited by Ken Fitlike; 05-25-2003 at 11:42 AM.

  8. #8
    The Defective GRAPE Lurker's Avatar
    Join Date
    Feb 2003
    Posts
    949
    Ok, how would I fix 1/2? Tried several things, but, how else do you get the handle of the Child edit box? Thanks!
    Do not make direct eye contact with me.

Popular pages Recent additions subscribe to a feed