Page 1 of 1

SpeedBar change several buttons flashes

Posted: Sat Nov 21, 2015 4:54 am
by mritter0
Now that I have my speedbar up and running (for the most part), I am seeing some poor refreshing.

My toolbar has up to 25 AISS images (no text). Depending on what the user is doing I change the SBNA_Disabled state of all 25 at once. Some get disabled, some get enabled. When I do this the entire speedbar is "removed" (all the buttons are gone), then all redrawn. This causes a major flashing of the bar. Not smooth at all.

Code: Select all

IIntuition->SetGadgetAttrs((struct Gadget *)Objects[GAD_TOOLBAR1_SPEEDBAR],MainWindow,NULL,
	SPEEDBAR_Buttons,					NULL,
TAG_DONE);

// go through all 25
ISpeedBar->SetSpeedButtonNodeAttrs(MasterToolBarNode->SBNode,
	SBNA_Disabled,						TRUE,
TAG_DONE);

IIntuition->SetGadgetAttrs((struct Gadget *)Objects[GAD_TOOLBAR1_SPEEDBAR],MainWindow,NULL,
	SPEEDBAR_Buttons,					ToolBar1SpeedBarList,
TAG_DONE);
IIntuition->SetAttrs() can't seem to remove/add the list, correct? I have to use IIntuition->SetGadgetAttrs(). The autodoc says IIntuition->SetGadgetAttrs() does an immediate redraw, which I am seeing. I am not changing the button's type, spacing, etc. so a WM_RETHINK is not necessary. Is there a way around this method?

Re: SpeedBar change several buttons flashes

Posted: Sat Nov 21, 2015 9:45 am
by salass00
You should use:

Code: Select all

IIntuition->SetAttrs(Objects[GAD_TOOLBAR1_SPEEDBAR],
   SPEEDBAR_Buttons, ~0,
TAG_DONE);
to detach the list and SetGadgetAttrs() only to attach it.

The ~0 value for SPEEDBAR_Buttons is made for temporary list removal like this and is explained in the autodoc.

The only difference between SetAttrs() and SetGadgetAttrs() is that SetGadgetAttrs() provides a GadgetInfo structure allowing the gadget to refresh itself if it wants to, but in this case you don't want it to so SetAttrs() is enough.

Re: SpeedBar change several buttons flashes

Posted: Sat Nov 21, 2015 11:31 pm
by mritter0
Thanks