On 14 July 2011 10:31, Thom Brown <t...@linux.com> wrote: > On 14 July 2011 10:24, Guillaume Lelarge <guilla...@lelarge.info> wrote: >> So, you're working on fixing it, right? > > Possibly ;) : http://code.pgadmin.org/trac/ticket/329 > > I haven't had time to look at fixing various bugs over the last couple > days but I'll get to them shortly.
Apologies for the delay but I've now had a moment to look at it. The attached patch removes the duplicate restriction from OnMemberAdd to OnChangeMember, and also disabled the Add button by default. This is because it's enabled on loading the form which doesn't get disabled again until you start editing the attribute name field, meaning you can click Add without having provided any attribute details. -- Thom Brown Twitter: @darkixion IRC (freenode): dark_ixion Registered Linux user: #516935 EnterpriseDB UK: http://www.enterprisedb.com The Enterprise PostgreSQL Company
diff --git a/pgadmin/dlg/dlgType.cpp b/pgadmin/dlg/dlgType.cpp index 4ef5454..6a3f678 100644 --- a/pgadmin/dlg/dlgType.cpp +++ b/pgadmin/dlg/dlgType.cpp @@ -112,9 +112,12 @@ dlgType::dlgType(pgaFactory *f, frmMain *frame, pgType *node, pgSchema *sch) void dlgType::OnChangeMember(wxCommandEvent &ev) { + wxString name = txtMembername->GetValue().Strip(wxString::both); + btnAddMember->Enable( ((type && connection->BackendMinimumVersion(9, 1)) || !type) - && !txtMembername->GetValue().Strip(wxString::both).IsEmpty() + && !name.IsEmpty() + && lstMembers->FindItem(-1, name, false) == -1 && cbDatatype->GetGuessedSelection() >= 0); btnChangeMember->Enable(true); } @@ -239,7 +242,7 @@ int dlgType::Go(bool modal) bool changeok = connection->BackendMinimumVersion(9, 1); txtMembername->Enable(changeok); cbCollation->Enable(changeok); - btnAddMember->Enable(changeok); + btnAddMember->Enable(false); btnChangeMember->Enable(false); btnRemoveMember->Enable(false); @@ -529,7 +532,7 @@ void dlgType::OnMemberAdd(wxCommandEvent &ev) type += wxT(")"); } - if (!name.IsEmpty() && lstMembers->FindItem(-1, name, false) == -1) + if (!name.IsEmpty()) { size_t pos = lstMembers->GetItemCount(); lstMembers->InsertItem(pos, name, 0);
-- Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgadmin-hackers