Announcement

Collapse
No announcement yet.

%BM_CLICK does not work under NT

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

  • %BM_CLICK does not work under NT

    Hello folks,

    To begin with: I'm really glad that this bulletin board is 'on air' again.

    Now my question: I've a DDT-made dialog, containing 6 checkboxes.
    The button 'check all' does its work properly: after clicking this button
    all boxes are checked.

    Sometimes it is necessary to let the program itself check
    them all, instead of the user. In that case I send a %BM_CLICK message, like this:
    CONTROL SEND CBHNDL, %BUTN_ID, %BM_CLICK, 0, 0.
    Under W95 this works, but under NT4 the checkboxes stay empty.
    Of course there is a (Power) Basic work-around:
    FOR cnt& = chkID1 to chkID6
    CONTROL SET CHECK CBHNDL, cnt&, %TRUE
    NEXT
    It works on both platforms, but I prefer to use the %BM_CLICK message, which is
    more 'professional'. Has someone also experienced this? Or am I doing something wrong?

    Thanks for bailing me out.





    ------------------
    mailto:[email protected][email protected]</A>
    www.basicguru.com/zijlema/

    Egbert Zijlema, journalist and programmer (zijlema at basicguru dot eu)
    http://zijlema.basicguru.eu
    *** Opinions expressed here are not necessarily untrue ***

  • #2
    Remarks
    If the button is in a dialog box and the dialog box is not active,
    the BM_CLICK message might fail.
    To ensure success in this situation, call the SetActiveWindow function
    to activate the dialog box before sending the BM_CLICK message to the button.

    ------------------
    Fred
    mailto:[email protected][email protected]</A>
    http://www.oxenby.se



    [This message has been edited by Fred Oxenby (edited October 20, 2000).]
    Fred
    mailto:[email protected][email protected]</A>
    http://www.oxenby.se

    Comment


    • #3
      I have to wonder if that works at all, this is my workaround on my options box:

      If user clicks OK I need a central location for both Apply and "OK" to perform the same functions...

      So I just click the Apply button FOR the user when he/she clicks OK.

      'Click the Apply button
      If IsWindowEnabled(GetDlgItem(CbHndl,132)) Then SendMessage GetDlgItem(CbHndl,132) , %BM_CLICK, 0, 0

      Scott




      ------------------
      Scott
      mailto:[email protected][email protected]</A>
      Scott Turchin
      MCSE, MCP+I
      http://www.tngbbs.com
      ----------------------
      True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

      Comment


      • #4
        I'm trying to post this reply since 4 hours ago, but I did'nt get the reply form (got a 'page not found' error instead).
        Finally it seems to happen, although the reply form has a very naughty (better say: dirty) picture in its left upper corner. How come, PB-staff?

        Well, here's what I have on my mind:
        O, stupid me!

        I had the procedure to check the checkboxes implemented in a "CALLBACK FUNCTION ChckAllBtn()". Later on I decided to make it part of a general callback for the dialog, by way of a "WM_COMMAND". This works when the user really clicks the button involved, but it does not when the application sends the BM_CLICK message. I did'nt realize this. Before the modification the routine ran correctly under W95. After the change it did'nt under NT, which gave me the idea that it was NT's fault. (It did'nt work under W95 either, but after the change I did'nt retest it on that platform).
        In brief: my stupidity. Sorry for that!
        One question: what is the correct WM-notification (instead of WM_COMMAND) to intercept the BM_ CLICK message?



        ------------------
        mailto:[email protected][email protected]</A>
        www.basicguru.com/zijlema/

        Egbert Zijlema, journalist and programmer (zijlema at basicguru dot eu)
        http://zijlema.basicguru.eu
        *** Opinions expressed here are not necessarily untrue ***

        Comment


        • #5
          It works on both platforms, but I prefer to use the %BM_CLICK message, which is
          more 'professional'. Has someone also experienced this? Or am I doing something wrong?
          More professional? I don't think so.
          This is a somewhat roundabout way of setting the checked state of checkboxes.
          The most efficient way to accomplish this task is as follows-

          SendMessage hWndButton, %BM_SETCHECK, %BST_CHECKED, 0

          Your method is roundabout and not fail safe because it generates the following messages-
          Code:
            
          BM_CLICK -> causes the checkbox to receive a WM_LBUTTONDOWN and a WM_LBUTTONUP message
                      and its parent to receive a BN_CLICKED notification via WM_COMMAND.
          Hmm...a bit obscure.

          [This message has been edited by Dominic Mitchell (edited October 20, 2000).]
          Dominic Mitchell
          Phoenix Visual Designer
          http://www.phnxthunder.com

          Comment

          Working...
          X