Announcement

Collapse
No announcement yet.

CONTROL ADD LABEL....CALL bafflement

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

  • CONTROL ADD LABEL....CALL bafflement

    The help for CONTROL ADD LABEL states that you can catch the STN_DBLCLK, BN_CLICK, BN_DISABLE and STN_ENABLE messages in a callback. I can only get the BN_CLICKED one, what am I doing wrong?

    If you save the program as xxx.bas, or change $PROGNAME, it helps.

    Code:
    #PBFORMS CREATED V1.51
    #COMPILE EXE
    #DIM ALL
    
    #PBFORMS BEGIN INCLUDES
    #IF NOT %DEF(%WINAPI)
        #INCLUDE "WIN32API.INC"
    #ENDIF
    #INCLUDE "PBForms.INC"
    #PBFORMS END INCLUDES
    
    #PBFORMS BEGIN CONSTANTS
    %IDD_DIALOG1  =  101
    %IDC_LABEL1   = 1001
    %IDC_BUTTON1  = 1003
    %IDC_LABEL2   = 1004
    %IDC_TEXTBOX1 = 1006
    %IDC_TEXTBOX2 = 1007
    %IDC_TEXTBOX3 = 1008
    %IDC_LABEL3   = 1009
    #PBFORMS END CONSTANTS
    $PROGNAME = "xxx.bas"
    
    DECLARE CALLBACK FUNCTION ShowDIALOG1Proc()
    DECLARE FUNCTION ShowDIALOG1(BYVAL hParent AS DWORD) AS LONG
    #PBFORMS DECLARATIONS
    
    'GLOBAL goldLabelProc AS DWORD
    
    '----------------------------------------------------------------------------------
    
    FUNCTION PBMAIN()
        ShowDIALOG1 %HWND_DESKTOP
    END FUNCTION
    '----------------------------------------------------------------------------------
    
    CALLBACK FUNCTION ShowDIALOG1Proc()
        LOCAL s, sline AS STRING
        STATIC stitle AS STRING
    
        SELECT CASE AS LONG CBMSG
            CASE %WM_INITDIALOG
                OPEN $PROGNAME FOR INPUT AS #1
                LINE INPUT #1, sline
                WHILE NOT EOF(1)
                    s = s + $CRLF + sline
                    LINE INPUT #1, sline
                WEND
                CLOSE 1
                CONTROL SET TEXT CBHNDL, %IDC_TEXTBOX3, s
                DIALOG GET TEXT CBHNDL TO stitle
    '            gOldLabelProc = SetWindowLong(CBHNDL, %GWL_WNDPROC, CODEPTR(LabelProc))
                CONTROL SET TEXT CBHNDL, %IDC_TEXTBOX1, _
                        "A label control will only send messages to a callback if the %SS_NOTIFY style is used. The following "_
                         +$CRLF + "notifications are sent to the Callback Function" _
                         +$CRLF + "  %BN_CLICKED  Sent when the user clicks a mouse button, or activates the button with the" _
                         +$CRLF + "               hot-key (unless the button has been disabled)."  _
                         +$CRLF + "  %STN_DBLCLK  Sent when the user double-clicks on a label control (unless the control has" _
                         +$CRLF + "               been disabled)." _
                         +$CRLF + "  %BN_DISABLE  Sent when a button is disabled." _
                         +$CRLF + "  %STN_ENABLE  Sent when a label control has been [email protected]
                CONTROL SET TEXT CBHNDL, %IDC_TEXTBOX2, _
                         "The PBWin 8.04 help on CONTROL ADD LABEL contains the " _
                         +$CRLF + "information in the text box to the left which suggests" _
                         +$CRLF + "that by adding the %SS_NOTIFY style to the control, the" _
                         +$CRLF + "messages for single-click, double-click, enable and" _
                         +$CRLF + "disable can be caught by the callback procedure. It does" _
                         +$CRLF + "not say exactly how they can be caught, but in the absence" _
                         +$CRLF + "of further information it is tempting to assume that the" _
                         +$CRLF + "same method can be used for each of them. However, so far" _
                         +$CRLF + "I have only suceeded in catching the %BN_CLICKED message." _
                         +$CRLF + "" _
                         +$CRLF + "The program temporarily relaces the dialog title with the" _
                         +$CRLF + "identifier of the message which it has detected." _
                         +$CRLF + "You can try it by clicking on 'LABEL1', above, when it is" _
                         +$CRLF + "enabled. Try double-clicking too, nothing happens, and" _
                         +$CRLF + "when the label is alternately enabled/disabled by the" _
                         +$CRLF + "'press me' button, again nothing happens." _
                         +$CRLF + "The source code is in the textbox to the right." _
                         +$CRLF + "" _
                         +$CRLF + "Am I doing something wrong, is the" _
                         +$CRLF + "documentation wrong, or is the compiler wrong?" _
                         +$CRLF + ""
            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_BUTTON1
                    IF CBCTLMSG = %BN_CLICKED THEN
                        IF IsWindowEnabled(GetDlgItem(CBHNDL, %IDC_LABEL1)) THEN
                            CONTROL DISABLE CBHNDL, %Idc_LABEL1
                            DIALOG SET TEXT CBHNDL, stitle
                            CONTROL SET TEXT CBHNDL, %IDC_BUTTON1, "Press me to enable LABEL1"
                        ELSE
                            CONTROL ENABLE CBHNDL, %Idc_LABEL1
                            DIALOG SET TEXT CBHNDL, stitle
                            CONTROL SET TEXT CBHNDL, %IDC_BUTTON1, "Press me to disable LABEL1"
                        END IF
                    END IF
                END SELECT
    
            CASE %WM_DESTROY
    '            SetWindowLong CBHNDL, %GWL_WNDPROC, gOldLabelProc
    
    
        END SELECT
    
    END FUNCTION
    '-----------------------------------------------------------
    
    FUNCTION LabelProc(BYVAL hWnd AS DWORD, BYVAL wMsg AS LONG, _
        BYVAL wParam AS LONG, BYVAL lParam AS LONG) AS LONG
         SELECT CASE AS LONG wMsg
    
         LOCAL lcbctlmsg AS LONG
    
             CASE %wm_command
                 IF wparam = %IDC_label1 THEN
                     DIALOG SET TEXT hwnd, STR$(LO(WORD,lparam)) + ":" + STR$(HI(WORD,lparam))
                     lcbctlmsg = HI(WORD, wParam)
                     SELECT CASE lcbctlmsg
                         CASE %BN_CLICKED
                             DIALOG SET TEXT hWnd, "BN_CLICKED"
                             SLEEP 500
    
                         CASE %STN_DBLCLK
                             DIALOG SET TEXT hWnd, "STN_DBLCLK"
                             SLEEP 500
    
                         CASE %BN_DISABLE
                             SLEEP 500
                             DIALOG SET TEXT hWnd, "BN_ENABLE"
    
                         CASE %STN_ENABLE
                             DIALOG SET TEXT hWnd, "STN_ENABLE"
                             SLEEP 500
                     END SELECT
                 END IF
         END SELECT
        ' Pass the message on to the original window procedure... the DDT engine!
    '    FUNCTION = CallWindowProc(gOldLabelProc, hWnd, wMsg, wParam, lParam)
    
    END FUNCTION
    
    FUNCTION ShowDIALOG1(BYVAL hParent AS DWORD) AS LONG
        LOCAL lRslt AS LONG
    
    #PBFORMS BEGIN DIALOG %IDD_DIALOG1->->
        LOCAL hDlg   AS DWORD
        LOCAL hFont1 AS DWORD
        LOCAL hFont2 AS DWORD
    
        DIALOG NEW hParent, "PBFORMS QUESTION RE. CONTROL ADD LABEL", 7, 47, 536, 370, %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 LABEL,   hDlg, %IDC_LABEL1, "Label1", 95, 5, 85, 20, %WS_CHILD OR %WS_VISIBLE OR %SS_LEFT OR %SS_NOTIFY OR _
            %SS_SUNKEN OR %SS_NOTIFY, %WS_EX_LEFT OR %WS_EX_LTRREADING CALL labelproc
        CONTROL ADD BUTTON,  hDlg, %IDC_BUTTON1, "Press me to disable LABEL1", 55, 30, 160, 15
        CONTROL ADD LABEL,   hDlg, %IDC_LABEL2, "This is what the PBWin8.04 help says:", 260, 5, 135, 15
        CONTROL ADD TEXTBOX, hDlg, %IDC_TEXTBOX1, "", 260, 20, 265, 95, %WS_CHILD OR %WS_VISIBLE OR %WS_TABSTOP OR %ES_LEFT OR _
            %ES_MULTILINE OR %ES_READONLY OR %ES_WANTRETURN, %WS_EX_CLIENTEDGE OR %WS_EX_LEFT OR %WS_EX_LTRREADING OR _
            %WS_EX_RIGHTSCROLLBAR
        CONTROL ADD TEXTBOX, hDlg, %IDC_TEXTBOX2, "TextBox1", 5, 50, 240, 120, %WS_CHILD OR %WS_VISIBLE OR %WS_TABSTOP OR %WS_HSCROLL _
            OR %WS_VSCROLL OR %ES_LEFT OR %ES_MULTILINE OR %ES_AUTOHSCROLL OR %ES_AUTOVSCROLL, %WS_EX_CLIENTEDGE OR %WS_EX_LEFT OR _
            %WS_EX_LTRREADING OR %WS_EX_RIGHTSCROLLBAR
        CONTROL ADD TEXTBOX, hDlg, %IDC_TEXTBOX3, "TextBox3", 5, 175, 525, 180, %WS_CHILD OR %WS_VISIBLE OR %WS_TABSTOP OR _
            %WS_HSCROLL OR %WS_VSCROLL OR %ES_LEFT OR %ES_MULTILINE OR %ES_AUTOHSCROLL OR %ES_AUTOVSCROLL, %WS_EX_CLIENTEDGE OR _
            %WS_EX_LEFT OR %WS_EX_LTRREADING OR %WS_EX_RIGHTSCROLLBAR
        CONTROL ADD LABEL,   hDlg, %IDC_LABEL3, "This is the program code", 390, 160, 135, 15
    
        hFont1 = PBFormsMakeFont("MS Sans Serif", 10, 400, %FALSE, %TRUE, %FALSE, %ANSI_CHARSET)
        hFont2 = PBFormsMakeFont("r_ansi", 8, 400, %FALSE, %FALSE, %FALSE, %ANSI_CHARSET)
    
        CONTROL SEND hDlg, %IDC_LABEL1, %WM_SETFONT, hFont1, 0
        CONTROL SEND hDlg, %IDC_TEXTBOX3, %WM_SETFONT, hFont2, 0
        CONTROL SEND hDlg, %IDC_LABEL3, %WM_SETFONT, hFont2, 0
    #PBFORMS END DIALOG
    
        DIALOG SHOW MODAL hDlg, CALL ShowDIALOG1Proc TO lRslt
    
    #PBFORMS BEGIN CLEANUP %IDD_DIALOG1
        DeleteObject hFont1
        DeleteObject hFont2
    #PBFORMS END CLEANUP
    
        FUNCTION = lRslt
    END FUNCTION

  • #2
    According to the Win32 Programmer's Reference, SS_NOTIFY style notifies the parent window of the control. I've modified your code to capture the events in the ShowDialogProc1. Search for '###

    I never used callback on a CONTROL ADD statement. I've always used the parent dialog.

    Code:
    #PBFORMS CREATED V1.51
    #COMPILE EXE
    #DIM ALL
    
    #PBFORMS BEGIN INCLUDES
    #IF NOT %DEF(%WINAPI)
        #INCLUDE "WIN32API.INC"
    #ENDIF
    #INCLUDE "PBForms.INC"
    #PBFORMS END INCLUDES
    
    #PBFORMS BEGIN CONSTANTS
    %IDD_DIALOG1  =  101
    %IDC_LABEL1   = 1001
    %IDC_BUTTON1  = 1003
    %IDC_LABEL2   = 1004
    %IDC_TEXTBOX1 = 1006
    %IDC_TEXTBOX2 = 1007
    %IDC_TEXTBOX3 = 1008
    %IDC_LABEL3   = 1009
    #PBFORMS END CONSTANTS
    $PROGNAME = "xxx.bas"
    
    DECLARE CALLBACK FUNCTION ShowDIALOG1Proc()
    DECLARE FUNCTION ShowDIALOG1(BYVAL hParent AS DWORD) AS LONG
    #PBFORMS DECLARATIONS
    
    'GLOBAL goldLabelProc AS DWORD
    
    '----------------------------------------------------------------------------------
    
    FUNCTION PBMAIN()
        ShowDIALOG1 %HWND_DESKTOP
    END FUNCTION
    '----------------------------------------------------------------------------------
    
    CALLBACK FUNCTION ShowDIALOG1Proc()
        LOCAL s, sline AS STRING
        STATIC stitle AS STRING
    
        SELECT CASE AS LONG CBMSG
            CASE %WM_INITDIALOG
                OPEN $PROGNAME FOR INPUT AS #1
                LINE INPUT #1, sline
                WHILE NOT EOF(1)
                    s = s + $CRLF + sline
                    LINE INPUT #1, sline
                WEND
                CLOSE 1
                CONTROL SET TEXT CBHNDL, %IDC_TEXTBOX3, s
                DIALOG GET TEXT CBHNDL TO stitle
    '            gOldLabelProc = SetWindowLong(CBHNDL, %GWL_WNDPROC, CODEPTR(LabelProc))
                CONTROL SET TEXT CBHNDL, %IDC_TEXTBOX1, _
                        "A label control will only send messages to a callback if the %SS_NOTIFY style is used. The following "_
                         +$CRLF + "notifications are sent to the Callback Function" _
                         +$CRLF + "  %BN_CLICKED  Sent when the user clicks a mouse button, or activates the button with the" _
                         +$CRLF + "               hot-key (unless the button has been disabled)."  _
                         +$CRLF + "  %STN_DBLCLK  Sent when the user double-clicks on a label control (unless the control has" _
                         +$CRLF + "               been disabled)." _
                         +$CRLF + "  %BN_DISABLE  Sent when a button is disabled." _
                         +$CRLF + "  %STN_ENABLE  Sent when a label control has been [email protected]
                CONTROL SET TEXT CBHNDL, %IDC_TEXTBOX2, _
                         "The PBWin 8.04 help on CONTROL ADD LABEL contains the " _
                         +$CRLF + "information in the text box to the left which suggests" _
                         +$CRLF + "that by adding the %SS_NOTIFY style to the control, the" _
                         +$CRLF + "messages for single-click, double-click, enable and" _
                         +$CRLF + "disable can be caught by the callback procedure. It does" _
                         +$CRLF + "not say exactly how they can be caught, but in the absence" _
                         +$CRLF + "of further information it is tempting to assume that the" _
                         +$CRLF + "same method can be used for each of them. However, so far" _
                         +$CRLF + "I have only suceeded in catching the %BN_CLICKED message." _
                         +$CRLF + "" _
                         +$CRLF + "The program temporarily relaces the dialog title with the" _
                         +$CRLF + "identifier of the message which it has detected." _
                         +$CRLF + "You can try it by clicking on 'LABEL1', above, when it is" _
                         +$CRLF + "enabled. Try double-clicking too, nothing happens, and" _
                         +$CRLF + "when the label is alternately enabled/disabled by the" _
                         +$CRLF + "'press me' button, again nothing happens." _
                         +$CRLF + "The source code is in the textbox to the right." _
                         +$CRLF + "" _
                         +$CRLF + "Am I doing something wrong, is the" _
                         +$CRLF + "documentation wrong, or is the compiler wrong?" _
                         +$CRLF + ""
            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_BUTTON1
                    IF CBCTLMSG = %BN_CLICKED THEN
                        IF IsWindowEnabled(GetDlgItem(CBHNDL, %IDC_LABEL1)) THEN
                            CONTROL DISABLE CBHNDL, %Idc_LABEL1
                            DIALOG SET TEXT CBHNDL, stitle
                            CONTROL SET TEXT CBHNDL, %IDC_BUTTON1, "Press me to enable LABEL1"
                        ELSE
                            CONTROL ENABLE CBHNDL, %Idc_LABEL1
                            DIALOG SET TEXT CBHNDL, stitle
                            CONTROL SET TEXT CBHNDL, %IDC_BUTTON1, "Press me to disable LABEL1"
                        END IF
                    END IF
    
             '######################### ADDED
             CASE %IDC_LABEL1
                    SELECT CASE CBCTLMSG
                    CASE %STN_DBLCLK
                         DIALOG SET TEXT CBHNDL, "STN_DBLCLK"
                         SLEEP 500
                    CASE %STN_ENABLE
                         DIALOG SET TEXT CBHNDL, "STN_ENABLE"
                         SLEEP 500
                    CASE %STN_DISABLE ' was %BN_DISABLED
                         ' ### swapped order of next to lines
                          DIALOG SET TEXT CBHNDL, "STN_DISABLE" ' was "BN_ENABLE"
                          SLEEP 500
                    END SELECT
            '################## END ADDED
            CASE %WM_DESTROY
    '            SetWindowLong CBHNDL, %GWL_WNDPROC, gOldLabelProc
    
            END SELECT
        END SELECT
    
    END FUNCTION
    '-----------------------------------------------------------
    
    FUNCTION LabelProc(BYVAL hWnd AS DWORD, BYVAL wMsg AS LONG, _
        BYVAL wParam AS LONG, BYVAL lParam AS LONG) AS LONG
         SELECT CASE AS LONG wMsg
    
         LOCAL lcbctlmsg AS LONG
    
             CASE %wm_command
                 IF wparam = %IDC_label1 THEN
                     DIALOG SET TEXT hwnd, STR$(LO(WORD,lparam)) + ":" + STR$(HI(WORD,lparam))
                     lcbctlmsg = HI(WORD, wParam)
                     SELECT CASE lcbctlmsg
                         CASE %BN_CLICKED
                             DIALOG SET TEXT hWnd, "BN_CLICKED"
                             SLEEP 500
    
                         CASE %STN_DBLCLK
                             DIALOG SET TEXT hWnd, "STN_DBLCLK"
                             SLEEP 500
    
                         CASE %BN_DISABLE
                             SLEEP 500
                             DIALOG SET TEXT hWnd, "BN_ENABLE"
    
                         CASE %STN_ENABLE
                             DIALOG SET TEXT hWnd, "STN_ENABLE"
                             SLEEP 500
                     END SELECT
                 END IF
         END SELECT
        ' Pass the message on to the original window procedure... the DDT engine!
    '    FUNCTION = CallWindowProc(gOldLabelProc, hWnd, wMsg, wParam, lParam)
    
    END FUNCTION
    
    FUNCTION ShowDIALOG1(BYVAL hParent AS DWORD) AS LONG
        LOCAL lRslt AS LONG
    
    #PBFORMS BEGIN DIALOG %IDD_DIALOG1->->
        LOCAL hDlg   AS DWORD
        LOCAL hFont1 AS DWORD
        LOCAL hFont2 AS DWORD
    
        DIALOG NEW hParent, "PBFORMS QUESTION RE. CONTROL ADD LABEL", 7, 47, 536, 370, %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 LABEL,   hDlg, %IDC_LABEL1, "Label1", 95, 5, 85, 20, %WS_CHILD OR %WS_VISIBLE OR %SS_LEFT OR %SS_NOTIFY OR _
            %SS_SUNKEN OR %SS_NOTIFY, %WS_EX_LEFT OR %WS_EX_LTRREADING CALL labelproc
        CONTROL ADD BUTTON,  hDlg, %IDC_BUTTON1, "Press me to disable LABEL1", 55, 30, 160, 15
        CONTROL ADD LABEL,   hDlg, %IDC_LABEL2, "This is what the PBWin8.04 help says:", 260, 5, 135, 15
        CONTROL ADD TEXTBOX, hDlg, %IDC_TEXTBOX1, "", 260, 20, 265, 95, %WS_CHILD OR %WS_VISIBLE OR %WS_TABSTOP OR %ES_LEFT OR _
            %ES_MULTILINE OR %ES_READONLY OR %ES_WANTRETURN, %WS_EX_CLIENTEDGE OR %WS_EX_LEFT OR %WS_EX_LTRREADING OR _
            %WS_EX_RIGHTSCROLLBAR
        CONTROL ADD TEXTBOX, hDlg, %IDC_TEXTBOX2, "TextBox1", 5, 50, 240, 120, %WS_CHILD OR %WS_VISIBLE OR %WS_TABSTOP OR %WS_HSCROLL _
            OR %WS_VSCROLL OR %ES_LEFT OR %ES_MULTILINE OR %ES_AUTOHSCROLL OR %ES_AUTOVSCROLL, %WS_EX_CLIENTEDGE OR %WS_EX_LEFT OR _
            %WS_EX_LTRREADING OR %WS_EX_RIGHTSCROLLBAR
        CONTROL ADD TEXTBOX, hDlg, %IDC_TEXTBOX3, "TextBox3", 5, 175, 525, 180, %WS_CHILD OR %WS_VISIBLE OR %WS_TABSTOP OR _
            %WS_HSCROLL OR %WS_VSCROLL OR %ES_LEFT OR %ES_MULTILINE OR %ES_AUTOHSCROLL OR %ES_AUTOVSCROLL, %WS_EX_CLIENTEDGE OR _
            %WS_EX_LEFT OR %WS_EX_LTRREADING OR %WS_EX_RIGHTSCROLLBAR
        CONTROL ADD LABEL,   hDlg, %IDC_LABEL3, "This is the program code", 390, 160, 135, 15
    
        hFont1 = PBFormsMakeFont("MS Sans Serif", 10, 400, %FALSE, %TRUE, %FALSE, %ANSI_CHARSET)
        hFont2 = PBFormsMakeFont("r_ansi", 8, 400, %FALSE, %FALSE, %FALSE, %ANSI_CHARSET)
    
        CONTROL SEND hDlg, %IDC_LABEL1, %WM_SETFONT, hFont1, 0
        CONTROL SEND hDlg, %IDC_TEXTBOX3, %WM_SETFONT, hFont2, 0
        CONTROL SEND hDlg, %IDC_LABEL3, %WM_SETFONT, hFont2, 0
    #PBFORMS END DIALOG
    
        DIALOG SHOW MODAL hDlg, CALL ShowDIALOG1Proc TO lRslt
    
    #PBFORMS BEGIN CLEANUP %IDD_DIALOG1
        DeleteObject hFont1
        DeleteObject hFont2
    #PBFORMS END CLEANUP
    
        FUNCTION = lRslt
    END FUNCTION

    Comment


    • #3
      The control ID is in the loword of the wParam. Change
      Code:
      IF wparam = %IDC_LABEL1 THEN
      To
      Code:
      IF LO(WORD, wparam) = %IDC_LABEL1 THEN
      Also, don't mix button notifications(BN_XXX) and static notifications(STN_XXX).
      They may have the same numeric values, but it is a bad habit that makes the code confusing.
      Code:
      FUNCTION LabelProc(BYVAL hWnd AS DWORD, BYVAL wMsg AS LONG, _
          BYVAL wParam AS LONG, BYVAL lParam AS LONG) AS LONG
           SELECT CASE AS LONG wMsg
      
           LOCAL lcbctlmsg AS LONG
      
               CASE %WM_COMMAND
                   IF LO(WORD, wparam) = %IDC_LABEL1 THEN
                       DIALOG SET TEXT hwnd, STR$(LO(WORD,lparam)) + ":" + STR$(HI(WORD,lparam))
                       lcbctlmsg = HI(WORD, wParam)
                       SELECT CASE lcbctlmsg
                           CASE %STN_CLICKED
                               DIALOG SET TEXT hWnd, "STN_CLICKED"
                               SLEEP 500
      
                           CASE %STN_DBLCLK
                               DIALOG SET TEXT hWnd, "STN_DBLCLK"
                               SLEEP 500
      
                           CASE %STN_DISABLE
                               SLEEP 500
                               DIALOG SET TEXT hWnd, "STN_DISABLE"
      
                           CASE %STN_ENABLE
                               DIALOG SET TEXT hWnd, "STN_ENABLE"
                               SLEEP 500
                       END SELECT
                   END IF
           END SELECT
      
      END FUNCTION
      Last edited by Dominic Mitchell; 1 Jan 2008, 08:53 PM.
      Dominic Mitchell
      Phoenix Visual Designer
      http://www.phnxthunder.com

      Comment


      • #4
        Originally posted by Brian Chirgwin View Post
        ... SS_NOTIFY style notifies the parent window of the control.
        Thanks Brian, that's the way I would have coded it too, but I decided to follow the Help for once!

        Comment


        • #5
          Originally posted by Dominic Mitchell View Post
          The control ID is in the loword of the wParam.
          Thanks Dominic, that fixed it!

          Originally posted by Dominic Mitchell View Post
          Also, don't mix button notifications(BN_XXX) and static notifications(STN_XXX).
          Wouldn't dream of doing such a thing personally, just following the Help slavishly to try out the CALL option to DIALOG NEW.

          Comment

          Working...
          X