MCPcopy Create free account
hub / github.com/GollyGang/ready / StringDialog

Method StringDialog

src/gui/dialogs.cpp:393–434  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

391// =============================================================================
392
393StringDialog::StringDialog(wxWindow* parent, const wxString& title,
394 const wxString& prompt, const wxString& instring,
395 const wxPoint& pos, const wxSize& size)
396{
397 Create(parent, wxID_ANY, title, pos, size);
398
399 // create the controls
400 wxBoxSizer* topSizer = new wxBoxSizer(wxVERTICAL);
401 SetSizer(topSizer);
402
403 textbox = new wxTextCtrl(this, wxID_ANY, instring);
404
405 wxStaticText* promptlabel = new wxStaticText(this, wxID_STATIC, prompt);
406
407 wxSizer* stdbutts = CreateButtonSizer(wxOK | wxCANCEL);
408
409 // position the controls
410 wxBoxSizer* stdhbox = new wxBoxSizer(wxHORIZONTAL);
411 stdhbox->Add(stdbutts, 1, wxGROW | wxRIGHT, STDHGAP);
412 wxSize minsize = stdhbox->GetMinSize();
413 if (minsize.GetWidth() < 250) {
414 minsize.SetWidth(250);
415 stdhbox->SetMinSize(minsize);
416 }
417
418 topSizer->AddSpacer(12);
419 topSizer->Add(promptlabel, 0, wxLEFT | wxRIGHT, 10);
420 topSizer->AddSpacer(10);
421 topSizer->Add(textbox, 0, wxGROW | wxLEFT | wxRIGHT, 10);
422 topSizer->AddSpacer(12);
423 topSizer->Add(stdhbox, 1, wxGROW | wxTOP | wxBOTTOM, 10);
424
425 GetSizer()->Fit(this);
426 GetSizer()->SetSizeHints(this);
427
428 if (pos == wxDefaultPosition) Centre();
429 if (size != wxDefaultSize) SetSize(size);
430
431 // select initial string (must do this last on Windows)
432 textbox->SetFocus();
433 textbox->SetSelection(-1,-1);
434}
435
436// -----------------------------------------------------------------------------
437

Callers

nothing calls this directly

Calls 1

AddMethod · 0.80

Tested by

no test coverage detected