Announcement

Collapse
No announcement yet.

Read Only Style

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

  • Read Only Style

    The edit control can be set with a read only style. Do CheckBox's, or ComboBox's have a similar style or a way to prevent changing the state?

    *** OR ***

    I can detect the CheckBox control getting focus and redirect it but how would I then change the color of the check box from white to gray to match the read only style.

    Disabled style is not an option due to the fact it makes the text inside of it dark gray in lieu of black.

    I checked the WIN32API and it appears there isn't an equivelent style that I can ascertain.

    P.S. To further add to it I am using a custom bitmap background for the dialog

    ------------------
    George W. Bleck
    Senior System Engineer
    KeySpan Corporation


    [This message has been edited by George Bleck (edited October 04, 2000).]
    <b>George W. Bleck</b>
    <img src='http://www.blecktech.com/myemail.gif'>

  • #2
    You could try drawing a checkbox instead of using the checkbox control. Take a look at the DrawFrameControl API... It allows you to draw a checkbox in any state, and clicking on it will have no more effect than clicking on a bitmap.

    -- Eric

    ------------------
    Perfect Sync: Perfect Sync Development Tools
    Email: mailto:[email protected][email protected]</A>

    "Not my circus, not my monkeys."

    Comment


    • #3
      Eric,

      Thanks for the suggestion, but in my case I have edit controls that are read only and as such appear gray w/black text

      I need to get the checkbox's gray w/black text as well so as to not ruin the "look" of the dialog.

      ------------------
      George W. Bleck
      Senior System Engineer
      KeySpan Corporation
      <b>George W. Bleck</b>
      <img src='http://www.blecktech.com/myemail.gif'>

      Comment


      • #4
        Subclassing solves a lot of problems.
        Code:
           #Compile Exe
           #Dim All
           #Register None
           #Include "Win32Api.Inc"
        
           Global CheckBoxProcOr As Long
        
           CallBack Function CheckBoxProc
              Select Case CbMsg
                 Case %WM_NCHITTEST: Function = %HTNOWHERE: Exit Function
                 Case %WM_KEYDOWN, %WM_KEYUP, %WM_CHAR: Exit Function
                 Case %WM_DESTROY: SetWindowLong CbHndl, %GWL_WNDPROC, CheckBoxProcOr: Exit Function
              End Select
              Function = CallWindowProc(CheckBoxProcOr, CbHndl, CbMsg, CbWparam, CbLparam)
           End Function
        
           CallBack Function DlgProc
              Select Case CbMsg
                 Case %WM_INITDIALOG
                    Control Add Button, CbHndl, 101,"Button 1", 10, 5, 80, 15
                    Control Add CheckBox, CbHndl, 102, "Click me", 10, 25, 80, 15
                    Control Add Button, CbHndl, 103,"Button 2", 10, 45, 80, 15
                    Control Set Check CbHndl, 102, %True
                    CheckBoxProcOr = SetWindowLong(GetDlgItem(CbHndl, 102), %GWL_WNDPROC, CodePtr(CheckBoxProc))
              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]

        Comment

        Working...
        X