This macro gives an example of how to set/change text button attributes.
protected:
public:
{
}
};
protected:
public:
ButtonWindow();
void DoLeftMargin(char*);
void DoRightMargin(char*);
void DoTopMargin(char*);
void DoBottomMargin(char*);
};
{
5, 5, 5, 5));
"&This button has a multi-line label\nand shows features\n"
"available in the button classes");
fButton->Resize(300, 200);
fButton->ChangeOptions(fButton->GetOptions() |
kFixedSize);
fButton->SetToolTipText("The assigned tooltip\ncan be multi-line also",200);
20, 20, 20, 20));
disable->
Connect(
"Toggled(Bool_t)",
"TGButton", fButton,
"SetEnabled(Bool_t)");
horizontal->
Connect(
"Pressed(Int_t)",
"ButtonWindow",
this,
"DoHPosition(Int_t)");
vertical->
Connect(
"Pressed(Int_t)",
"ButtonWindow",
this,
"DoVPosition(Int_t)");
TextMargin *left = new TextMargin(margins, "Left");
left->GetEntry()->Connect("TextChanged(char*)", "ButtonWindow",
this, "DoLeftMargin(char*)");
TextMargin *right = new TextMargin(margins, "Right");
right->GetEntry()->Connect("TextChanged(char*)", "ButtonWindow",
this, "DoRightMargin(char*)");
TextMargin *top = new TextMargin(margins, "Top");
top->GetEntry()->Connect("TextChanged(char*)", "ButtonWindow",
this, "DoTopMargin(char*)");
TextMargin *bottom = new TextMargin(margins, "Bottom");
bottom->GetEntry()->Connect("TextChanged(char*)", "ButtonWindow",
this, "DoBottomMargin(char*)");
0, 0, 0, 5));
Connect(
"CloseWindow()",
"TApplication",
gApplication,
"Terminate()");
DontCallClose();
MapSubwindows();
Resize();
SetWMSizeHints(GetDefaultWidth(), GetDefaultHeight(), 1000, 1000, 0 ,0);
SetWindowName("Button Test");
MapRaised();
}
void ButtonWindow::DoHPosition(
Int_t id)
{
Int_t tj = fButton->GetTextJustify();
fButton->SetTextJustify(tj);
}
void ButtonWindow::DoVPosition(
Int_t id)
{
Int_t tj = fButton->GetTextJustify();
fButton->SetTextJustify(tj);
}
void ButtonWindow::DoLeftMargin(char *val)
{
fButton->SetLeftMargin(atoi(val));
}
void ButtonWindow::DoRightMargin(char *val)
{
fButton->SetRightMargin(atoi(val));
}
void ButtonWindow::DoTopMargin(char *val)
{
fButton->SetTopMargin(atoi(val));
}
void ButtonWindow::DoBottomMargin(char *val)
{
fButton->SetBottomMargin(atoi(val));
}
void buttonTest()
{
new ButtonWindow();
}