Announcement

Collapse
No announcement yet.

Another PB9 vs PB8 issue

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

  • Steve Rossell
    replied
    You do not send a BN_CLICKED message you send a BM_CLICK to simulate a button click and it should be sent to the control and not the dialog box. Since the button is disabled the message will be queued. I recommend that you simply put the BEEP statement in your CheckBox handler.

    Leave a comment:


  • Kev Peel
    replied
    Only PB can answer that definitively but it might be more strict checking all the parameters

    Leave a comment:


  • Bill Eppler
    replied
    Gary,

    You are soooo right.
    Why, indeed, does the original code work in PB8?

    Thanks
    Last edited by Bill Eppler; 18 Mar 2009, 08:13 AM.

    Leave a comment:


  • Gary Beene
    replied
    I don't have PB8, but in PB9 the Dialog Send requires different argument values than what you wrote. I'd guess PB8/9 are the same in requiring h,msg,wparam,lparam.

    This line from your post has values, but they aren't the values should be in wParam and lParam for %WM_COMMAND.

    This line isn't right:
    Code:
    ' Dialog Send CbHndl, %WM_Command, %IDC_TST, %BN_Clicked
    In particular, the control id and control msg are supposed to the lo/hi words of wparam. lparam is supposed to be the hWnd of the control.

    I rewrote it, and this beeps as intended:

    Code:
    Local hTst As Dword, wPar As Dword
    wPar = Mak(Dword, %IDC_TST, %BN_Clicked)
    Control Handle Cb.Hndl, %IDC_TST To hTst
    Dialog Send CbHndl, %WM_Command, wPar, hTst
    I don't have PB8 and don't know why your code would have worked in it.
    Last edited by Gary Beene; 17 Mar 2009, 10:58 PM.

    Leave a comment:


  • Gary Beene
    replied
    No beep when clicking on the checkbox. I'll take a closer look.

    Leave a comment:


  • Bill Eppler
    replied
    Gary,

    Thanks for trying it.

    It's supposed to beep when you press the TEST button.
    It's also supposed to do the same thing when you check the DISABLE & SEND box.

    Does it w/PB9? It does w/PB8.

    Bill

    Leave a comment:


  • Gary Beene
    replied
    Hi Bill,

    I ran your code on my XP machine PBWin9.01. Mine beeps when I press the button.

    Can I assume you've put something in front of the beep to test/confirm that the line of code "BEEP" is being executed?
    Last edited by Gary Beene; 17 Mar 2009, 10:00 PM.

    Leave a comment:


  • Bill Eppler
    started a topic Another PB9 vs PB8 issue

    Another PB9 vs PB8 issue

    The code below produced a beep when the TEST button is pressed.
    It was my intention, that setting the DISABLE & SEND checkbox should cause the same results by sending an appropriate command to the dialog.

    In PB8 it does; PB9 nada!

    This example is only slightly unusual in that the TEST button has its own callback.

    Is this a PB9 thing or a Me thing?

    Code:
    #COMPILE EXE
    #DIM ALL
    
    #INCLUDE "WIN32API.INC"
    
    %IDD_DIALOG1 =  101
    %IDC_CHK     = 1000
    %IDC_TST     = 1010
    
    DECLARE CALLBACK FUNCTION ShowMAINProc()
    DECLARE CALLBACK FUNCTION TESTProc()
    DECLARE FUNCTION ShowMAIN(BYVAL hParent AS DWORD) AS LONG
    
    FUNCTION PBMAIN()
        ShowMAIN %HWND_DESKTOP
    END FUNCTION
    
    '------------------------------------------------------------------------------
    '   ** Callbacks **
    '------------------------------------------------------------------------------
    CALLBACK FUNCTION ShowMAINProc()
        LOCAL i AS LONG
    
        SELECT CASE AS LONG CBMSG
            CASE %WM_COMMAND
                ' Process control notifications
                SELECT CASE AS LONG CBCTL
                    CASE %IDC_CHK
                        IF CBCTLMSG = %BN_CLICKED OR CBCTLMSG = 1 THEN
                            CONTROL GET CHECK CBHNDL, CBCTL TO i
                            IF i THEN
                                CONTROL DISABLE CBHNDL, %IDC_TST
                                SLEEP 10
                                DIALOG SEND CBHNDL, %WM_COMMAND, %IDC_TST, %BN_CLICKED  'cause it disabled
                            ELSE
                                CONTROL ENABLE CBHNDL, %IDC_TST
                            END IF
                        END IF
                    'CASE %IDC_TST
                    '    IF CBCTLMSG = %BN_CLICKED OR CBCTLMSG = 1 THEN
                    '        MSGBOX "%IDC_TST=" + FORMAT$(%IDC_TST), %MB_TASKMODAL
                    '    END IF
                END SELECT
        END SELECT
    END FUNCTION
    '------------------------------------------------------------------------------
    
    '------------------------------------------------------------------------------
    CALLBACK FUNCTION TESTProc()
        BEEP
        FUNCTION = %TRUE
    END FUNCTION
    '------------------------------------------------------------------------------
    
    '------------------------------------------------------------------------------
    '   ** Dialogs **
    '------------------------------------------------------------------------------
    FUNCTION ShowMAIN(BYVAL hParent AS DWORD) AS LONG
        LOCAL lRslt AS LONG
    
        LOCAL hDlg  AS DWORD
    
        DIALOG NEW hParent, "DIALOG SEND...%BN_CLICKED", 350, 154, 171, 31, _
            %WS_POPUP OR %WS_BORDER OR %WS_DLGFRAME OR %WS_SYSMENU 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 CHECKBOX, hDlg, %IDC_CHK, "DISABLE && SEND", 5, 5, 95, 20, _
            %WS_CHILD OR %WS_VISIBLE OR %WS_TABSTOP OR %BS_TEXT OR _
            %BS_AUTOCHECKBOX OR %BS_NOTIFY OR %BS_LEFT OR %BS_VCENTER, _
            %WS_EX_LEFT OR %WS_EX_LTRREADING
        CONTROL ADD BUTTON, hDlg, %IDC_TST, "TEST", 105, 5, 60, 20, %WS_GROUP OR _
         %WS_TABSTOP OR %BS_DEFPUSHBUTTON CALL TESTproc
    
        DIALOG SHOW MODAL hDlg, CALL ShowMAINProc TO lRslt
    
        FUNCTION = lRslt
    END FUNCTION
    '------------------------------------------------------------------------------
Working...
X