Announcement

Collapse
No announcement yet.

Tab Control and Resource Dialogs

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

  • Kev Peel
    replied
    It might work on some more recent OSs, but if you want to ensure your program works on all versions of Windows, you should call InitCommonControlsEx with the %ICC_TAB_CLASSES flag.

    Leave a comment:


  • Thomas Tierney
    replied
    Give it a try

    Leave a comment:


  • Michael Mattias
    replied
    I don't know how that worked, because you did not InitCommonControls[Ex] (with flags for the tab control) before you did the CONTROL ADD for that tab control.

    Leave a comment:


  • Thomas Tierney
    replied
    Thanks for the reply, however it wasnt actually the problem. The problem was the center flag on the dialog resource itself.

    Leave a comment:


  • Kev Peel
    replied
    It's probably not a good idea to use DDT commands with the 'SDK' dialog as they may not (and are not designed to) work with non-DDT dialogs or controls. Try using SetWindowPos to set the size and the SWP_SHOWWINDOW flag to show the window. This call only works with pixels, so you'd need DIALOG UNITS [..] TO PIXELS to convert the values.

    Also, CreateDialog/CreateDialogParam requires a callback to work, according to the docs.
    Last edited by Kev Peel; 30 Jan 2008, 03:42 PM.

    Leave a comment:


  • Thomas Tierney
    started a topic Tab Control and Resource Dialogs

    Tab Control and Resource Dialogs

    Hello all,

    I have a window with a tab control on it, what I need to do is get the resource dialog and place it into the tab control and show/hide as needed.
    for the life of me I can not get it to work, could you take a look at the source give me an idea of where the malfunction is?


    Code:
    #Compile Exe
    #Include "Win32Api.Inc"
    #Include "COMMCTRL.INC"
    
    '#Resource "<add resource with dialog>"
    '===================================================================
    '103 DIALOGEX 0, 0, 249, 182
    'STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD | WS_SYSMENU
    'FONT 8, "MS Shell Dlg", 400, 0, 0x1
    'BEGIN
    '    DEFPUSHBUTTON   "OK",1041,192,7,50,14
    '    PUSHBUTTON      "Cancel",1042,192,24,50,14
    '    PUSHBUTTON      "Apply",1043,193,41,49,14
    'END
    '===================================================================
    %DIALOG_ID = 103 'or whatever number you want
    %APP_OK = 1041
    %APP_CLOSE = 1042
    %APP_APPLY = 1043
    
    CallBack Function OptionsDialog() As Long
    
        Local hDlg      As Long
    
        Select Case CbMsg
          Case %WM_INITDIALOG
                hDlg = CreateDialogParam(GetModuleHandle(ByVal %NULL), ByVal 103, CbHndl, 0, 0) 'CodePtr(hDlgFrame1), 0)
                If hDlg = 0 Then
                   MsgBox "ERROR " & Str$(getLastError())
                End If
                Dialog Set Loc hDlg,0,0
                Dialog Set Size hDlg,500,500
                Dialog Show State hDlg, %SW_SHOW
          Case %WM_COMMAND
                Select Case CbWParam
                   Case %APP_OK
                      EndDialog CbHndl, %APP_OK
                   Case %APP_CLOSE
                     EndDialog CbHndl, %APP_CLOSE
                   Case %APP_APPLY
                     EndDialog CbHndl, %APP_APPLY
                End Select
        End Select
      Function =  %FALSE
    
    End Function
    
    
    
    Function PBMain
        Local hDlg As Long
        Local lRslt As Long
        Local szBuf    As Asciiz * 32
        Local hCtl As Long
        Local tTabItem As TC_ITEM
    
        Dialog New  0, "Options", 73, 82, 250, 225, %WS_POPUP Or _
            %WS_BORDER Or %WS_DLGFRAME Or %WS_SYSMENU Or %WS_MINIMIZEBOX Or _
            %WS_MAXIMIZEBOX Or %WS_CLIPSIBLINGS Or %WS_VISIBLE Or %DS_MODALFRAME _
            Or %DS_3DLOOK Or %DS_NOFAILCREATE Or %DS_SETFONT, %WS_EX_WINDOWEDGE _
            Or %WS_EX_CONTROLPARENT Or %WS_EX_LEFT Or %WS_EX_LTRREADING Or _
            %WS_EX_RIGHTSCROLLBAR Or %WS_CHILD, To hDlg
    
    '
        Control Add "SysTabControl32", hDlg, 540, _
            "SysTabControl32_1", 5, 5, 240, 195, %WS_CHILD Or %WS_CLIPSIBLINGS Or %WS_VISIBLE Or _
            %WS_TABSTOP Or %TCS_SINGLELINE Or %TCS_TABS, %WS_EX_LEFT Or _
            %WS_EX_LTRREADING
    
        Control Handle hDlg, 540 To hCtl
    
    
    
        tTabItem.Mask    = %TCIF_TEXT
        tTabItem.iImage  = -1
        tTabItem.pszText = VarPtr(szBuf)
        szBuf = "General"
        TabCtrl_InsertItem(hCtl, 0, tTabItem)
    
        Dialog Show Modal hDlg, Call OptionsDialog 'To lRslt
        Function = lRslt
     
    End Function
    Any help would be greatly appreciated..

    Thanks
Working...
X