IMPLEMENT_CLASS(wxTextEntryDialog, wxDialog)
#endif
-extern void wxSplitMessage2(const char *message, wxList *messageList, wxWindow *parent, wxRowColSizer *sizer);
+// Split message, using constraints to position controls
+static void wxSplitMessage2(const char *message, wxList *messageList, wxWindow *parent, wxRowColSizer *sizer)
+{
+ char *copyMessage = copystring(message);
+ size_t i = 0;
+ size_t len = strlen(copyMessage);
+ char *currentMessage = copyMessage;
+
+// wxWindow *lastWindow = parent;
+
+ while (i < len) {
+ while ((i < len) && (copyMessage[i] != '\n')) i++;
+ if (i < len) copyMessage[i] = 0;
+ wxStaticText *mess = new wxStaticText(parent, -1, currentMessage);
+
+/*
+ wxLayoutConstraints *c = new wxLayoutConstraints;
+ c->left.SameAs (parent, wxLeft, 10);
+ c->top.SameAs (lastWindow, wxBottom, 5);
+ c->right.AsIs ();
+ c->height.AsIs ();
+
+ mess->SetConstraints(c);
+*/
+ sizer->AddSizerChild(mess);
+
+ messageList->Append(mess);
+
+ currentMessage = copyMessage + i + 1;
+ }
+ delete[] copyMessage;
+}
wxTextEntryDialog::wxTextEntryDialog(wxWindow *parent, const wxString& message, const wxString& caption,
const wxString& value, long style, const wxPoint& pos):
- wxDialog(parent, -1, caption, pos, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL)
+ wxDialog(parent, -1, caption, pos, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL|wxTAB_TRAVERSAL)
{
m_dialogStyle = style;
m_value = value;
c->top.Below (spacingSizer2);
c->centreX.SameAs (textSizer, wxCentreX);
buttonSizer->SetConstraints(c);
+ buttonSizer->SetSpacing(12,0);
wxButton *ok = NULL;
wxButton *cancel = NULL;
if (style & wxOK) {
- ok = new wxButton(this, wxID_OK, _("OK"));
+ ok = new wxButton(this, wxID_OK, _("OK"), wxDefaultPosition, wxSize(75,-1));
buttonSizer->AddSizerChild(ok);
}
if (style & wxCANCEL) {
- cancel = new wxButton(this, wxID_CANCEL, _("Cancel"));
+ cancel = new wxButton(this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxSize(75,-1));
buttonSizer->AddSizerChild(cancel);
}
EndModal(wxID_OK);
}
-wxString wxGetTextFromUser(const wxString& message, const wxString& caption,
- const wxString& defaultValue, wxWindow *parent,
- int x, int y, bool WXUNUSED(centre) )
-{
- wxTextEntryDialog dialog(parent, message, caption, defaultValue, wxOK|wxCANCEL, wxPoint(x, y));
- if (dialog.ShowModal() == wxID_OK)
- return dialog.GetValue();
- else
- return wxString("");
-}