
Inside your PostUpdate() function, simply change
Code: Select all
PostEvent(#PB_Event_Gadget, *TabBarGadget\Window, *TabBarGadget\Number, #TabBarGadget_EventType_Updated, -1)
*TabBarGadget\UpdatePosted = #True
Code: Select all
*TabBarGadget\UpdatePosted = #True
PostEvent(#PB_Event_Gadget, *TabBarGadget\Window, *TabBarGadget\Number, #TabBarGadget_EventType_Updated, -1)
So the problem was:
1. I call SetTabBarGadgetItemImage() on the first tab...
2. The ImageID is changed...
3. PostEvent() with #TabBarGadget_EventType_Updated...
4. The Callback() function IMMEDIATELY redraws the TabBar, and sets UpdatePosted #False...
5. THEN UpdatePosted is set to #True...
6. Now I call SetTabBarGadgetItemImage() on the second tab...
7. The ImageID is changed...
8. Since UpdatePosted is set to #True, no event is posted, no callback is executed, the TabBar is not redrawn!!!
9. Moving the mouse over the TabBar causes it to redraw the new icon correctly
To fix it, swap those two lines. Now UpdatePosted is set #True before the Callback runs. I hope this all makes sense!
