Print Page | Close Window

[ Bug ] [ Button ] Bug introduced with v 17.1.0

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Controls
Forum Description: Topics Related to Codejock Controls
URL: http://forum.codejock.com/forum_posts.asp?TID=22954
Printed Date: 29 April 2024 at 12:18am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: [ Bug ] [ Button ] Bug introduced with v 17.1.0
Posted By: Alexis
Subject: [ Bug ] [ Button ] Bug introduced with v 17.1.0
Date 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.



Replies:
Posted By: markr
Date 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.


Posted By: olebed
Date Posted: 10 March 2016 at 3:09am
Hello,

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

Regards,
 Oleksandr Lebed


Posted By: markr
Date 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.


Posted By: markr
Date Posted: 18 April 2016 at 10:17am
Really surprising to me that 17.2 was released without fixing this bug.

- Mark R.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net