Print Page | Close Window

Controls flicker in resizing dialog

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=3419
Printed Date: 28 June 2025 at 2:12pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Controls flicker in resizing dialog
Posted By: Warren
Subject: Controls flicker in resizing dialog
Date Posted: 16 December 2005 at 11:43am
I've got a resizing dialog (i.e. a dialog derived from CXTResizeDialog), and a number of my controls flicker when I resize them. I found CXTResizeGroupBox and that fixes the problem for group boxes.

The flicker still occurs for Tree controls and Check-list-boxes (which I use a LOT of in my application - so the flicker is quite noticable).

I tried using the CXTNoFlickerWnd, but when I tried it:

i.e.
writing this:
CXTNoFlickerWnd < CCheckListBox > m_list;
instead of:
CCheckListBox m_list;

The CCheckListBox did NOT draw properly (the background of the area below where there were checkboxes was grey, instead of white, and the area just a few pixels around the checkboxes didn't draw properly)

Is CXTNoFlickerWnd the proper class, and I'm just doing something slightly wrong, or should I be using something else ????



Replies:
Posted By: Oleg
Date Posted: 18 December 2005 at 8:09am

Hi,

Some classes can't use CXTNoFlickerWnd  (see its sources to understand how it works).

for tree cotnrols you can use CXTTreeCtrl classes.



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: Warren
Date Posted: 18 December 2005 at 12:02pm
Oleg,

1) Thanks for the info about the CXTTreeCtrl. All my trees are derived from one class, so that was a one line fix for me. Sweet!

2) Based on your comment above ("Some classes can't use CXTNoFlickerWnd") I didn't go down that road any further, but I still wanted to resolve my flickering issue.  My requirements for the checklistbox are the "simple" case (i.e. just a checkmark beside some text - no fancy drawing or images) Here is what I found:

i) The image on the right is the standard MFC CCheckListBox control. The drawing is correct, but it flickers when resized.

ii) The image on the left is the CXTCheckListBox. I tried using this in place of my CCheckListBox. It ASSERTed that it needed "variable" owner drawing, so I turned this on. Unfortunately the items are not being drawn correctly (the font is correct, the check boxes are the right size, but there is no space between the items).

iii) The image in the center, is from my derived class. All I did was tear out the ASSERT  (on line 228 of xtchecklistbox.cpp
void CXTCheckListBox::DrawItem(LPDRAWITEMSTRUCT lpDIS)
{
// Must be LBS_OWNERDRAWVARIABLE | LBS_HASSTRINGS    ASSERT((GetStyle() & (LBS_OWNERDRAWVARIABLE | LBS_HASSTRINGS)) ==

(LBS_OWNERDRAWVARIABLE | LBS_HASSTRINGS));

and set the control to "Fixed" Owner drawing. This mostly fixed the issue (i.e. there is no flickering), but the drawing is not quite the same as the standard control drawing:

a) The text is slightly too high, compared to the checkbox
b) The focus is not drawn around the checkmark, like the standard control.

These drawing issues are not a BIG deal for me, but I thought you should know about them.

My primary question here is: "is this the right way/control to go about solving the flicker for my CCheckListBoxes ?", and if so, can you remove the ASSERT that it must be Owner-draw variable, as owner-draw fixed seems to otherwise work.

Thanks

Warren








Posted By: Oleg
Date Posted: 19 December 2005 at 12:49am

Actually you can use CXTCheckListBox with OwnerDrawFixed and remove this assert

 

In the last version it looks like:

 // Must be LBS_OWNERDRAWVARIABLE or LBS_OWNERDRAWFIXED and LBS_HASSTRINGS
 ASSERT(GetStyle() & (LBS_OWNERDRAWFIXED | LBS_OWNERDRAWVARIABLE));
 ASSERT(GetStyle() & (LBS_HASSTRINGS));

So it was bug in previous versions.



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS



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