Announcement

Collapse
No announcement yet.

Treeview in Tab

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

  • Treeview in Tab

    It appears that a tab control eats notification messages from a treeview control imbedded in the tab:

    Code:
    #COMPILE EXE "TREEVIEW TEST"
    #DEBUG ERROR ON
    #DEBUG DISPLAY ON
    
    DEFLNG I - N
    
    #INCLUDE "WIN32API.INC"
    #INCLUDE "COMMCTRL.INC"
    
    %TV_IDL   = 100
    %TV_IDR   = 200
    %TB_ID    = 300
    
    %DLGMESS    = %WM_USER + 500
    
    TYPE Handle_Struct
      MainDlg     AS DWORD
      TabDlgL     AS DWORD
      TabDlgR     AS DWORD
    END TYPE
    
    '/===================================================================================/'
    FUNCTION PBMAIN () AS LONG
    InitCommonControls
    
    CALL Maindlg(0)
    
    END FUNCTION
    
    '---------------------------------------------------------------------------------------
    '---------------------------------------------------------------------------------------
    
    SUB MainDlg(BYVAL DlgParent AS DWORD)
    
    LOCAL Hndl   AS DWORD
    
    LOCAL tHndls AS Handle_Struct
    
    DIALOG NEW DlgParent, "TREEVIEW LEARN", , ,480, 320, %WS_OVERLAPPEDWINDOW _
        OR %WS_THICKFRAME OR %WS_CLIPCHILDREN OR %WS_CLIPSIBLINGS, TO tHndls.MainDlg
    
    CONTROL ADD TAB, tHndls.MainDlg, %TB_ID, "Numbers$", 0, 0, 475, 318, %WS_CHILD OR _
                     %WS_TABSTOP OR %TCS_RAGGEDRIGHT OR %TCS_FOCUSONBUTTONDOWN, _
                     %WS_EX_WINDOWEDGE
    
    TAB INSERT PAGE tHndls.MainDlg, %TB_ID, 1, 0, "Numbers" TO tHndls.TabDlgL
    TAB INSERT PAGE tHndls.MainDlg, %TB_ID, 2, 0, "Letters" TO tHndls.TabDlgR
    
    '/===========================================================================/'
    '                                       CALL TvCtl_Cb is commented out for both treeview controls
    '/===========================================================================/'
    
    CONTROL ADD TREEVIEW, tHndls.TabDlgL, %TV_IDL, "Numbers", 0, 0, 470, 316, %WS_TABSTOP OR _
                          %TVS_HASBUTTONS OR %TVS_LINESATROOT OR %TVS_HASLINES OR _
                          %TVS_CHECKBOXES OR %TVS_SHOWSELALWAYS OR _
                          %TVS_FULLROWSELECT, %WS_EX_WINDOWEDGE' call TvCtl_Cb()
    
    CONTROL ADD TREEVIEW, tHndls.TabDlgR, %TV_IDR, "Letters", 0, 0, 470, 316, %WS_TABSTOP OR _
                          %TVS_HASBUTTONS OR %TVS_LINESATROOT OR %TVS_HASLINES OR _
                          %TVS_SHOWSELALWAYS OR %TVS_CHECKBOXES OR %TVS_FULLROWSELECT, _
                          %WS_EX_WINDOWEDGE' CALL TvCtl_Cb()
    
    FOR I = 0 TO 9
      TREEVIEW INSERT ITEM tHndls.TabDlgL, %TV_IDL, 0, 0, 0, 0, FORMAT$(I) + "$" TO Hndl
    NEXT I
    
    FOR I = ASC("A") TO ASC("I")
      TREEVIEW INSERT ITEM tHndls.TabDlgR, %TV_IDR, 0, 0, 0, 0, CHR$(I) TO Hndl
    NEXT I
    
    DIALOG SHOW MODAL tHndls.MainDlg, CALL Main_Cb()
    
    
    END SUB
    
    '---------------------------------------------------------------------------------------
    '---------------------------------------------------------------------------------------
    
    CALLBACK FUNCTION Main_Cb()
    
    LOCAL Hndl AS DWORD
    
    LOCAL tNmHdr      AS NMHDR
    
    LOCAL NmHdrPtr    AS NMHDR POINTER
    Hndl = CBHNDL
    
    SELECT CASE CBMSG
      CASE %WM_NOTIFY
        NmHdrPtr = CBLPARAM
        tNmHdr = @NmHdrPtr
    
        SELECT CASE tNmHdr.idFrom
          CASE %TB_ID
            MSGBOX "tab ctrl"
          CASE %TV_IDL
            MSGBOX "left treeview"
          CASE %TV_IDR
            MSGBOX "right treeview"
        END SELECT
    END SELECT
    END FUNCTION
    
    '---------------------------------------------------------------------------------------
    '---------------------------------------------------------------------------------------
    
    CALLBACK FUNCTION TabCtl_Cb()
      EXIT FUNCTION
    END FUNCTION
    
    '---------------------------------------------------------------------------------------
    '---------------------------------------------------------------------------------------
    
    CALLBACK FUNCTION TvCtl_Cb()
    
    LOCAL tNmHdr      AS NMHDR
    LOCAL NmHdrPtr    AS NMHDR POINTER
    
    SELECT CASE CBMSG
      CASE %WM_NOTIFY
        NmHdrPtr = CBLPARAM
        tNmHdr = @NmHdrPtr
        SELECT CASE tNmHdr.code
          CASE %NM_CLICK
            SELECT CASE tNmHdr.idFrom
              CASE %TV_IDL
                MSGBOX "Left Treeview clicked"
              CASE %TV_IDR
                MSGBOX "Right Treeview clicked"
            END SELECT
        END SELECT
    END SELECT
    END FUNCTION
    However, by sending treeview messages to a different callback the TVN_ messages are received.

    Code:
    #COMPILE EXE "TREEVIEW TEST"
    #DEBUG ERROR ON
    #DEBUG DISPLAY ON
    
    DEFLNG I - N
    
    #INCLUDE "WIN32API.INC"
    #INCLUDE "COMMCTRL.INC"
    
    %TV_IDL   = 100
    %TV_IDR   = 200
    %TB_ID    = 300
    
    %DLGMESS    = %WM_USER + 500
    
    TYPE Handle_Struct
      MainDlg     AS DWORD
      TabDlgL     AS DWORD
      TabDlgR     AS DWORD
    END TYPE
    
    '/===================================================================================/'
    FUNCTION PBMAIN () AS LONG
    InitCommonControls
    
    CALL Maindlg(0)
    
    END FUNCTION
    
    '---------------------------------------------------------------------------------------
    '---------------------------------------------------------------------------------------
    
    SUB MainDlg(BYVAL DlgParent AS DWORD)
    
    LOCAL Hndl   AS DWORD
    
    LOCAL tHndls AS Handle_Struct
    
    DIALOG NEW DlgParent, "TREEVIEW LEARN", , ,480, 320, %WS_OVERLAPPEDWINDOW _
        OR %WS_THICKFRAME OR %WS_CLIPCHILDREN OR %WS_CLIPSIBLINGS, TO tHndls.MainDlg
    
    CONTROL ADD TAB, tHndls.MainDlg, %TB_ID, "Numbers$", 0, 0, 475, 318, %WS_CHILD OR _
                     %WS_TABSTOP OR %TCS_RAGGEDRIGHT OR %TCS_FOCUSONBUTTONDOWN, _
                     %WS_EX_WINDOWEDGE
    
    TAB INSERT PAGE tHndls.MainDlg, %TB_ID, 1, 0, "Numbers" TO tHndls.TabDlgL
    TAB INSERT PAGE tHndls.MainDlg, %TB_ID, 2, 0, "Letters" TO tHndls.TabDlgR
    
    CONTROL ADD TREEVIEW, tHndls.TabDlgL, %TV_IDL, "Numbers", 0, 0, 470, 316, %WS_TABSTOP OR _
                          %TVS_HASBUTTONS OR %TVS_LINESATROOT OR %TVS_HASLINES OR _
                          %TVS_CHECKBOXES OR %TVS_SHOWSELALWAYS OR _
                          %TVS_FULLROWSELECT, %WS_EX_WINDOWEDGE CALL TvCtl_Cb()
    
    CONTROL ADD TREEVIEW, tHndls.TabDlgR, %TV_IDR, "Letters", 0, 0, 470, 316, %WS_TABSTOP OR _
                          %TVS_HASBUTTONS OR %TVS_LINESATROOT OR %TVS_HASLINES OR _
                          %TVS_SHOWSELALWAYS OR %TVS_CHECKBOXES OR %TVS_FULLROWSELECT, _
                          %WS_EX_WINDOWEDGE CALL TvCtl_Cb()
    
    FOR I = 0 TO 9
      TREEVIEW INSERT ITEM tHndls.TabDlgL, %TV_IDL, 0, 0, 0, 0, FORMAT$(I) + "$" TO Hndl
    NEXT I
    
    FOR I = ASC("A") TO ASC("I")
      TREEVIEW INSERT ITEM tHndls.TabDlgR, %TV_IDR, 0, 0, 0, 0, CHR$(I) TO Hndl
    NEXT I
    
    DIALOG SHOW MODAL tHndls.MainDlg, CALL Main_Cb()
    
    
    END SUB
    
    '---------------------------------------------------------------------------------------
    '---------------------------------------------------------------------------------------
    
    CALLBACK FUNCTION Main_Cb()
    
    LOCAL Hndl AS DWORD
    
    LOCAL tNmHdr      AS NMHDR
    
    LOCAL NmHdrPtr    AS NMHDR POINTER
    Hndl = CBHNDL
    
    SELECT CASE CBMSG
      CASE %WM_NOTIFY
        NmHdrPtr = CBLPARAM
        tNmHdr = @NmHdrPtr
    
        SELECT CASE tNmHdr.idFrom
          CASE %TB_ID
            MSGBOX "tab ctrl"
          CASE %TV_IDL
            MSGBOX "left treeview"
          CASE %TV_IDR
            MSGBOX "right treeview"
        END SELECT
    END SELECT
    END FUNCTION
    
    '---------------------------------------------------------------------------------------
    '---------------------------------------------------------------------------------------
    
    CALLBACK FUNCTION TabCtl_Cb()
      EXIT FUNCTION
    END FUNCTION
    
    '---------------------------------------------------------------------------------------
    '---------------------------------------------------------------------------------------
    
    CALLBACK FUNCTION TvCtl_Cb()
    
    LOCAL tNmHdr      AS NMHDR
    LOCAL NmHdrPtr    AS NMHDR POINTER
    
    SELECT CASE CBMSG
      CASE %WM_NOTIFY
        NmHdrPtr = CBLPARAM
        tNmHdr = @NmHdrPtr
        SELECT CASE tNmHdr.code
          CASE %NM_CLICK
            SELECT CASE tNmHdr.idFrom
              CASE %TV_IDL
                MSGBOX "Left Treeview clicked"
              CASE %TV_IDR
                MSGBOX "Right Treeview clicked"
            END SELECT
        END SELECT
    END SELECT
    END FUNCTION
    Subclassing either the tab control or the treeview control might also work.

    Since Listview controls also use WM_NOTIFY for the LVN_ messages, the tab control will probably eat them as well.

    Walt Decker

  • #2
    Controls don't 'eat' notifications. They are just going not where you expect them to go.

    I think here..
    Code:
     TAB INSERT PAGE tHndls.MainDlg, %TB_ID, 1, 0, "Numbers" TO tHndls.TabDlgL
    TAB INSERT PAGE tHndls.MainDlg, %TB_ID, 2, 0, "Letters" TO tHndls.TabDlgR
    ... you need a CALL clause to specify the dialog callback procedure for the two created page dialogs thndls.tabdlg{L|R}. Otherwise I could not tell you where those notifications are going.. for that matter, where ANY notification from those page dialogs is going. I think the control-level callback is working (?) because it pre-empts the normal routing of WM_NOTIFY from a control, which is to the owner window.

    Disclaimer: DDT handling of Tab controls is not my strong suit. But I've never had a problem with SDK-style tab controls. I might also think about using DIALOG SHOW MODELESS plus a message loop for your main dialog. I've always done the SDK-companion to that with a tab control.

    Comment


    • #3
      Hi Walt,
      Just tell both treeviews to call the main callback.

      Code:
      CONTROL ADD TREEVIEW, tHndls.TabDlg(L OR R), ... %WS_EX_WINDOWEDGE CALL Main_Cb
      Pierre

      Comment


      • #4
        Hello Pierre. The second listing takes care of the problem.
        Walt Decker

        Comment


        • #5
          Yep,
          I know, the solution I gave was to show a pretty simple way that need no supplemental callback function.

          Pierre

          Comment


          • #6
            When a specific CB is not specified message automatically go to the parent CB. That's where they are not being received in the first listing.
            Walt Decker

            Comment


            • #7
              Hey Walt,

              If I may, about the second listing, to avoid novice confusion .
              tNmHdr is kind of superfluous since @NmHdrPtr is already there and could be used.
              TabCtl_Cb can be removed since it is not referenced
              In Main_Cb(), %TV_IDL and TV_IDR will never fire and can also be removed.

              Pierre

              Comment


              • #8
                When a specific CB is not specified message automatically go to the parent CB. That's where they are not being received in the first listing.
                Thing is you didn't define a CB for the Treeviews' Parent Dialogs - which are the Tab Pages (as Michael pointed out in post #2).

                Note the CallBack Param in the Tab Insert statement..
                Code:
                TAB INSERT PAGE hDlg, ID&, PageNum&, Image&, Text$ [CALL CallBack] TO PageDlgVar&
                Rgds, Dave

                Comment


                • #9
                  Pierre, you are correct. TabCtl_Cb is a left-over from an attempt to send the tabctl messages to it. However, I found that, unless I did some off the wall stuff, the tab messages are passed back to main_Cb. As for using a pointer, I'm filling the structure and using it because many are not familiar with using pointers.

                  Originally I was using CBNMID and trying to trap the treeview messages with that. That's why the TV_IDL/R monicers are still there.

                  Dave, tried that. Treeview messages never reached the dialog callbacks. Defining a treeview cb is the only way I've been able to get the treeview messages to fire.
                  Last edited by Walt Decker; 22 Jul 2016, 10:39 AM.
                  Walt Decker

                  Comment


                  • #10
                    Treeview messages reach the nominated Callbacks in this version of the first listing..
                    Code:
                    #COMPILE EXE '"TREEVIEW TEST db"
                    #DEBUG ERROR ON
                    #DEBUG DISPLAY ON
                     
                    DEFLNG I - N
                     
                    #INCLUDE "WIN32API.INC"
                    #INCLUDE "COMMCTRL.INC"
                     
                    %TV_IDL   = 100
                    %TV_IDR   = 200
                    %TB_ID    = 300
                     
                    %DLGMESS    = %WM_USER + 500
                     
                    TYPE Handle_Struct
                      MainDlg     AS DWORD
                      TabDlgL     AS DWORD
                      TabDlgR     AS DWORD
                    END TYPE
                     
                    '/===================================================================================/'
                    FUNCTION PBMAIN () AS LONG
                    InitCommonControls
                     
                    CALL Maindlg(0)
                     
                    END FUNCTION
                     
                    '---------------------------------------------------------------------------------------
                    '---------------------------------------------------------------------------------------
                     
                    SUB MainDlg(BYVAL DlgParent AS DWORD)
                     
                    LOCAL Hndl   AS DWORD
                     
                    LOCAL tHndls AS Handle_Struct
                     
                    DIALOG NEW DlgParent, "TREEVIEW LEARN", , ,480, 320, %WS_OVERLAPPEDWINDOW _
                        OR %WS_THICKFRAME OR %WS_CLIPCHILDREN OR %WS_CLIPSIBLINGS, TO tHndls.MainDlg
                     
                    CONTROL ADD TAB, tHndls.MainDlg, %TB_ID, "Numbers$", 0, 0, 475, 318, %WS_CHILD OR _
                                     %WS_TABSTOP OR %TCS_RAGGEDRIGHT OR %TCS_FOCUSONBUTTONDOWN, _
                                     %WS_EX_WINDOWEDGE
                     
                     'TAB INSERT PAGE tHndls.MainDlg, %TB_ID, 1, 0, "Numbers" TO tHndls.TabDlgL  ' No CallBack defined for child msgs
                    TAB INSERT PAGE tHndls.MainDlg, %TB_ID, 1, 0, "Numbers" Call Main_Cb TO tHndls.TabDlgL    ' Use Main CB
                    TAB INSERT PAGE tHndls.MainDlg, %TB_ID, 2, 0, "Letters" Call TabCtl_Cb TO tHndls.TabDlgR  ' * Use TabCtl_Cb
                     
                    '/===========================================================================/'
                    '                                       CALL TvCtl_Cb is commented out for both treeview controls **
                    '/===========================================================================/'
                     
                    CONTROL ADD TREEVIEW, tHndls.TabDlgL, %TV_IDL, "Numbers", 0, 0, 470, 316, %WS_TABSTOP OR _
                                          %TVS_HASBUTTONS OR %TVS_LINESATROOT OR %TVS_HASLINES OR _
                                          %TVS_CHECKBOXES OR %TVS_SHOWSELALWAYS OR _
                                          %TVS_FULLROWSELECT, %WS_EX_WINDOWEDGE ' call TvCtl_Cb()    ' **
                     
                    CONTROL ADD TREEVIEW, tHndls.TabDlgR, %TV_IDR, "Letters", 0, 0, 470, 316, %WS_TABSTOP OR _
                                          %TVS_HASBUTTONS OR %TVS_LINESATROOT OR %TVS_HASLINES OR _
                                          %TVS_CHECKBOXES OR %TVS_SHOWSELALWAYS OR _
                                          %TVS_FULLROWSELECT, %WS_EX_WINDOWEDGE ' call TvCtl_Cb()    ' **
                     
                    FOR I = 0 TO 9
                      TREEVIEW INSERT ITEM tHndls.TabDlgL, %TV_IDL, 0, 0, 0, 0, FORMAT$(I) + "$" TO Hndl
                    NEXT I
                     
                    FOR I = ASC("A") TO ASC("I")
                      TREEVIEW INSERT ITEM tHndls.TabDlgR, %TV_IDR, 0, 0, 0, 0, CHR$(I) TO Hndl
                    NEXT I
                     
                    DIALOG SHOW MODAL tHndls.MainDlg, CALL Main_Cb()
                     
                    END SUB
                     
                    '---------------------------------------------------------------------------------------
                    '---------------------------------------------------------------------------------------
                     
                    CALLBACK FUNCTION Main_Cb()
                      SELECT CASE CB.MSG
                        CASE %WM_NOTIFY
                          SELECT CASE Cb.NmCode
                            CASE %NM_CLICK
                              SELECT CASE Cb.NmId
                                CASE %TB_ID         ' From Tab Control (sent to Parent CB)
                                 Local sTab As String, nTab As Long
                                  Tab Get Select Cb.Hndl, %TB_ID To nTab
                                  Tab Get Text Cb.Hndl, %TB_ID, nTab To sTab
                                  MSGBOX Str$(nTab) + " tab name "  + sTab,,"Main_Cb"
                                CASE %TV_IDL
                                  MSGBOX "left treeview",,"Main_Cb"      ' From TreeView to Page1's Callback
                                CASE %TV_IDR
                                  MSGBOX "right treeview",,"Main_Cb"     ' -
                              END SELECT
                          END SELECT
                      END SELECT
                    END FUNCTION
                     
                    '---------------------------------------------------------------------------------------
                    '---------------------------------------------------------------------------------------
                     
                    CALLBACK FUNCTION TabCtl_Cb()   ' * TAB page CallBack
                      SELECT CASE CB.MSG
                        CASE %WM_NOTIFY
                          SELECT CASE Cb.NmCode
                            CASE %NM_CLICK
                              SELECT CASE Cb.NmId
                                CASE %TV_IDL
                                  MSGBOX "left treeview",,"TabCtl_Cb"    ' -
                                CASE %TV_IDR       
                                  MSGBOX "right treeview",,"TabCtl_Cb"   ' From TreeView to Page2's Callback
                              END SELECT
                          END SELECT
                      END SELECT
                    END FUNCTION
                     
                    '---------------------------------------------------------------------------------------
                    '---------------------------------------------------------------------------------------
                     
                    CALLBACK FUNCTION TvCtl_Cb()    ' ** Possible TreeView CallBack
                      Function = 0                  ' If not specified, TV messages go to Parent Dialog CallBack
                    END Function                    ' ie Page CallBack(s) if defined
                     
                    '---------------------------------------------------------------------------------------
                    '---------------------------------------------------------------------------------------
                    Rgds, Dave

                    Comment


                    • #11
                      Originally posted by Walt Decker View Post
                      Treeview messages never reached the dialog callbacks. Defining a treeview cb is the only way I've been able to get the treeview messages to fire.
                      Walt,
                      Also if I may say the following once more:

                      Just tell both treeviews to call the main callback.
                      Code:
                      CONTROL ADD TREEVIEW, tHndls.TabDlg(L OR R), ... %WS_EX_WINDOWEDGE CALL Main_Cb
                      Code:
                      #COMPILE EXE
                      #INCLUDE "Win32Api.inc"
                       
                      %Tab              = 101
                      %TreeviewNumber   = 201
                      %TreeviewLetter   = 202
                      '______________________________________________________________________________
                       
                      CALLBACK FUNCTION MainCallback()
                       LOCAL pNmHdrPtr AS NMHDR POINTER
                       
                       SELECT CASE CBMSG
                       
                         CASE %WM_NOTIFY
                           pNmHdrPtr = CBLPARAM
                       
                           SELECT CASE @pNmHdrPtr.idFrom
                       
                             CASE %Tab 'Here CBHNDL is the dialog handle
                               SetWindowText(CBHNDL, "Tab control")
                       
                             CASE %TreeviewNumber 'Here CBHNDL is the TAB handle
                               IF @pNmHdrPtr.code  = %NM_CLICK  THEN
                                 SetWindowText(GetParent(CBHNDL), "Number treeview clicked") 'GetParent(TabControl) = hDlg
                               END IF
                       
                             CASE %TreeviewLetter 'Here CBHNDL is the TAB handle
                               IF @pNmHdrPtr.code  = %NM_CLICK  THEN
                                 SetWindowText(GetParent(CBHNDL), "Letter treeview clicked") 'GetParent(TabControl) = hDlg
                               END IF
                       
                           END SELECT
                       
                       END SELECT
                       
                      END FUNCTION
                      '______________________________________________________________________________
                       
                      FUNCTION PBMAIN () AS LONG
                       LOCAL hDlg       AS DWORD
                       LOCAL hTabNumber AS DWORD
                       LOCAL hTabLetter AS DWORD
                       LOCAL Hndl       AS DWORD
                       LOCAL Looper     AS LONG
                       
                       DIALOG NEW %HWND_DESKTOP, "Treeview learn", , , 200, 200, _
                       %WS_CAPTION OR %WS_MINIMIZEBOX OR %WS_SYSMENU, 0 TO hDlg
                       
                       CONTROL ADD TAB, hDlg, %Tab, "Numbers$", 3, 3, 194, 194, _
                       %WS_CHILD OR %WS_TABSTOP OR %TCS_RAGGEDRIGHT OR %TCS_FOCUSONBUTTONDOWN
                       
                       TAB INSERT PAGE hDlg, %Tab, 1, 0, "Numbers" TO hTabNumber
                       TAB INSERT PAGE hDlg, %Tab, 2, 0, "Letters" TO hTabLetter
                       
                       CONTROL ADD TREEVIEW, hTabNumber, %TreeviewNumber, "Numbers", 0, 0, 470, 316, _
                       %WS_TABSTOP OR %TVS_HASBUTTONS OR %TVS_LINESATROOT OR %TVS_HASLINES OR %TVS_CHECKBOXES OR _
                       %TVS_SHOWSELALWAYS OR %TVS_FULLROWSELECT, %WS_EX_WINDOWEDGE CALL MainCallback()
                       
                       CONTROL ADD TREEVIEW, hTabLetter, %TreeviewLetter, "Letters", 0, 0, 470, 316, _
                       %WS_TABSTOP OR %TVS_HASBUTTONS OR %TVS_LINESATROOT OR %TVS_HASLINES OR %TVS_CHECKBOXES OR _
                       %TVS_SHOWSELALWAYS OR %TVS_FULLROWSELECT, %WS_EX_WINDOWEDGE CALL MainCallback()
                       
                       FOR Looper= 0 TO 9
                         TREEVIEW INSERT ITEM hTabNumber, %TreeviewNumber, 0, 0, 0, 0, FORMAT$(Looper, "00") TO Hndl
                       NEXT
                       
                       FOR Looper = ASC("A") TO ASC("J")
                         TREEVIEW INSERT ITEM hTabLetter, %TreeviewLetter, 0, 0, 0, 0, CHR$(Looper) TO Hndl
                       NEXT
                       
                       DIALOG SHOW MODAL hDlg, CALL MainCallback()
                       
                      END FUNCTION
                      '______________________________________________________________________________
                      '
                      Of course the use of only one callback might be quite confusing for some...

                      Pierre

                      Comment


                      • #12
                        As suggested in post #2..

                        Code:
                        TAB INSERT PAGE.....  CALL  dlgProcTabPage  
                        ...
                        
                        ' dialog procedure for the dialog created as a tab page
                        CALLBACK FUNCTION dlgProcTabPage () AS LONG 
                        ....
                        TAB INSERT PAGE creates a dialog. As coded, that dialog owns the treeview control. Seems logical to me the notifications from the treeview should go to a procedure for the dialog owning it.

                        Tab control = nice way to manage multiple windows/dialogs but it's still multiple windows each with its own window/dialog procedure except when sharing but sharing is "usually" only done when the windows are identical with multiple instances, e.g., MDI applications ( PBEDIT being a good example).

                        Comment


                        • #13
                          Managing multiple open user interface windows/dialogs

                          MDI (Multiple Document Interface):

                          CreateWindowEx Create main application window (called the "frame window" in MDI) .
                          CreateWindowEx Child 'container' window of class "mdiclient" owned by Frame window
                          FOR EACH DIFFERENT WINDOW TO BE ACTIVE AT ONE TIME WITHIN "FRAME"
                          • SendMessage hWndClient WM_MDICREATE (owner MDIClient ; each window class has own Window Procedure
                          • Multiple instance of same window type share the window procedure
                          • Size and location limited by "mdiclient"

                          ENDFOR

                          DDT WITH TAB CONTROL:

                          DIALOG NEW Create main application window
                          CONTROL ADD TAB Create 'container' window for multiple screens to be active all at same time; owner is "main" from DIALOG NEW
                          FOR EACH DIFFERENT WINDOW TO BE ACTIVE AT ONE TIME WITHIN "TAB"
                          • TAB INSERT PAGE with CALL procname ; each different child window "type" has its own Dialog Procedure "DlgProcTabPageN"
                          • Multiple instances of same type of dialog share "DlgProcTabPageN"
                          • Size and location limited by TAB control

                          ENDFOR

                          Call me naive but those two summaries look a lot alike.


                          MCM

                          Comment

                          Working...
                          X