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();
tj &= ~kTextCenterX;
tj &= ~kTextLeft;
tj &= ~kTextRight;
fButton->SetTextJustify(tj);
}
void ButtonWindow::DoVPosition(
Int_t id)
{
Int_t tj = fButton->GetTextJustify();
tj &= ~kTextCenterY;
tj &= ~kTextTop;
tj &= ~kTextBottom;
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();
}
#define ClassDef(name, id)
R__EXTERN TApplication * gApplication
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
virtual void SetTitlePos(ETitlePos pos=kLeft)
TGNumberEntryField * GetNumberEntry() const
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot.