This macro gives an example of how to set/change text entry attributes.
private:
public:
GroupBox(
const TGWindow *p,
const char *
name,
const char *title);
};
GroupBox::GroupBox(
const TGWindow *p,
const char *
name,
const char *title) :
{
5, 0, 5, 5));
fCombo->Resize(100, 20);
}
class TextEntryWindow {
protected:
GroupBox *fEcho;
GroupBox *fAlign;
GroupBox *fAccess;
GroupBox *fBorder;
public:
TextEntryWindow();
virtual ~TextEntryWindow() { delete fMain; }
};
TextEntryWindow::TextEntryWindow()
{
fEcho = new GroupBox(fMain, "Echo", "Mode:");
combo = fEcho->GetCombo();
entry = fEcho->GetEntry();
combo->
Connect(
"Selected(Int_t)",
"TGTextEntry", entry,
"SetEchoMode(TGTextEntry::EEchoMode)");
fAlign = new GroupBox(fMain, "Alignment", "Type:");
combo = fAlign->GetCombo();
entry = fAlign->GetEntry();
combo->
Connect(
"Selected(Int_t)",
"TGTextEntry", entry,
"SetAlignment(ETextJustification)");
fAccess = new GroupBox(fMain, "Access", "Read-only:");
combo = fAccess->GetCombo();
entry = fAccess->GetEntry();
combo->
Connect(
"Selected(Int_t)",
"TGTextEntry", entry,
"SetEnabled(Int_t)");
fBorder = new GroupBox(fMain, "Border", "Drawn:");
combo = fBorder->GetCombo();
entry = fBorder->GetEntry();
combo->
Connect(
"Selected(Int_t)",
"TGTextEntry", entry,
"SetFrameDrawn(Int_t)");
fMain->Connect(
"CloseWindow()",
"TApplication",
gApplication,
"Terminate()");
fMain->DontCallClose();
fMain->MapSubwindows();
fMain->Resize();
fMain->SetWMSizeHints(fMain->GetDefaultWidth(), fMain->GetDefaultHeight(),
1000, 1000, 0, 0);
fMain->SetWindowName("Text Entries");
fMain->MapRaised();
}
void textEntries()
{
new TextEntryWindow();
}
#define ClassDef(name, id)
R__EXTERN TApplication * gApplication
A combobox (also known as a drop down listbox) allows the selection of one item out of a list of item...
virtual void AddEntry(TGString *s, Int_t id)
virtual void Select(Int_t id, Bool_t emit=kTRUE)
Make the selected item visible in the combo box window and emit signals according to the second param...
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.
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.
A TGTextEntry is a one line text input widget.
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.