Home » U++ Library support » Menus&Toolbars » ToolBar Callback weirdness
Re: ToolBar Callback weirdness [message #35278 is a reply to message #35273] |
Sat, 28 January 2012 14:19   |
 |
mirek
Messages: 14258 Registered: November 2005
|
Ultimate Member |
|
|
You have to 'refresh' toolbar explicitly by setting it again after making any changes to it:
struct BarTest: TopWindow {
ToolBar toolbar;
int tool;
typedef BarTest CLASSNAME;
void SetBar()
{
toolbar.Set(THISBACK(ToolBarContent));
}
BarTest()
{
tool = 1;
AddFrame(toolbar.Left());
SetBar();
}
virtual void Paint(Draw& w)
{
w.DrawRect(GetSize(), Gray());
w.DrawText(200, 220, AsString(tool));
}
void SetTool(int t)
{
tool = t;
Refresh();
SetBar();
}
void ToolBarContent(Bar& bar)
{
bar.Add("Move", CtrlImg::reporticon(), THISBACK1(SetToool, 1))
.Check(tool == 1);
bar.Add("Rotate", CtrlImg::reporticon(), THISBACK1(SetTool, 2))
.Check(tool == 2);
}
};
|
|
|
Goto Forum:
Current Time: Fri May 16 15:39:52 CEST 2025
Total time taken to generate the page: 0.03574 seconds
|