Announcement

Collapse
No announcement yet.

Tab select

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

  • Gösta H. Lovgren-2
    replied
    Thanks Dave. It makes sense now (and works). Your explanation, and especially code snippet is appreciated. I had read the PB Help but it just didn't stick for some reason. (Well there is a reason, but no need to go into inherent brain deficiencies on this thread. {sigh})

    ========================================================
    It seems to me, Golan, that the advance of civilization
    is nothing but an exercise in the limiting of privacy.
    Isaac Asimov, Foundation's Edge (1920- 1992)
    ========================================================

    Leave a comment:


  • Dave Biggs
    replied
    Gösta,
    Try this..
    Code:
        Control Add Option,   hDlg01, %IDC_NOISE2, "Nachts ruhig", col, row, 110, 12, Group_Start_Style
        Row = Row + 20
        Control Add Option,   hDlg01, %IDC_NOISE3, "Überwiegend ruhig", col, row, 110, 12
        Row = Row + 20
        Control Add Option,   hDlg01, %IDC_NOISE4, "Button 4",  col, row, 110, 12
        Row = Row + 20
        Control Add Option,   hDlg01, %IDC_NOISE5, "Button 5", col, row , 110, 12
     
        ' Add a Tab control DDT way...
        Control Add Tab,      hDlg01,  %IDC_CP_OPTIONS, "Add Tab", 50, 100, 270, 117, Group_End_Style
    SDK -> WS_GROUP:
    Specifies the first control of a group of controls.
    The group consists of this first control and all controls defined after it, up to the next control with the WS_GROUP style.
    The first control in each group usually has the WS_TABSTOP style so that the user can move from group to group.
    The user can subsequently change the keyboard focus from one control in the group to the next control in the group by using the direction keys.

    PB Help -> Control Add Option:
    In addition, the first OPTION control in a group should have the style %WS_GROUP (to mark the beginning of a group of buttons) and %WS_TABSTOP.
    The remainder of the OPTION controls in the group should not have %WS_GROUP or %WS_TABSTOP styles.
    However, the very next non-OPTION control to appear in the tab order after the group should be given the %WS_GROUP and %WS_TABSTOP styles (the latter may depend on the type of control it is).
    If there are no other controls after the group, add %WS_GROUP to the first control in the dialog.
    This ensures that keyboard navigation with the arrow keys will operate within the group of OPTION controls, and that the TAB and SHIFT+TAB keys will switch focus between whole groups of controls (instead of individual controls as is common when each group member has the %WS_TABSTOP style).

    Leave a comment:


  • Werner Bleckwendt
    replied
    Originally posted by Michael Mattias View Post
    Probably easier would be were WS_GROUP a 'default' style for the CONTROL ADD TAB statement; a "new feature suggestion" is probably in order for DDT users.
    That's what I said.

    The code now executes without a problem - exept when I change the order of the controls so the controls with %IDC_UNUSED are in front of the CONTROL ADD TAB statement. However, that is something I can live with.

    Leave a comment:


  • Gösta H. Lovgren-2
    replied
    Originally posted by Dave Biggs View Post
    %WS_GROUP is the answer..
    I don't think so. It hangs with/without the style.
    Code:
    '------------------------------------------------------------------------------
    '
    '------------------------------------------------------------------------------
    Function ShowCP(ByVal hParent As Dword) As Long
        Local lRslt, row, col, stile  As Long
        Local Group_Start_Style, Group_End_Style As Long
        Local hFont1 As Dword
        Dialog New hParent, "Camping Platz Info", 70, 70, 350, 300, %WS_POPUP Or _
            %WS_BORDER Or %WS_DLGFRAME Or %WS_SYSMENU Or %WS_CLIPSIBLINGS Or _
            %WS_VISIBLE Or %DS_MODALFRAME Or %DS_CENTER Or %DS_3DLOOK Or _
            %DS_NOFAILCREATE Or %DS_SETFONT, %WS_EX_CONTROLPARENT Or %WS_EX_LEFT _
            Or %WS_EX_LTRREADING Or %WS_EX_RIGHTSCROLLBAR, To hDlg01
        
        Group_Start_Style = %WS_GROUP 'Or %Ws_TabStop
        Group_End_Style = %WS_GROUP
        'stile = 
        Row = 20
        Col = 50
        Control Add Option,   hDlg01, %IDC_NOISE2, "Nachts ruhig", col, row, 110, 12, Group_Start_Style
        Row = Row + 20
        Control Add Option,   hDlg01, %IDC_NOISE3, "Überwiegend ruhig", col, row, 110, 12
        Row = Row + 20
        Control Add Option,   hDlg01, %IDC_NOISE4, "Button 4",  col, row, 110, 12
        Row = Row + 20
        Control Add Option,   hDlg01, %IDC_NOISE5, "Button 5", col, row , 110, 12, Group_End_Style
    
        ' Add a Tab control DDT way...
        Control Add Tab,      hDlg01,  %IDC_CP_OPTIONS, "Add Tab", 50, 100, 270, 117
        Tab Insert Page       hDlg01,  %IDC_CP_OPTIONS, 1, 0, "Infrastruktur" To  hTab1
    '
        Control Add CheckBox, hTab1, %IDC_CP_MAINS,   "Strom", 2, 5, 105, 12
        Row = 20
        Col = 10
        Control Add TextBox, hTab1, %Id_TB_01, "Textbox", Col, Row, 120, 12   
        Row = Row + 20
        Control Add Option, hTab1, %Id_Button_02,   "Id Button 02", Col, Row, 105, 12, stile
        Row = Row + 20
        Control Add Option, hTab1, %Id_Button_02,   "Id Button 03", Col, Row, 105, 12, stile
        Tab Insert Page       hDlg01,  %IDC_CP_OPTIONS, 2, 0, "Sanitär"       To  hTab2
    '    Control Add CheckBox, hTab2, %IDC_CP_MAINS,   "Strom", 2, 5, 105, 12
        Control Add Button, hDlg01, %IDC_BUTTON3, "&Close", 50, 250, 50, 15
        
        Dialog Show Modal hDlg01, Call ShowCPProc To lRslt
        Function = lRslt
    End Function
    '
    ' *******************************************************
    '
    The program hangs in the "Camping Platz Info" dialog every time, stile or no.

    =====================================
    "I choose a block of marble
    and chop off whatever I don't need."
    Francois-Auguste Rodin (1840-1917),
    when asked how he managed
    to make his remarkable statues
    =====================================

    Leave a comment:


  • Rodney Hicks
    replied
    While I agree that having the tab stops and the grouping is good programming practice, not having them should not cause an app to hang. IMO

    Leave a comment:


  • Michael Mattias
    replied
    In post 33 a set of option controls is followed by a tab control, so WS_GROUP is required on the tab control to properly terminate the preceding group of option controls.

    Of course you could change the order of the CONTROL ADD statements but that would affect the tab order, unless you changed it with SetWindowPos () or something. All in all, it's probably just easier to add WS_GROUP to your tab controls. Probably easier would be were WS_GROUP a 'default' style for the CONTROL ADD TAB statement; a "new feature suggestion" is probably in order for DDT users.

    Leave a comment:


  • Rodney Hicks
    replied
    Actually... in your example , the TAB control needs the WS_GROUP style to END the group of option controls, not for any purpose related to the tab control itself.
    And from the SDK it says:
    The style marks the beginning of a group of controls.
    There is no other group of controls in the example in post 24 so this style seems redundant, however....

    Leave a comment:


  • Michael Mattias
    replied
    The CONTROL ADD TAB needs to have the %WS_GROUP, too. As this constant is not mentioned for the Tab control in the PB9 manual, I didn't even thought this could be the cause. Perhaps this should be implemented by PB as default style as it makes no sense to use a TAB control without grouping
    Actually... in your example , the TAB control needs the WS_GROUP style to END the group of option controls, not for any purpose related to the tab control itself.

    WS_GROUP is a style bit used by the "owner window/dialog," not by the control itself.

    But I cannot imagine any circumstances in which it could hurt to add the WS_GROUP style to a tab control.

    MCM

    Leave a comment:


  • Werner Bleckwendt
    replied
    Originally posted by Dave Biggs View Post
    %WS_GROUP is the answer..
    Code:
        CONTROL ADD OPTION,   hDlg, %IDC_NOISE2, "Nachts ruhig", 50, 20, 110, 12, %WS_GROUP
        CONTROL ADD OPTION,   hDlg, %IDC_NOISE3, "Überwiegend ruhig", 50, 40, 110, 12
     
        ' Add a Tab control DDT way...
        CONTROL ADD TAB,      hDlg,  %IDC_CP_OPTIONS, "", 50, 100, 270, 117, %WS_GROUP
    Marks the begining and end (first control after the group that is not a member) of the Option Button group.
    Thanks Dave, this guided me in the right direction. The CONTROL ADD TAB needs to have the %WS_GROUP, too. As this constant is not mentioned for the Tab control in the PB9 manual, I didn't even thought this could be the cause. Perhaps this should be implemented by PB as default style as it makes no sense to use a TAB control without grouping.

    Again thanks to all! What a helpful community!

    rgds
    Werner
    Last edited by Werner Bleckwendt; 30 Jul 2009, 04:34 AM.

    Leave a comment:


  • Dave Biggs
    replied
    %WS_GROUP is the answer..
    Code:
        CONTROL ADD OPTION,   hDlg, %IDC_NOISE2, "Nachts ruhig", 50, 20, 110, 12, %WS_GROUP
        CONTROL ADD OPTION,   hDlg, %IDC_NOISE3, "Überwiegend ruhig", 50, 40, 110, 12
     
        ' Add a Tab control DDT way...
        CONTROL ADD TAB,      hDlg,  %IDC_CP_OPTIONS, "", 50, 100, 270, 117, %WS_GROUP
    Marks the begining and end (first control after the group that is not a member) of the Option Button group.
    Last edited by Dave Biggs; 30 Jul 2009, 01:23 AM.

    Leave a comment:


  • Werner Bleckwendt
    replied
    Theoretically one can use the CONTROL ADD CHECKBOX instead of CONTROL ADD OPTION together with the %WS_GROUP. If you change the code, the program does no longer hang, but the controls seem not be grouped ....

    Leave a comment:


  • Werner Bleckwendt
    replied
    Originally posted by Jules Marchildon View Post
    Ok, I can't believe this!!!!
    so simple...
    overlooked...
    stupid mistake...
    replace brain...

    Oh, don't forget the grouping of controls!!!!
    OR %WS_GROUP OR %WS_TABSTOP

    I am surprised nobody caught this one earlier....
    In my code the first CONTROL ADD OPTION has the %WS_GROUP OR %WS_TABSTOP
    CONTROL ADD OPTION, hDlg, %IDC_NOISE1, "Tag u. Nacht ruhig", 175, 132, _
    110, 12, %WS_CHILD OR %WS_VISIBLE OR %WS_GROUP OR %WS_TABSTOP OR _
    %BS_TEXT OR %BS_AUTORADIOBUTTON OR %BS_LEFT OR %BS_VCENTER, _
    %WS_EX_LEFT OR %WS_EX_LTRREADING
    CONTROL ADD OPTION, hDlg, %IDC_NOISE2, "Nachts ruhig", 175, 144, 110, _
    12
    CONTROL ADD OPTION, hDlg, %IDC_NOISE3, "Überwiegend ruhig", 175, 156, _
    110, 12
    and the snippet you created hangs in both cases, with or without %WS_GROUP

    But the behaviour of the radio buttons is strange: Move through the dialog with the TAB key (%WS_GROUP has been added to your code):
    1. second radio button is active
    2. first tab is selected
    3. checkbox is selcted
    4. close button is selected
    5. first radio button is selected
    6. second radio button is selected


    The standard behaviour (PB8 and PB7) if a radio button has the focus, you move with the cursor keys through the options.

    Leave a comment:


  • Rodney Hicks
    replied
    So Jules, can you make the code in post 24 run properly with the grouping and the tab stopping? Without adding any thing else? I don't mean this to challenge, I am very curious.

    Leave a comment:


  • Jules Marchildon
    replied
    Ok, I can't believe this!!!!
    so simple...
    overlooked...
    stupid mistake...
    replace brain...

    Oh, don't forget the grouping of controls!!!!
    OR %WS_GROUP OR %WS_TABSTOP

    I am surprised nobody caught this one earlier....

    Leave a comment:


  • Jules Marchildon
    replied
    I can duplicate this weird problem using the DDT generated code from my QTAB designer.
    I added a couple of radio controls to the main dialog instead of an additional popup.
    I'm not ready to call it a possible bug just yet...
    This one compiled with PBWIN804,
    does not include new TAB features build into PBWIN901

    Code:
    '******************************************************************************
    ' PROJECT: Quick Tab Visual Designer DDT generated code.
    ' FILE:    Your file name
    ' CREATED: On 07-29-2009 at 22:37:59
    '******************************************************************************
    
    #COMPILE  EXE
    #INCLUDE  "WIN32API.INC"
    #INCLUDE  "COMMCTRL.INC"
    
    '---Main Tab Identifiers
    %IDTAB_MAIN      = 100
    %IDTAB_PAGE_1    = 101
    %IDTAB_PAGE_2    = 102
    %IDC_OK          = 103
    %IDC_CANCEL      = 104
    %IDC_APPLY       = 105
    
    '---Page 1 control identifiers
    %IDC_GROUPBOX_2    = 1000
    %IDC_RADIOBUTTON_1 = 1001
    %IDC_RADIOBUTTON_2 = 1002
    %IDC_RADIOBUTTON_3 = 1003
    %IDC_RADIOBUTTON_4 = 1004
    %IDC_RADIOBUTTON_5 = 1005
    
    '---Page 2 control identifiers
    %IDC_CHECKBOX_1    = 1006
    %IDC_CHECKBOX_2    = 1007
    %IDC_CHECKBOX_3    = 1008
    %IDC_GROUPBOX_1    = 1009
    
    '---Declares
    DECLARE FUNCTION CreateMainDialog(BYVAL hParent AS LONG) AS LONG
    DECLARE FUNCTION CreateMainTabControl(BYVAL hDlg AS LONG) AS LONG
    DECLARE FUNCTION CreateDialogTabPage1(BYVAL hParent AS LONG) AS LONG
    DECLARE FUNCTION CreateDialogTabPage2(BYVAL hParent AS LONG) AS LONG
    DECLARE CALLBACK FUNCTION MainDialogProc()
    DECLARE CALLBACK FUNCTION TabPageDlgProc1()
    DECLARE CALLBACK FUNCTION TabPageDlgProc2()
    DECLARE FUNCTION EnumCharSet(elf AS ENUMLOGFONT,ntm AS NEWTEXTMETRIC,BYVAL FontType AS LONG,CharSet AS LONG) AS LONG
    DECLARE FUNCTION MakeFontEx(BYVAL sFont AS STRING, BYVAL PointSize AS LONG, BYVAL fBold AS LONG, _
        BYVAL fItalic AS LONG, BYVAL fUnderline AS LONG, BYVAL StrikeThru AS LONG) AS LONG
    DECLARE SUB CreateMainDlgButtons(BYVAL hDlg AS LONG)
    DECLARE SUB DeleteControlFont(BYVAL hDlg AS LONG)
    DECLARE SUB SetCtlTooltip(BYVAL hCtl AS LONG,sText AS STRING)
    DECLARE SUB SetTabPageRectDDT(BYVAL hDlg AS LONG,rcRet AS RECT)
    
    '---Globals
    GLOBAL ghTab() AS LONG  'keep handles for each tab page
    
    '------------------------------------------------------------------------------
    '
    '------------------------------------------------------------------------------
    FUNCTION PBMAIN()
    
        LOCAL ticc AS INIT_COMMON_CONTROLSEX
    
        'Load the common controls library...
        ticc.dwSize = SIZEOF(ticc)
        ticc.dwICC = %ICC_WIN95_CLASSES OR %ICC_INTERNET_CLASSES OR %ICC_DATE_CLASSES
        CALL InitCommonControlsEx(ticc)
    
        CALL CreateMainDialog(%HWND_DESKTOP)
    
    END FUNCTION
    
    '------------------------------------------------------------------------------
    '
    '------------------------------------------------------------------------------
    FUNCTION CreateMainDialog(BYVAL hParent AS LONG) AS LONG
    
        LOCAL lRslt AS LONG,hDlg AS LONG,hFont AS LONG
        LOCAL hIcon AS LONG,rc AS RECT
    
        CALL SetRect(rc,50,50,267,233)
    
        DIALOG NEW hParent, "Your Caption",rc.nLeft,rc.nTop,rc.nRight,rc.nBottom, _
            %WS_POPUP OR %WS_BORDER OR %WS_DLGFRAME OR %WS_CAPTION OR _
            %WS_MINIMIZEBOX OR %WS_CLIPSIBLINGS OR %WS_VISIBLE OR _
            %WS_SYSMENU OR %DS_NOFAILCREATE OR %DS_SETFONT OR %DS_3DLOOK, _
            %WS_EX_WINDOWEDGE OR %WS_EX_CONTROLPARENT, TO hDlg
    
        hFont = MakeFontEx("MS Sans Serif",8,400,0,0,0)
        DIALOG SEND hDlg, %WM_SETFONT, hFont, 0
    
        'load a system icon...
        hIcon = LoadIcon(%NULL,BYVAL %IDI_APPLICATION)
        CALL SetClassLong(hDlg,%GCL_HICON,hIcon)
    
        DIALOG SHOW MODAL hDlg, CALL MainDialogProc TO lRslt
    
        DeleteObject hFont
    
        FUNCTION = lRslt
    END FUNCTION
    
    '------------------------------------------------------------------------------
    '
    '------------------------------------------------------------------------------
    CALLBACK FUNCTION MainDialogProc()
    
        LOCAL pNMHDR AS NMHDR PTR, PageNo AS LONG, hFontTab AS LONG
    
        SELECT CASE (CBMSG)
    
            CASE %WM_INITDIALOG
                'add the main tab control and tab pages...
                DIM ghTab(1) AS GLOBAL LONG
                CALL CreateMainTabControl(CBHNDL)
                CALL CreateMainDlgButtons(CBHNDL)
                CALL SetWindowPos(GetDlgItem(CBHNDL,%IDTAB_MAIN),%HWND_BOTTOM, _
                         0,0,0,0,%SWP_NOMOVE OR %SWP_NOSIZE)
    
            CASE %WM_COMMAND
                SELECT CASE LOWRD(CBWPARAM)
                    CASE %IDC_OK
                        IF HIWRD(CBWPARAM) = %BN_CLICKED THEN
                            DIALOG END CBHNDL
                        END IF
                    CASE %IDC_CANCEL,%IDCANCEL
                        IF HIWRD(CBWPARAM) = %BN_CLICKED THEN
                            DIALOG END CBHNDL
                        END IF
                    CASE %IDC_APPLY
                        IF HIWRD(CBHNDL) = %BN_CLICKED THEN
                            '
                        END IF
                   CASE %IDC_RADIOBUTTON_4
                   CASE %IDC_RADIOBUTTON_5
                      
                        
                END SELECT
    
            CASE %WM_NOTIFY
                pNMHDR = CBLPARAM
                IF @pNMHDR.hWndFrom = GetDlgItem(CBHNDL,%IDTAB_MAIN) THEN
                    SELECT CASE @pNMHDR.Code
                        CASE %TCN_SELCHANGING
                            CONTROL SEND CBHNDL,%IDTAB_MAIN,%TCM_GETCURSEL,0,0 TO PageNo
                            DIALOG SHOW STATE ghTab(PageNo),%SW_HIDE
                        CASE %TCN_SELCHANGE
                            CONTROL SEND CBHNDL,%IDTAB_MAIN,%TCM_GETCURSEL,0,0 TO PageNo
                            DIALOG SHOW STATE ghTab(PageNo),%SW_SHOW
                    END SELECT
                END IF
    
            CASE %WM_DESTROY
                'destroy the tab control font...
                CONTROL SEND CBHNDL,%IDTAB_MAIN,%WM_GETFONT,0,0 TO hFontTab
                IF ISTRUE(hFontTab) THEN CALL DeleteObject(hFontTab)
    
        END SELECT
    END FUNCTION
    
    '------------------------------------------------------------------------------
    '
    '------------------------------------------------------------------------------
    FUNCTION CreateDialogTabPage1(BYVAL hParent AS LONG) AS LONG
    
        LOCAL hDlg AS LONG,hFont AS LONG,rc AS RECT,sText AS STRING,lRslt AS LONG
        LOCAL STYLE AS DWORD,StyleEx AS DWORD,szCaption AS ASCIIZ*255
    
        DIALOG NEW hParent,"TabPage1",0,0,0,0,%WS_CHILD OR %DS_CONTROL _
            OR %WS_CLIPSIBLINGS OR %DS_NOFAILCREATE OR %DS_SETFONT,0,TO hDlg
    
        '---
        szCaption = "Radio1"
        CALL SetRect(rc,47,37,133,12)
        STYLE   = %WS_CHILD OR %WS_CLIPSIBLINGS OR %WS_TABSTOP OR _
                  %WS_VISIBLE OR %BS_AUTORADIOBUTTON
        StyleEx = 0
        CONTROL ADD OPTION,hDlg,%IDC_RADIOBUTTON_1,szCaption, _
            rc.nLeft,rc.nTop,rc.nRight,rc.nBottom,STYLE,StyleEx
        '---
        szCaption = "Radio2"
        CALL SetRect(rc,47,55,133,12)
        STYLE   = %WS_CHILD OR %WS_CLIPSIBLINGS OR %WS_TABSTOP OR _
                  %WS_VISIBLE OR %BS_AUTORADIOBUTTON
        StyleEx = 0
        CONTROL ADD OPTION,hDlg,%IDC_RADIOBUTTON_2,szCaption, _
            rc.nLeft,rc.nTop,rc.nRight,rc.nBottom,STYLE,StyleEx
        '---
        szCaption = "Radio3"
        CALL SetRect(rc,47,74,133,12)
        STYLE   = %WS_CHILD OR %WS_CLIPSIBLINGS OR %WS_TABSTOP OR _
                  %WS_VISIBLE OR %BS_AUTORADIOBUTTON
        StyleEx = 0
        CONTROL ADD OPTION,hDlg,%IDC_RADIOBUTTON_3,szCaption, _
            rc.nLeft,rc.nTop,rc.nRight,rc.nBottom,STYLE,StyleEx
        '---
        szCaption = "GroupBox2"
        CALL SetRect(rc,27,25,173,74)
        STYLE   = %WS_CHILD OR %WS_CLIPSIBLINGS OR %WS_VISIBLE OR %BS_GROUPBOX
        StyleEx = 0
        CONTROL ADD FRAME,hDlg,%IDC_GROUPBOX_2,szCaption, _
            rc.nLeft,rc.nTop,rc.nRight,rc.nBottom,STYLE,StyleEx
        
    
        ghTab(0) = hDlg
    
        DIALOG SHOW MODELESS hDlg, CALL TabPageDlgProc1 TO lRslt
        DIALOG SHOW STATE hDlg,%SW_HIDE
    
        FUNCTION = lRslt
    END FUNCTION
    
    '------------------------------------------------------------------------------
    '
    '------------------------------------------------------------------------------
    FUNCTION CreateDialogTabPage2(BYVAL hParent AS LONG) AS LONG
    
        LOCAL hDlg AS LONG,hFont AS LONG,rc AS RECT,sText AS STRING,lRslt AS LONG
        LOCAL STYLE AS DWORD,StyleEx AS DWORD,szCaption AS ASCIIZ*255
    
        DIALOG NEW hParent,"TabPage2",0,0,0,0,%WS_CHILD OR %DS_CONTROL _
            OR %WS_CLIPSIBLINGS OR %DS_NOFAILCREATE OR %DS_SETFONT,0,TO hDlg
    
        '---
        szCaption = "CheckBox1"
        CALL SetRect(rc,53,71,133,12)
        STYLE   = %WS_CHILD OR %WS_CLIPSIBLINGS OR %WS_TABSTOP OR _
                  %WS_VISIBLE OR %BS_AUTOCHECKBOX
        StyleEx = 0
        CONTROL ADD CHECKBOX,hDlg,%IDC_CHECKBOX_1,szCaption, _
            rc.nLeft,rc.nTop,rc.nRight,rc.nBottom,STYLE,StyleEx
        '---
        szCaption = "CheckBox2"
        CALL SetRect(rc,53,89,133,12)
        STYLE   = %WS_CHILD OR %WS_CLIPSIBLINGS OR %WS_TABSTOP OR _
                  %WS_VISIBLE OR %BS_AUTOCHECKBOX
        StyleEx = 0
        CONTROL ADD CHECKBOX,hDlg,%IDC_CHECKBOX_2,szCaption, _
            rc.nLeft,rc.nTop,rc.nRight,rc.nBottom,STYLE,StyleEx
        '---
        szCaption = "CheckBox3"
        CALL SetRect(rc,53,108,133,12)
        STYLE   = %WS_CHILD OR %WS_CLIPSIBLINGS OR %WS_TABSTOP OR _
                  %WS_VISIBLE OR %BS_AUTOCHECKBOX
        StyleEx = 0
        CONTROL ADD CHECKBOX,hDlg,%IDC_CHECKBOX_3,szCaption, _
            rc.nLeft,rc.nTop,rc.nRight,rc.nBottom,STYLE,StyleEx
        '---
        szCaption = "GroupBox1"
        CALL SetRect(rc,27,50,180,100)
        STYLE   = %WS_CHILD OR %WS_CLIPSIBLINGS OR %WS_VISIBLE OR %BS_GROUPBOX
        StyleEx = 0
        CONTROL ADD FRAME,hDlg,%IDC_GROUPBOX_1,szCaption, _
            rc.nLeft,rc.nTop,rc.nRight,rc.nBottom,STYLE,StyleEx
    
        ghTab(1) = hDlg
    
        DIALOG SHOW MODELESS hDlg, CALL TabPageDlgProc2 TO lRslt
        DIALOG SHOW STATE hDlg,%SW_HIDE
    
        FUNCTION = lRslt
    END FUNCTION
    
    '------------------------------------------------------------------------------
    '
    '------------------------------------------------------------------------------
    CALLBACK FUNCTION TabPageDlgProc1()
    
        LOCAL ptnmhdr AS NMHDR PTR
    
        SELECT CASE CBMSG
    
            CASE %WM_COMMAND
                SELECT CASE CBCTL
                    CASE %IDC_RADIOBUTTON_1
                        IF CBCTLMSG = %BN_CLICKED OR CBCTLMSG = 1 THEN
                        END IF
                    CASE %IDC_RADIOBUTTON_2
                        IF CBCTLMSG = %BN_CLICKED OR CBCTLMSG = 1 THEN
                        END IF
                    CASE %IDC_RADIOBUTTON_3
                        IF CBCTLMSG = %BN_CLICKED OR CBCTLMSG = 1 THEN
                        END IF
                END SELECT
    
            CASE %WM_DESTROY
                CALL DeleteControlFont(CBHNDL)
    
        END SELECT
    
    END FUNCTION
    
    '------------------------------------------------------------------------------
    '
    '------------------------------------------------------------------------------
    CALLBACK FUNCTION TabPageDlgProc2()
    
        LOCAL ptnmhdr AS NMHDR PTR
    
        SELECT CASE CBMSG
    
            CASE %WM_COMMAND
                SELECT CASE CBCTL
                    CASE %IDC_CHECKBOX_1
                        IF CBCTLMSG = %BN_CLICKED OR CBCTLMSG = 1 THEN
                        END IF
                    CASE %IDC_CHECKBOX_2
                        IF CBCTLMSG = %BN_CLICKED OR CBCTLMSG = 1 THEN
                        END IF
                    CASE %IDC_CHECKBOX_3
                        IF CBCTLMSG = %BN_CLICKED OR CBCTLMSG = 1 THEN
                        END IF
                END SELECT
    
            CASE %WM_DESTROY
                CALL DeleteControlFont(CBHNDL)
    
        END SELECT
    
    END FUNCTION
    
    '------------------------------------------------------------------------------
    '
    '------------------------------------------------------------------------------
    FUNCTION CreateMainTabControl(BYVAL hDlg AS LONG) AS LONG
    
        LOCAL hFontTab AS LONG,i AS LONG,STYLE AS DWORD,StyleEx AS DWORD
        LOCAL rc AS RECT,rcm AS RECT,ttc_item AS TC_ITEM,szItem AS ASCIIZ*255
    
        'position tab within the main window...
        DIALOG GET CLIENT hDlg TO rcm.nRight,rcm.nBottom
        CALL SetRect(rc,2,2,rcm.nRight-4,rcm.nBottom-24-30)
    
        STYLE = %WS_CHILD OR %WS_VISIBLE OR %WS_TABSTOP OR _
                %TCS_TABS OR %TCS_SINGLELINE OR %TCS_FOCUSONBUTTONDOWN
        StyleEx = 0
        CONTROL ADD "SysTabControl32",hDlg,%IDTAB_MAIN,"", _
            rc.nLeft,rc.nTop,rc.nRight,rc.nBottom,STYLE,StyleEx
    
        hFontTab = MakeFontEx("MS Sans Serif",8,0,0,0,0)
        CONTROL SEND hDlg,%IDTAB_MAIN,%WM_SETFONT,hFontTab,%TRUE
    
        'Insert tabs in the tab control...
        DIM sText(1) AS STRING
        sText(0) = "Tab1"
        sText(1) = "Tab2"
    
        FOR i = 0 TO 1
            szItem              = sText(i)
            ttc_item.mask       = %TCIF_TEXT
            ttc_item.pszText    = VARPTR(szItem)
            ttc_item.cchTextMax = LEN(szItem)
            ttc_item.iImage     = -1
            ttc_item.lParam     = 0
            CONTROL SEND hDlg,%IDTAB_MAIN,%TCM_INSERTITEM,i,VARPTR(ttc_item)
        NEXT
    
        'create the tab pages...
        CALL CreateDialogTabPage1(hDlg)
        CALL CreateDialogTabPage2(hDlg)
    
        'allow the tab pages to fit evenly within the tab control...
        CALL SetTabPageRectDDT(hDlg,BYVAL VARPTR(rc))
        FOR i = 0 TO UBOUND(ghTab)
            DIALOG SET LOC ghTab(i),rc.nLeft,rc.nTop
            DIALOG SET SIZE ghTab(i),rc.nRight,rc.nBottom
        NEXT
    
        '---
        CALL SetRect(rc,47,185,60,18)
        STYLE   = %WS_CHILD OR %WS_CLIPSIBLINGS OR %WS_TABSTOP OR _
                  %WS_VISIBLE OR %BS_AUTORADIOBUTTON
        StyleEx = 0
        CONTROL ADD OPTION,hDlg,%IDC_RADIOBUTTON_4,"Radio4", _
            rc.nLeft,rc.nTop,rc.nRight,rc.nBottom,STYLE,StyleEx
        '---
        CALL SetRect(rc,47,200,60,18)
        STYLE   = %WS_CHILD OR %WS_CLIPSIBLINGS OR %WS_TABSTOP OR _
                  %WS_VISIBLE OR %BS_AUTORADIOBUTTON
        StyleEx = 0
        CONTROL ADD OPTION,hDlg,%IDC_RADIOBUTTON_5,"Radio5", _
            rc.nLeft,rc.nTop,rc.nRight,rc.nBottom,STYLE,StyleEx
            
        
        'only show the first dialog on tab 1...
        DIALOG SHOW STATE ghTab(0),%SW_SHOW
    
        FUNCTION = GetDlgItem(hDlg,%IDTAB_MAIN)
    END FUNCTION
    
    '------------------------------------------------------------------------------
    '  ** Helper routines **
    '------------------------------------------------------------------------------
    SUB CreateMainDlgButtons(BYVAL hDlg AS LONG)
    
        'add buttons to the main dialog...
        LOCAL rc AS RECT, rcm AS RECT
        LOCAL cap AS LONG, bor AS LONG,tm AS LONG,gap AS LONG
    
        DIALOG GET CLIENT hDlg TO rcm.nRight, rcm.nBottom
    
        cap = GetSystemMetrics(%SM_CYCAPTION):DIALOG PIXELS hDlg,cap,cap TO UNITS cap,cap
        bor = GetSystemMetrics(%SM_CXBORDER) :DIALOG PIXELS hDlg,bor,bor TO UNITS bor,bor
        tm  = 6 :DIALOG PIXELS hDlg,tm,tm   TO UNITS tm,tm
        gap = 6 :DIALOG PIXELS hDlg,gap,gap TO UNITS gap,gap
    
        CALL SetRect(rc,rcm.nRight+bor-tm-120-gap*2,rcm.nBottom-cap-6,40,15)
        CONTROL ADD BUTTON,hDlg,%IDC_OK,"&OK",rc.nLeft,rc.nTop+6,rc.nRight,rc.nBottom
        CALL SetRect(rc,rcm.nRight+bor-tm-80-gap,rcm.nBottom-cap-6,40,15)
        CONTROL ADD BUTTON,hDlg,%IDC_CANCEL,"&Cancel",rc.nLeft,rc.nTop+6,rc.nRight,rc.nBottom
        CALL SetRect(rc,rcm.nRight+bor-tm-40,rcm.nBottom-cap-6,40,15)
        CONTROL ADD BUTTON,hDlg,%IDC_APPLY,"&Apply",rc.nLeft,rc.nTop+6,rc.nRight,rc.nBottom
    
    END SUB
    
    '------------------------------------------------------------------------------
    '
    '------------------------------------------------------------------------------
    SUB SetTabPageRectDDT(BYVAL hDlg AS LONG,rcRet AS RECT)
    
        LOCAL tRect AS RECT,twRect AS RECT,pRect AS RECT,hTab AS LONG
        LOCAL b AS LONG,l AS LONG,r AS LONG,t AS LONG
        LOCAL lb AS LONG,tb AS LONG,c AS LONG,f AS LONG,tm AS LONG
    
        hTab = GetDlgItem(hDlg,%IDTAB_MAIN)
    
        CALL GetWindowRect(hTab,twRect)
        CALL GetWindowRect(GetParent(hTab),pRect)
    
        lb = twRect.nLeft-pRect.nLeft
        tb = twRect.nTop-pRect.nTop
        c  = GetSystemMetrics(%SM_CYCAPTION)
        f  = GetSystemMetrics(%SM_CXBORDER)
    
        CONTROL SEND hDlg,%IDTAB_MAIN,%TCM_GETITEMRECT,0,VARPTR(tRect)
    
        tm = 4
        l  = lb-2*f+tm
        t  = tb-c-f+tRect.nBottom+tm
        r  = twRect.nRight-twRect.nLeft-4*f-2*tm
        b  = twRect.nBottom-twRect.nTop-tRect.nBottom-4*f-2*tm
    
        CALL SetRect(rcRet,l,t,r,b)
    
        DIALOG PIXELS GetParent(hTab),rcRet.nLeft,rcRet.nTop TO UNITS rcRet.nLeft,rcRet.nTop
        DIALOG PIXELS GetParent(hTab),rcRet.nRight,rcRet.nBottom TO UNITS rcRet.nRight,rcRet.nBottom
    
    END SUB
    
    '------------------------------------------------------------------------------
    '
    '------------------------------------------------------------------------------
    SUB DeleteControlFont(BYVAL hDlg AS LONG)
    
        LOCAL hCtlChild AS LONG, hFontCtl AS LONG
    
        hCtlChild = GetWindow(hDlg,%GW_CHILD)
        hFontCtl = SendMessage(hCtlChild,%WM_GETFONT,0,0)
        IF ISTRUE(hFontCtl) THEN DeleteObject hFontCtl
        WHILE hCtlChild
            hFontCtl = SendMessage(hCtlChild,%WM_GETFONT,0,0)
            IF ISTRUE(hFontCtl) THEN DeleteObject hFontCtl
            hCtlChild = GetWindow(hCtlChild, %GW_HWNDNEXT)
        WEND
    
    END SUB
    
    '------------------------------------------------------------------------------
    ' Get type of character set - ansi, symbol... a must for some fonts.
    '------------------------------------------------------------------------------
    FUNCTION EnumCharSet(elf AS ENUMLOGFONT,ntm AS NEWTEXTMETRIC,BYVAL FontType AS LONG,CharSet AS LONG) AS LONG
        CharSet = elf.elfLogFont.lfCharSet
    END FUNCTION
    '------------------------------------------------------------------------------
    ' Create a desirable font and return its handle.
    ' Enhanced with proper enumeration of character set via EnumCharSet.
    ' Original code by Dave Navarro, Enhancement by Borje Hagsten.
    '------------------------------------------------------------------------------
    FUNCTION MakeFontEx(BYVAL sFont AS STRING, BYVAL PointSize AS LONG, BYVAL fBold AS LONG, _
                        BYVAL fItalic AS LONG, BYVAL fUnderline AS LONG, BYVAL StrikeThru AS LONG) AS LONG
    
        LOCAL hDC AS LONG, CharSet AS LONG, CyPixels AS LONG
    
        hDC = GetDC(%HWND_DESKTOP)
            CyPixels  = GetDeviceCaps(hDC, %LOGPIXELSY)
            EnumFontFamilies hDC, BYVAL STRPTR(sFont), CODEPTR(EnumCharSet), BYVAL VARPTR(CharSet)
        ReleaseDC %HWND_DESKTOP, hDC
    
        PointSize = 0 - (PointSize * CyPixels) \ 72
    
        FUNCTION = CreateFont(PointSize,0,0,0, fBold, _
                              fItalic,fUnderline,StrikeThru,CharSet, _
                              %OUT_TT_PRECIS,%CLIP_DEFAULT_PRECIS, _
                              %DEFAULT_QUALITY,%FF_DONTCARE, _
                              BYCOPY sFont)
    
    END FUNCTION
    
    '------------------------------------------------------------------------------
    '
    '------------------------------------------------------------------------------
    SUB SetCtlTooltip(BYVAL hCtl AS LONG,sText AS STRING)
    
        STATIC hTooltip AS LONG,hInst AS LONG
        LOCAL ti AS TOOLINFO,szText AS ASCIIZ*255
    
        hInst = GetModuleHandle(BYVAL %NULL)
    
        IF hTooltip  = 0 THEN
            hToolTip = CreateWindowEx(0,"tooltips_class32","",%TTS_ALWAYSTIP, _
                                      0,0,0,0,0,BYVAL %NULL,hInst,BYVAL %NULL)
        END IF
    
        IF hTooltip THEN
            szText      = sText
            ti.cbSize   = LEN(ti)
            ti.uFlags   = %TTF_SUBCLASS OR %TTF_IDISHWND
            ti.hWnd     = GetParent(hCtl)
            ti.uId      = hCtl
            ti.lpszText = VARPTR(szText)
            CALL SendMessage(hToolTip,%TTM_ADDTOOL,0,BYVAL VARPTR(ti))
        END IF
    
    END SUB
    Last edited by Jules Marchildon; 29 Jul 2009, 09:56 PM.

    Leave a comment:


  • Gösta H. Lovgren-2
    replied
    Most of this is way over my head but I do like to play a little. It doesn't matter if an Option is added to the Tab. It seems ANY control added to the Tab causes a hang.
    Code:
        ' Add a Tab control DDT way...
        Control Add Tab,      hDlg,  %IDC_CP_OPTIONS, "Add Tab", 50, 100, 270, 117
        Tab Insert Page       hDlg,  %IDC_CP_OPTIONS, 1, 0, "Infrastruktur" To  hTab1
    '    Control Add CheckBox, hTab1, %IDC_CP_MAINS,   "Strom", 2, 5, 105, 12
    [B] [COLOR=red]Control Add Label,[/COLOR][/B] hTab1, %Id_TB_01, "Textbox", 10, 10, 120, 12 '<< causes hang
        Tab Insert Page       hDlg,  %IDC_CP_OPTIONS, 2, 0, "Sanitär"       To  hTab2
    '    Control Add CheckBox, hTab2, %IDC_CP_MAINS,   "Strom", 2, 5, 105, 12
    I tried a Textbox and it hung too as soon as Option button is clicked on the Tab dialog is licked, not the option on the tab itself.

    Jules, I suggest you submit this to PB Support as a possible bug.

    ===============================
    An error is the more dangerous
    the more truth it contains.
    Henri-Frédéric Amiel
    ===============================
    Last edited by Gösta H. Lovgren-2; 29 Jul 2009, 08:47 PM. Reason: Update

    Leave a comment:


  • Werner Bleckwendt
    replied
    Thanks Jules for all your effort.

    Sometimes I don't see the wood because of too many trees (German saying). I just did not have the idea to create that code snippet.

    Leave a comment:


  • Jules Marchildon
    replied
    Just to switch gears here...

    Getting back to the problem of hanging when you activate the Option buttons and Tab 1 is shown with one Checkbox, click on the Option button, it hangs. If Tab 1 is not visible or if the checkbox is not added, no hanging. Interesting problem, I don't have a solution.

    Here is a snippet to demonstrate the problem. Very minimum code from Werners large source code.

    Code:
    #PBFORMS CREATED V1.51
    '------------------------------------------------------------------------------
    ' The first line in this file is a PB/Forms metastatement.
    ' It should ALWAYS be the first line of the file. Other
    ' PB/Forms metastatements are placed at the beginning and
    ' end of "Named Blocks" of code that should be edited
    ' with PBForms only. Do not manually edit or delete these
    ' metastatements or PB/Forms will not be able to reread
    ' the file correctly.  See the PB/Forms documentation for
    ' more information.
    ' Named blocks begin like this:    #PBFORMS BEGIN ...
    ' Named blocks end like this:      #PBFORMS END ...
    ' Other PB/Forms metastatements such as:
    '     #PBFORMS DECLARATIONS
    ' are used by PB/Forms to insert additional code.
    ' Feel free to make changes anywhere else in the file.
    '------------------------------------------------------------------------------
    
    #COMPILE EXE
    #DIM ALL
    
    '------------------------------------------------------------------------------
    '   ** Includes **
    '------------------------------------------------------------------------------
    #PBFORMS BEGIN INCLUDES
    #IF NOT %DEF(%WINAPI)
        #INCLUDE "WIN32API.INC"
    #ENDIF
    #PBFORMS END INCLUDES
    '------------------------------------------------------------------------------
    
    '------------------------------------------------------------------------------
    '   ** Constants **
    '------------------------------------------------------------------------------
    #PBFORMS BEGIN CONSTANTS
    %IDD_DIALOG1 =  101
    %IDC_BUTTON1 = 1001
    %IDC_BUTTON2 = 1002
    #PBFORMS END CONSTANTS
    '------------------------------------------------------------------------------
    
    %IDC_BUTTON3               = 1003
    %IDC_LOCATION              = 1017  '
    %IDC_CPNAME                = 1029
    %IDC_NOISE2                = 1043  '
    %IDC_NOISE3                = 1044
    %IDC_CP_OPTIONS            = 1061  '
    %IDC_CP_MAINS              = 1062  '
    
    GLOBAL hTab1, hTab2, hTab3, hTab4 AS DWORD
    
    '------------------------------------------------------------------------------
    '   ** Declarations **
    '------------------------------------------------------------------------------
    DECLARE CALLBACK FUNCTION ShowDIALOG1Proc()
    DECLARE FUNCTION ShowDIALOG1(BYVAL hParent AS DWORD) AS LONG
    #PBFORMS DECLARATIONS
    '------------------------------------------------------------------------------
    
    
    '------------------------------------------------------------------------------
    '
    '------------------------------------------------------------------------------
    CALLBACK FUNCTION ShowCPProc()
        LOCAL cpname AS STRING
        LOCAL cTab AS LONG
    
        SELECT CASE AS LONG CBMSG
    
            CASE %WM_INITDIALOG
                
    
            CASE %WM_NCACTIVATE
                STATIC hWndSaveFocus AS DWORD
                IF ISFALSE CBWPARAM THEN
                    hWndSaveFocus = GetFocus()
                ELSEIF hWndSaveFocus THEN
                    SetFocus(hWndSaveFocus)
                    hWndSaveFocus = 0
                END IF
    
            CASE %WM_COMMAND
                SELECT CASE AS LONG CBCTL
                    CASE %IDC_NOISE2
                    CASE %IDC_NOISE3
                    CASE %IDC_BUTTON3
                        IF CBCTLMSG = %BN_CLICKED OR CBCTLMSG = 1 THEN
                            DIALOG END CB.HNDL
                            FUNCTION = 1
                        END IF
                   END SELECT
                   
        END SELECT
    END FUNCTION
    
    '------------------------------------------------------------------------------
    '
    '------------------------------------------------------------------------------
    FUNCTION ShowCP(BYVAL hParent AS DWORD) AS LONG
        LOCAL lRslt  AS LONG
    
        LOCAL hDlg   AS DWORD
        LOCAL hFont1 AS DWORD
    
        DIALOG NEW hParent, "Camping Platz Info", 70, 70, 350, 300, %WS_POPUP OR _
            %WS_BORDER OR %WS_DLGFRAME OR %WS_SYSMENU OR %WS_CLIPSIBLINGS OR _
            %WS_VISIBLE OR %DS_MODALFRAME OR %DS_CENTER OR %DS_3DLOOK OR _
            %DS_NOFAILCREATE OR %DS_SETFONT, %WS_EX_CONTROLPARENT OR %WS_EX_LEFT _
            OR %WS_EX_LTRREADING OR %WS_EX_RIGHTSCROLLBAR, TO hDlg
    
        CONTROL ADD OPTION,   hDlg, %IDC_NOISE2, "Nachts ruhig", 50, 20, 110, 12
        CONTROL ADD OPTION,   hDlg, %IDC_NOISE3, "Überwiegend ruhig", 50, 40, 110, 12
    
        ' Add a Tab control DDT way...
        CONTROL ADD TAB,      hDlg,  %IDC_CP_OPTIONS, "", 50, 100, 270, 117
        TAB INSERT PAGE       hDlg,  %IDC_CP_OPTIONS, 1, 0, "Infrastruktur" TO  hTab1
        CONTROL ADD CHECKBOX, hTab1, %IDC_CP_MAINS,   "Strom", 2, 5, 105, 12
        TAB INSERT PAGE       hDlg,  %IDC_CP_OPTIONS, 2, 0, "Sanitär"       TO  hTab2
    
        CONTROL ADD BUTTON, hDlg, %IDC_BUTTON3, "&Close", 50, 250, 50, 15
        
        DIALOG SHOW MODAL hDlg, CALL ShowCPProc TO lRslt
    
        FUNCTION = lRslt
    END FUNCTION
    
    
                 
    '------------------------------------------------------------------------------
    '   ** Main Application Entry Point **
    '------------------------------------------------------------------------------
    FUNCTION PBMAIN()
        ShowDIALOG1 %HWND_DESKTOP
    END FUNCTION
    '------------------------------------------------------------------------------
    
    '------------------------------------------------------------------------------
    '   ** CallBacks **
    '------------------------------------------------------------------------------
    CALLBACK FUNCTION ShowDIALOG1Proc()
    
        SELECT CASE AS LONG CBMSG
            CASE %WM_INITDIALOG
                ' Initialization handler
    
            CASE %WM_NCACTIVATE
                STATIC hWndSaveFocus AS DWORD
                IF ISFALSE CBWPARAM THEN
                    ' Save control focus
                    hWndSaveFocus = GetFocus()
                ELSEIF hWndSaveFocus THEN
                    ' Restore control focus
                    SetFocus(hWndSaveFocus)
                    hWndSaveFocus = 0
                END IF
    
            CASE %WM_COMMAND
                ' Process control notifications
                SELECT CASE AS LONG CBCTL
                    CASE %IDC_BUTTON1
                        IF CBCTLMSG = %BN_CLICKED OR CBCTLMSG = 1 THEN
                            ShowCP CB.HNDL
                        END IF
                    CASE %IDC_BUTTON2
                        IF CBCTLMSG = %BN_CLICKED OR CBCTLMSG = 1 THEN
                            DIALOG END CB.HNDL
                             FUNCTION = 1
                        END IF
    
                END SELECT
        END SELECT
    END FUNCTION
    '------------------------------------------------------------------------------
    
    '------------------------------------------------------------------------------
    '   ** Dialogs **
    '------------------------------------------------------------------------------
    FUNCTION ShowDIALOG1(BYVAL hParent AS DWORD) AS LONG
        LOCAL lRslt AS LONG
    
    #PBFORMS BEGIN DIALOG %IDD_DIALOG1->->
        LOCAL hDlg  AS DWORD
    
        DIALOG NEW hParent, "Dialog1", 165, 89, 201, 121, %WS_POPUP OR %WS_BORDER _
            OR %WS_DLGFRAME OR %WS_THICKFRAME OR %WS_CAPTION 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_CONTROLPARENT OR %WS_EX_LEFT OR _
            %WS_EX_LTRREADING OR %WS_EX_RIGHTSCROLLBAR, TO hDlg
        CONTROL ADD BUTTON, hDlg, %IDC_BUTTON1, "PopUp Dialog", 70, 45, 50, 15
        CONTROL ADD BUTTON, hDlg, %IDC_BUTTON2, "&Close", 70, 85, 50, 15
    #PBFORMS END DIALOG
    
        DIALOG SHOW MODAL hDlg, CALL ShowDIALOG1Proc TO lRslt
    
    #PBFORMS BEGIN CLEANUP %IDD_DIALOG1
    #PBFORMS END CLEANUP
    
        FUNCTION = lRslt
    END FUNCTION
    '------------------------------------------------------------------------------

    Leave a comment:


  • Werner Bleckwendt
    replied


    @Michael

    Sorry, but I'm unable to follow. With the changed order of the control add statements the tab function works as expected and also all other controls of that dialog except the control add option. If one clicks such an option (radio button) of the same dialog the program hangs. The option control sends WM_COMMAND messages and I don't see why this could conflict with the WM_NOTIFY messages of the tab control no matter if I check the messages in the callback or not.

    Leave a comment:


  • Michael Mattias
    replied
    The important thing to take from this experience is...

    Notification messages are just that: NOTIFICATIONS. Something HAS ALREADY HAPPENED.

    The related 'opportunity' notification is TCN_SELCHANGING:
    Notifies a tab control's parent window that the currently selected tab is about to change. This message is sent in the form of a WM_NOTIFY message.
    This means the user HAS ALREADY TAKEN AN ACTION which will result in a selection change. Your choices at this point?
    Return TRUE to prevent the selection from changing, or FALSE to allow the selection to change.
    MCM

    Leave a comment:

Working...
X
😀
🥰
🤢
😎
😡
👍
👎