Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Controls
  New Posts New Posts RSS Feed - [ Bug ] [ Button ] Bug introduced with v 17.1.0
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

[ Bug ] [ Button ] Bug introduced with v 17.1.0

 Post Reply Post Reply
Author
Message
Alexis View Drop Down
Newbie
Newbie


Joined: 09 March 2016
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote Alexis Quote  Post ReplyReply Direct Link To This Post Topic: [ Bug ] [ Button ] Bug introduced with v 17.1.0
    Posted: 09 March 2016 at 6:09am
Hi

Description of issue
-----------------------
Since version 17.1.0 a new behavior has been introduced.
Until this version, in method OnInitDialog we are now unable to use m_myButton.SetChecked ( true ) to change a check state on my button.

Since v 17.1.0, using that method will change the visual state of the control, but not the MFC internal state BST_CHECKED.

Reproducing steps
----------------------
- In OnInitDialog, call m_myButton.SetChecked ( true )
- Your button is visually checked (pushed)
- Put a breakpoint in CXTPButton::OnSetCheck
- Click on your button to uncheck it

What you'll have
--------------------
- Breakpoint hits in OnSetCheck, with parameter wParam being 1, which in turn call SetChecked ( true )

What you should expect
-----------------------------
- Breakpoint hits in OnSetCheck, with parameter wParam being 0, which in turn would call SetChecked ( false )

Appears that in OnInitDialog, calling m_myButton.SetChecked ( true ) is not setting the internal BST_CHECKED state on the MFC control, but will set the state m_bChecked in CXTPButton, which make each state mismatching.

Workaround
---------------
in OnInitDialog, do not call m_myButton.SetChecked ( true ) but m_myButton.SendMessage ( BM_SETCHECK, true, 0 ) which works as expected.
Back to Top
markr View Drop Down
Senior Member
Senior Member


Joined: 01 August 2004
Status: Offline
Points: 443
Post Options Post Options   Thanks (0) Thanks(0)   Quote markr Quote  Post ReplyReply Direct Link To This Post Posted: 09 March 2016 at 12:24pm
Noticed that here too.

I added a call to RedrawButton() at the end of CXTPButton::OnSetCheck in the XTP v17.1 sources and it seems to be working as expected now.

- Mark R.
Back to Top
olebed View Drop Down
Admin Group
Admin Group


Joined: 01 July 2014
Location: Ukraine
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote olebed Quote  Post ReplyReply Direct Link To This Post Posted: 10 March 2016 at 3:09am
Hello,

Please say, are changes in http://forum.codejock.com/forum_posts.asp?TID=22891  useful for fixing this issue ?

Regards,
 Oleksandr Lebed
Back to Top
markr View Drop Down
Senior Member
Senior Member


Joined: 01 August 2004
Status: Offline
Points: 443
Post Options Post Options   Thanks (0) Thanks(0)   Quote markr Quote  Post ReplyReply Direct Link To This Post Posted: 10 March 2016 at 1:15pm
Hi Oleksandr,

Those changes were rolled into v17.1, and I don't think they have any bearing on this problem. The first think I tried was reverting the CXTPButton::OnSetCheck() back to the code in v17.0, but that resolve the issue being described here.

To me it just looks like the control isn't redrawing itself after the change in check state.

- Mark R.
Back to Top
markr View Drop Down
Senior Member
Senior Member


Joined: 01 August 2004
Status: Offline
Points: 443
Post Options Post Options   Thanks (0) Thanks(0)   Quote markr Quote  Post ReplyReply Direct Link To This Post Posted: 18 April 2016 at 10:17am
Really surprising to me that 17.2 was released without fixing this bug.

- Mark R.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.203 seconds.