Announcement

Collapse
No announcement yet.

Check3state: how to check gray?

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

  • Check3state: how to check gray?

    Hi folks,
    This is what I've copied from the on-line PBDLL60 helpfile in connection with CONTROL GET CHECK.
    "Purpose: Get the check status of a CHECKBOX, CHECK3STATE or OPTION button.
    "Syntax: CONTROL GET CHECK hDlg&, Id& TO result&
    "Remarks: - .... - Zero (0) is returned if the button is unchecked. One (1) is returned if the button is checked.
    "Two (2) is returned if a 3STATE button is grayed. - end quote.

    Well, one of my dialogs contains grayed CHECK3STATE boxes (used CONTROL DISABLE to achieve that),
    but CONTROL GET CHECK does return zero or one; never a '2'. Is this a known bug in DDT?
    And if so, how to work around it?

    Thanks,



    ------------------
    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
    Hi Egbert,

    Although I don't do DDT, have you tried the %BM_GETCHECK message as a workaround?

    Code:
    iState = SendMessage(hBtn, %BM_GETCHECK, 0, 0)
    If iState = %BST_INDETERMINATE Then [etc. etc.]
    Regards,


    ------------------
    Kev G Peel
    KGP Software, Bridgwater, UK.
    www.go.to/kgpsoftware
    kgpsoftware.com | Slam DBMS | PrpT Control | Other Downloads | Contact Me

    Comment


    • #3
      Egbert --
      You mix disabled control with "grayed".
      Grayed means "indeterminate". Meanwhile control remains enabled.

      To set "gray" state you should send a message
      Control Send CbHndl, id, %BM_SETCHECK, %BST_INDETERMINATE, 0
      instead of disabling.

      Small illustration:

      Code:
         #Dim All
         #Register None
         #Include "Win32Api.Inc"
         CallBack Function DlgProc
            Select Case CbMsg
               Case %WM_INITDIALOG
                  Control Add Check3State, CbHndl, 101, "Disabled", 10, 5, 80, 15
                  Control Add Check3State, CbHndl, 102, "Grayed", 10, 20, 80, 15
                  Control Add Check3State, CbHndl, 103, "Checked", 10, 35, 80, 15
                  Control Add Check3State, CbHndl, 104, "Unchecked", 10, 50, 80, 15
                  Control Disable CbHndl, 101
                  Control Send CbHndl, 102, %BM_SETCHECK, %BST_INDETERMINATE, 0
                  Control Set Check CbHndl, 103, %BST_CHECKED
            End Select
         End Function
      
         Function PbMain
            Local hDlg As Long
            Dialog New 0 ,"Test",,, 100, 70, %WS_SYSMENU Or %WS_CAPTION Or %WS_MINIMIZEBOX To hDlg
            Dialog Show Modal hDlg, Call DlgProc
         End Function
      ------------------
      E-MAIL: [email protected]

      [This message has been edited by Semen Matusovski (edited October 11, 2000).]

      Comment


      • #4
        It's not a bug in DDT or anything else. A Check3State box may have any of three values: true, false, or indeterminate. These values have nothing to do with whether the box is enabled or disabled, which is an entirely different property of the control.


        ------------------
        Tom Hanlin
        PowerBASIC Staff

        Comment


        • #5
          Thank you, boys!

          I did not know the difference between 'grayed' and 'disabled'.
          Sorry, Tom, but due to this lack of knowledge I really thought it was a bug.
          It is great to experience, by the way, that Power Basic staff members do participate in these discussions.
          Two months ago (approx.) I published my article discussing the version info stuff. In my opinion the article
          delivers watertight evidence that Microsoft programmers don't follow their own rules in this field. Microsoft
          staff members must have read (or at least: seen) it, but I did not get any comment.





          ------------------
          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

          Working...
          X