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
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.
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.