25 ClassImp(TGInputDialog);
30 TGInputDialog::TGInputDialog(
const TGWindow *p,
const TGWindow *main,
31 const char *prompt,
const char *defval,
32 char *retstr, UInt_t options) :
33 TGTransientFrame(p, main, 10, 10, options)
57 SetCleanup(kDeepCleanup);
59 fLabel =
new TGLabel(
this, prompt?prompt:
"Introduce value:");
61 TGTextBuffer *tbuf =
new TGTextBuffer(256);
62 tbuf->AddText(0, defval?defval:
"");
64 fTE =
new TGTextEntry(
this, tbuf);
65 fTE->Resize(260, fTE->GetDefaultHeight());
67 AddFrame(fLabel,
new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 5, 5, 0));
68 AddFrame(fTE,
new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 5, 5, 5));
71 TGHorizontalFrame *hf =
new TGHorizontalFrame(
this, 60, 20, kFixedWidth);
72 hf->SetCleanup(kDeepCleanup);
75 UInt_t width = 0, height = 0;
77 fOk =
new TGTextButton(hf,
"&Ok", 1);
79 hf->AddFrame(fOk,
new TGLayoutHints(kLHintsCenterY | kLHintsExpandX, 5, 5, 0, 0));
80 height = fOk->GetDefaultHeight();
81 width = TMath::Max(width, fOk->GetDefaultWidth());
83 fCancel =
new TGTextButton(hf,
"&Cancel", 2);
84 fCancel->Associate(
this);
85 hf->AddFrame(fCancel,
new TGLayoutHints(kLHintsCenterY | kLHintsExpandX, 5, 5, 0, 0));
86 height = fCancel->GetDefaultHeight();
87 width = TMath::Max(width, fCancel->GetDefaultWidth());
90 AddFrame(hf,
new TGLayoutHints(kLHintsBottom | kLHintsCenterX, 0, 0, 5, 5));
93 hf->Resize((width + 20) * 2, height);
96 SetWindowName(
"Get Input");
101 width = GetDefaultWidth();
102 height = GetDefaultHeight();
104 Resize(width, height);
110 SetWMSize(width, height);
111 SetWMSizeHints(width, height, width, height, 0, 0);
113 SetMWMHints(kMWMDecorAll | kMWMDecorResizeH | kMWMDecorMaximize |
114 kMWMDecorMinimize | kMWMDecorMenu, kMWMFuncAll |
115 kMWMFuncResize | kMWMFuncMaximize | kMWMFuncMinimize,
123 retstr =
new char[256];
127 gClient->WaitFor(
this);
133 TGInputDialog::~TGInputDialog()
141 Bool_t TGInputDialog::ProcessMessage(Long_t msg, Long_t parm1, Long_t)
143 switch (GET_MSG(msg)) {
145 switch (GET_SUBMSG(msg)) {
151 strcpy(fRetStr, fTE->GetBuffer()->GetString());
155 if (!strcmp(fRetStr,
""))
173 switch (GET_SUBMSG(msg)) {
177 strcpy(fRetStr, fTE->GetBuffer()->GetString());
181 if (!strcmp(fRetStr,
""))