Menu

Suggested bug fix for TGlyphButton

JV
2007-05-10
2012-09-25
  • JV

    JV - 2007-05-10

    Hello,
    I'm suggesting a bug fix for glyphbtn.cpp.
    The setting of the flag 'biDefault' in 'TGlyphButton::SetupWindow' to make the button a default button does not function properly.
    The problem is that the complete style (32 bit) is taken for analysis. The better way is to mask the lower part of the style before, like in the functions 'TGlyphButton::BmSetStyle' and 'BButtonProc' in the same file.

    original:
    void TGlyphButton::SetupWindow()
    {
    TButton::SetupWindow();

    // Update state flags based on current style
    //
    uint32 style = GetStyle();
    if (style & BS_DEFPUSHBUTTON)
    Set(biDefault);
    if (style & WS_DISABLED)
    Set(biDisabled);
    ...

    fix:
    void TGlyphButton::SetupWindow()
    {
    TButton::SetupWindow();

    // Update state flags based on current style
    //
    uint32 style = GetStyle();
    uint16 btnStyle = uint16(LoUint16(style) & BUTTONSTYLE_MASK);
    if (btnStyle == BS_DEFPUSHBUTTON)
    Set(biDefault);
    if (style & WS_DISABLED)
    Set(biDisabled);
    ...

    Thanks
    Jörg

     
    • Ognyan Chernokozhev

      Hello,

      you're right, the button styles are defined as

      define BS_PUSHBUTTON 0x00000000L

      define BS_DEFPUSHBUTTON 0x00000001L

      define BS_CHECKBOX 0x00000002L

      define BS_AUTOCHECKBOX 0x00000003L

      define BS_RADIOBUTTON 0x00000004L

      define BS_3STATE 0x00000005L

      define BS_AUTO3STATE 0x00000006L

      define BS_GROUPBOX 0x00000007L

      define BS_USERBUTTON 0x00000008L

      define BS_AUTORADIOBUTTON 0x00000009L

      ...

      which means that the test
      style & BS_DEFPUSHBUTTON
      will be positive for BS_AUTOCHECKBOX and some others ...

       

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB