SpeedBar change several buttons flashes

This forum is for general developer support questions.
Post Reply
User avatar
mritter0
Posts: 214
Joined: Mon Aug 25, 2014 9:41 pm
Location: Bettendorf, IA, USA

SpeedBar change several buttons flashes

Post 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?
Workbench Explorer - A better way to browse drawers
User avatar
salass00
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 530
Joined: Sat Jun 18, 2011 3:12 pm
Location: Finland
Contact:

Re: SpeedBar change several buttons flashes

Post 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.
User avatar
mritter0
Posts: 214
Joined: Mon Aug 25, 2014 9:41 pm
Location: Bettendorf, IA, USA

Re: SpeedBar change several buttons flashes

Post by mritter0 »

Thanks
Workbench Explorer - A better way to browse drawers
Post Reply