Update of /cvsroot/mahogany/M/src/gui
In directory usw-pr-cvs1:/tmp/cvs-serv3446/src/gui
Modified Files:
wxMDialogs.cpp
Log Message:
select the last previously entered string in MInputBox() if no default value was
specified
Index: wxMDialogs.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/gui/wxMDialogs.cpp,v
retrieving revision 1.367
retrieving revision 1.368
diff -b -u -2 -r1.367 -r1.368
--- wxMDialogs.cpp 2 May 2002 20:54:45 -0000 1.367
+++ wxMDialogs.cpp 3 May 2002 15:35:23 -0000 1.368
@@ -247,6 +247,6 @@
// if using a textctrl and not a combobox, this will process the
// ENTER key
- void OnEnter(WXUNUSED(wxEvent &))
- { TransferDataFromWindow(); EndModal(wxID_OK); }
+ void OnEnter(wxEvent&) { TransferDataFromWindow(); EndModal(wxID_OK); }
+
private:
wxString m_strText;
@@ -531,8 +531,12 @@
// text is the default value normally read from config and it may be
// overriden by strDefault parameter if it is not empty
- if ( !strDefault )
+ if ( strDefault.empty() )
+ {
m_strText = strText;
- else
+ }
+ else // the program provided default value, use it
+ {
m_strText = strDefault;
+ }
// layout
@@ -577,4 +581,5 @@
m_passwd = NULL; // signal that it's not used
}
+
// buttons
wxButton *btnOk = new
@@ -596,12 +601,23 @@
bool MTextInputDialog::TransferDataToWindow()
{
- if(m_passwd == NULL)
+ if ( m_passwd == NULL )
+ {
+ if ( m_strText.empty() )
+ {
+ // use the last previously entered value instead
+ if ( m_text->GetCount() )
{
+ m_strText = m_text->GetString(0);
+ }
+ }
+
m_text->SetValue(m_strText);
+
// select everything so that it's enough to type a single letter to erase
// the old value (this way it's as unobtrusive as you may get)
m_text->SetSelection(-1, -1);
}
- return TRUE;
+
+ return true;
}
@@ -642,15 +658,13 @@
// do not allow attempts to store the password:
- wxASSERT((!passwordflag)||(szKey==NULL && def == NULL));
- if ( dlg.ShowModal() == wxID_OK )
- {
+ wxASSERT_MSG( !passwordflag || (szKey==NULL && def == NULL),
+ "passwords can't be stored!" );
+
+ if ( dlg.ShowModal() != wxID_OK )
+ return false;
+
*pstr = dlg.GetText();
- return TRUE;
- }
- else
- {
- return FALSE;
- }
+ return true;
}
_______________________________________________________________
Have big pipes? SourceForge.net is looking for download mirrors. We supply
the hardware. You get the recognition. Email Us: [EMAIL PROTECTED]
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates