Hi,
I have refresh ( flickering ?) issue with FixedText controls in
Toolbox, but only on Windows and Linux. On Mac OS X, things are
perfect, no problem.
Specifications are :
Let's consider a rectangle (for instance, a button), in a toolbox
object.
* when the mouse cursor rolls over on button, the
VCLEVENT_TOOLBOX_HIGHLIGHT is sent when entering in the button
rectangle.
* when the mouse cursor goes out of the area, the
VCLEVENT_TOOLBOX_HIGHLIGHTOFF is sent.
Receive VCLEVENT_TOOLBOX_HIGHLIGHT triggers a aFixedText.Show()
Receive VCLEVENT_TOOLBOX_HIGHLIGHTOFF triggers all FixedText controls
to be hidden ( e.g. aFixedText.Hide() )
So when the mouse cursor is moved from left to right, we see the
following events occur :
VCLEVENT_TOOLBOX_HIGHLIGHT is catched, next is
VCLEVENT_TOOLBOX_HIGHLIGHTOFF ... VCLEVENT_TOOLBOX_HIGHLIGHT ... and
so on, alternatively.
The result is :
no text shown ... show fixed text1 .. hide all fixed text ... show
fixed text2 ... hide alll
The relevant code is :
IMPL_LINK( BackingWindow, DecoToolboxHdl, VclWindowEvent*, pEvent )
{
if( pEvent && pEvent->GetId() == VCLEVENT_TOOLBOX_HIGHLIGHT )
{
#ifdef DEBUG
fprintf(stdout, "Toolbox nItemId = %d \n",
maToolbox.GetHighlightItemId() );
#endif
switch ( maToolbox.GetHighlightItemId() )
{
case nItemId_Calc:
maCalcMessageText.Show();
break;
case nItemId_Draw:
maDrawMessageText.Show();
break;
case nItemId_Impress:
maImpressMessageText.Show();
break;
case nItemId_Info:
maOpenMessageText.Show();
break;
case nItemId_Writer:
maWriterMessageText.Show();
break;
case nItemId_Extensions:
case nItemId_Reg:
case nItemId_TplRep:
default:
break;
}
}
else if( pEvent && pEvent->GetId() ==
VCLEVENT_TOOLBOX_HIGHLIGHTOFF )
{
maCalcMessageText.Hide();
maDrawMessageText.Hide();
maImpressMessageText.Hide();
maOpenMessageText.Hide();
maWriterMessageText.Hide();
}
return 0;
}
The issue :
When moving the mouse cursor fastly between two buttons, sort of
flicker appear, probably caused by either performance issue, or
something missing in the code. In my mind, the term flicker, happens
to be the FixedText background who appears (just "flickering"), and
this causes a very bad user experience : most of children, play with
the show / hide startcenter feature naturaly ...
If this can help, at initialisation, I have used SetPaintTransparent
(), for every FixedText control, and tested Erase() and several other
methods since, to make the FixedText control background transparent
(means : no longer displayed). Unfortunaly, nothing helped until now.
Is there something missing, or is the current solution plain wrong
(please tell me why), or is there a better implementation on Mac OS X
than elsewhere ? (double buffering or something issue on Linux, or
missing Invalidate somewhere or ... ? ). Other possibility : did I
implement the algo ( Show() / Hide() ) at too hight level, causing
performance issues ? But then, why Mac OS X fine in this case ?
The current workaround I had in mind was to use a timer: enter in a
rectangle triggers a timer (e.g 200 ms or a same magnitude value) .
The first time we roll over a button, the Timer starts. If ever other
VCL events are detected, until the timeout is reached, no way to
hide / show again (using Timer::bIsActive() information ). This
means, there will be always a delay before a string appears, starting
the second time we roll over a button with the mouse cursor. But I
consider this solution as a workaround, and I ask here for something
better.
I'm not a native speaker, and my english is not precise, so feel free
to ask for further information.
Thanks in advance for any help !
Eric Bachard
--
qɔᴉɹə
Education Project:
http://wiki.services.openoffice.org/wiki/Education_Project
Projet OOo4Kids : http://wiki.ooo4kids.org/index.php/Main_Page
L'association EducOOo : http://www.educoo.org
Blog : http://eric.bachard.org/news