Print Page | Close Window

[solved] v17 Flickering buttons in status bar

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=22891
Printed Date: 14 May 2024 at 5:22pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: [solved] v17 Flickering buttons in status bar
Posted By: Dan
Subject: [solved] v17 Flickering buttons in status bar
Date Posted: 11 February 2016 at 10:39am
Hi,

After upgrading from v16.3.1 to v17, the CXTPButton sub-classed buttons on the status-bar of our application have started to flicker (going from their unpressed state to pressed state) as you move the mouse around.

Each of these buttons have command update handlers which are called during idle processing time to make sure they have the correct state.   e.g. something like...

void CMainFrame::OnUpdateUtilsParallelto(CCmdUI* pCmdUI) 
{
pCmdUI->Enable(allow_snap);
pCmdUI->SetCheck(current_snap_type() == SNAP_PARALLEL);
}

I think the problem is related to this new code in XTPButton.cpp (introduced since v16.3.1)...

LRESULT CXTPButton::OnSetCheck(WPARAM wParam, LPARAM /*lParam*/)
{
BOOL bVisible = GetStyle() & WS_VISIBLE;
if (bVisible) ModifyStyle(WS_VISIBLE, 0);
Default();
if (bVisible) ModifyStyle(0, WS_VISIBLE);

if (IsPushButton())
{
SetChecked(!GetChecked());
}
...

The line in bold seems to assume that because a button is a push button that calling OnSetCheck should toggle the state, when in fact, the wParam parameter indicates the desired state which could be the same as it was previously.

Changing that line to...

SetChecked(wParam==BST_CHECKED);

Fixes the problem for our application.

Dan




Replies:
Posted By: olebed
Date Posted: 15 February 2016 at 10:46am
Hello Dan,

Thank you for bringing this to our attention. I have added your changes to our code.

Regards,
 Oleksandr Lebed



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