Hi,
Le 22/08/2010 11:48, Steffen Kuhn a écrit :
> [...]
> if pgAdmin is startet with option 'S' and there are no QuickConnect
> informations in the settings
> the readonly comboboxes make no sense.
>
Yes, this was a known bug (at least to me), but didn't find the time to
work on it.
> I tried following code:
> if (form == NULL)
> {
> cbServer->SetValue(settings->Read(wxT("QuickConnect/server"),
> wxEmptyString));
> if (cbServer->IsEmpty())
> cbServer->SetWindowStyleFlag(cbServer->GetWindowStyleFlag()
> & ~wxCB_READONLY);
>
> cbDatabase->SetValue(settings->Read(wxT("QuickConnect/database"),
> wxEmptyString));
> if (cbDatabase->IsEmpty())
>
> cbDatabase->SetWindowStyleFlag(cbDatabase->GetWindowStyleFlag() &
> ~wxCB_READONLY);
>
> cbUsername->SetValue(settings->Read(wxT("QuickConnect/username"),
> wxEmptyString));
> }
>
> but the combobox didn't change to be editable.
The wxwxidgets doc says a refresh is needed. I did it, but it still
didn't work.
> So find another patch attached.
> Also fixed height of username combobox.
>
I did a few changes to your patch. Here is the one I commited on 1.12.
See patch attached.
I commited a slightly modified fix for 1.13 to take care of the new
rolename combobox.
Thanks for your report and patch.
--
Guillaume
http://www.postgresql.fr
http://dalibo.com
diff --git a/pgadmin/dlg/dlgSelectConnection.cpp b/pgadmin/dlg/dlgSelectConnection.cpp
index 9fd7800..ce7dce9 100644
--- a/pgadmin/dlg/dlgSelectConnection.cpp
+++ b/pgadmin/dlg/dlgSelectConnection.cpp
@@ -25,25 +25,25 @@
#define CTRLID_CBSERVER 4242
#define CTRLID_CBDATABASE 4243
+#define CTRLID_CBUSERNAME 4244
BEGIN_EVENT_TABLE(dlgSelectConnection, DialogWithHelp)
EVT_COMBOBOX(CTRLID_CBSERVER, dlgSelectConnection::OnChangeServer)
EVT_COMBOBOX(CTRLID_CBDATABASE, dlgSelectConnection::OnChangeDatabase)
EVT_TEXT(CTRLID_CBSERVER, dlgSelectConnection::OnTextChange)
EVT_TEXT(CTRLID_CBDATABASE, dlgSelectConnection::OnTextChange)
- EVT_TEXT(XRCID("cbUsername"), dlgSelectConnection::OnTextChange)
+ EVT_TEXT(CTRLID_CBUSERNAME, dlgSelectConnection::OnTextChange)
EVT_BUTTON (wxID_OK, dlgSelectConnection::OnOK)
EVT_BUTTON (wxID_CANCEL, dlgSelectConnection::OnCancel)
END_EVENT_TABLE()
#define stUsername CTRL_STATIC("stUsername")
-#define cbUsername CTRL_COMBOBOX("cbUsername")
-
dlgSelectConnection::dlgSelectConnection(wxWindow *parent, frmMain *form) :
DialogWithHelp(form)
{
+ long style = wxCB_DROPDOWN;
remoteServer = NULL;
wxWindowBase::SetFont(settings->GetSystemFont());
@@ -52,8 +52,12 @@ DialogWithHelp(form)
SetIcon(wxIcon(connect_xpm));
RestorePosition();
- cbServer = new ctlComboBoxFix(this, CTRLID_CBSERVER, ConvertDialogToPixels(wxPoint(65,5)), ConvertDialogToPixels(wxSize(135,12)), wxCB_DROPDOWN | wxCB_READONLY);
- cbDatabase = new wxComboBox(this, CTRLID_CBDATABASE, wxEmptyString, ConvertDialogToPixels(wxPoint(65,20)), ConvertDialogToPixels(wxSize(135,12)), NULL, wxCB_DROPDOWN | wxCB_READONLY);
+ if (form != NULL)
+ style |= wxCB_READONLY;
+
+ cbServer = new ctlComboBoxFix(this, CTRLID_CBSERVER, ConvertDialogToPixels(wxPoint(65,5)), ConvertDialogToPixels(wxSize(135,12)), style);
+ cbDatabase = new wxComboBox(this, CTRLID_CBDATABASE, wxEmptyString, ConvertDialogToPixels(wxPoint(65,20)), ConvertDialogToPixels(wxSize(135,12)), NULL, style);
+ cbUsername = new wxComboBox(this, CTRLID_CBUSERNAME, wxEmptyString, ConvertDialogToPixels(wxPoint(65,35)), ConvertDialogToPixels(wxSize(135,12)), NULL, style);
if (form == NULL)
{
diff --git a/pgadmin/include/dlg/dlgSelectConnection.h b/pgadmin/include/dlg/dlgSelectConnection.h
index 7528a1e..6dc6293 100644
--- a/pgadmin/include/dlg/dlgSelectConnection.h
+++ b/pgadmin/include/dlg/dlgSelectConnection.h
@@ -41,7 +41,7 @@ private:
pgServer *remoteServer;
wxBitmapComboBox *cbConnection;
ctlComboBoxFix *cbServer;
- wxComboBox *cbDatabase;
+ wxComboBox *cbDatabase, *cbUsername;
DECLARE_EVENT_TABLE()
};
diff --git a/pgadmin/ui/dlgSelectConnection.xrc b/pgadmin/ui/dlgSelectConnection.xrc
index 6d41c36..430a989 100644
--- a/pgadmin/ui/dlgSelectConnection.xrc
+++ b/pgadmin/ui/dlgSelectConnection.xrc
@@ -16,10 +16,6 @@
<label>Username</label>
<pos>5,37d</pos>
</object>
- <object class="wxComboBox" name="cbUsername">
- <pos>65,35d</pos>
- <size>135,-1d</size>
- </object>
<object class="wxButton" name="wxID_HELP">
<label>&Help</label>
<pos>2,65d</pos>
--
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers