Announcement

Collapse
No announcement yet.

Win 32 Child Windows (SDK)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Win 32 Child Windows (SDK)

    I have an application where I have this setup...

    Main Window
    - Six static child controls. Three are just labels. Three are used to show the current selection.
    - Two Button controls
    - One Status bar window control
    - One "overlapped-type" window which sits on top of the main window and the static controls (Kinda Like MDI, except I am creating this overlapped window as a "regular" child. I am using this window to show reports and other "text-type" info using TextOut).
    - All controls are created with CreateWindowEx; that is, they are not in a dialog.

    The data items I am allowing the user to select are files, with paths; but especially when they are very long, these look terrible and I want to reduce the size of the displayed items, kind of like PathCompactEx does; or maybe just put in some "user-friendly" verbage.

    What I do when the "Process" button is hit is retrieve the data items from the controls (GetDlgItemText) and use that as the input values for the "processing" function.

    What I was thinking about doing was adding three hidden static or edit controls to the main window and using these to store the "real" value of the user-supplied data, and keeping the static controls as the "user-friendly" item names.

    The questions which arise are...

    1. Is the use of hidden edit controls like this considered "bad form?" I know I could use GLOBAL variables, but I hate GLOBALs (they confuse me, especially since PB's compilers do not flag duplicated LOCAL datanames at compile time). (Plus, every routine in the application gets an hWnd passed to it, meaning I can get any data tied to any window).

    2. I said this was kind of like MDI; but I can't seem to get the caption bar on the child "overlapped-style" window to come up highlited. I know it is getting the focus, because my TrackPopupMenu is working as expected. (Or does that not necessarily mean the window is getting focus?).

    Is there some special combination of style/extendedstyle I should be using? I want this window resizeable within the constraints of the parent window dimensions.

    3. Also on this Child window, when I put a "minimize" box on it, it minimizes OK, but it minimizes "underneath" the status bar, and you have to resize the main window larger (vertically) to expose the minimized rectangle in order to click on the "restore" icon. Is this the normal behavior? Is there a message I can intercept to change the location to which the minimized icon will be located?


    Thanks,






    ------------------
    Michael Mattias
    Racine WI USA
    [email protected]
    Michael Mattias
    Tal Systems (retired)
    Port Washington WI USA
    [email protected]
    http://www.talsystems.com

  • #2
    michael;

    i can help you with just a couple of things with regards, to the activating
    the child window and minimize issue. one of my first win32 projects was
    to create a multiple window application for my virtual flash emulator
    (hitachi 8/16bit embedded micro h8/3644f). it is all done in sdk, since
    it was based on a c example. for the child window to become activated
    you need to handle this programmatically. for the minimize problem you
    need to handle it slightly differently, i used a frame window, and a client
    window within the frame. the status bar is part of the frame window, so
    the client is above the status bar and when a child window is minimized
    it initially shows up above the status bar. but remember, depending on the
    state of your main window, once you resize it, the minimized window will
    stay in its exact window coordinates and will no longer be on the
    bottom of your client area. in my code, i added a function to organize
    all minimized windows.

    here is the link...



    added: sorry, the link above is no longer valid? so i copied two things
    search for topic: mulitiple application window template

    Code:
    '-------------------------------------------------------------
    ' arrange all minimized windows on the parents client area.
    '-------------------------------------------------------------
    sub myarrangeicons()
      arrangeiconicwindows hwndclient
    end sub
     
    '--------------------------------------------------------------
    ' follow the user's mouse clicks, deactivate old, activate new.
    '--------------------------------------------------------------
    sub activatetittlebar()  'global=hwndnew
     
        '--get the active window and remove the activation bar
     
            if bit(acwinflag,%nwcode) = %true then
                sendmessage hwndcode, %wm_ncactivate, %false, 0
                bit reset acwinflag, %nwcode
            elseif bit(acwinflag,%nwmemory) = %true then
                sendmessage hwndmemory, %wm_ncactivate, %false, 0
                bit reset acwinflag, %nwmemory
            elseif bit(acwinflag,%nwcpu) = %true then
                sendmessage hwndcpu, %wm_ncactivate, %false, 0
                bit reset acwinflag, %nwcpu
            else
                sendmessage hwndports, %wm_ncactivate, %false, 0
                bit reset acwinflag, %nwports
            end if
     
        '--set the activation bar on the user selected window
        sendmessage hwndnew, %wm_ncactivate, %true, 0
             select case hwndnew
                 case hwndcode
                      bit set acwinflag,%nwcode
                 case hwndmemory
                      bit set acwinflag,%nwmemory
                 case hwndcpu
                      bit set acwinflag,%nwcpu
                 case hwndports
                      bit set acwinflag,%nwports
             end select
     
        '--bring it to the top
        setwindowpos  hwndnew, %hwnd_top, 0, 0, 0, 0, %swp_nomove or %swp_nosize
     
    end sub

    hth
    regards,
    jules


    [this message has been edited by jules marchildon (edited june 15, 2001).]

    Comment


    • #3
      Even though the overlapped window is confined within the borders of the
      Main window the following should work. The minimized window disappearing
      behined the statusbar is normal behaviour. It is aligning itself at the bottom
      of the client area of its parent which just happens to be where your statusbar
      is sitting. Remember, the statusbar is a child window of Main window.

      Try the following in the WndProc for the confined window.
      Code:
        LOCAL  ptwp        AS WINDOWPOS PTR         ' Size and position info
        
          CASE %WM_WINDOWPOSCHANGING
            ptwp = lParam
         
            IF IsIconic(hWnd) THEN
              ' 1. Get the work area for Main window.
              '    This is the client area - (toolbar + statusbar)
              ' 2. Calculate the desired position of minimized window within
              '    this area
              ' 3. Positioned window as shown below
              @ptwp.x = desired x-coord
              @ptwp.y = desired y-coord
              FUNCTION = %FALSE
              EXIT FUNCTION
            END IF
      If I find some time tonight I will check out your other questions.

      Try the following in the WndProc for the confined window.
      This is just a hunch.
      Code:
        %WM_SETFOCUS
          SendMessage hWnd, %WM_NCACTIVATE, %TRUE, 0
        
        %WM_KILLFOCUS
          SendMessage hWnd, %WM_NCACTIVATE, %FALSE, 0
      ------------------
      Dominic Mitchell

      [This message has been edited by Dominic Mitchell (edited June 15, 2001).]
      Dominic Mitchell
      Phoenix Visual Designer
      http://www.phnxthunder.com

      Comment


      • #4
        Thank you guys very much. Those are some great ideas for me to play with.

        MCM


        Michael Mattias
        Tal Systems (retired)
        Port Washington WI USA
        [email protected]
        http://www.talsystems.com

        Comment

        Working...
        X