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.
A composite frame with a border and a title.
virtual void SetTitlePos(ETitlePos pos=kLeft)
A composite frame that layout their children in horizontal way.
This class handles GUI labels.
This class describes layout hints used by the layout classes.
Defines top level windows that interact with the system Window Manager.
TGNumberEntry is a number entry input widget with up/down buttons.
TGNumberEntryField * GetNumberEntry() const
Yield an action as soon as it is clicked.
A TGTextEntry is a one line text input widget.
A vertical 3D line is a line that can be used to separate groups of widgets.
A composite frame that layout their children in vertical way.
ROOT GUI Window base class.
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.