Skip to content
This repository has been archived by the owner on Sep 15, 2022. It is now read-only.

Commit

Permalink
Ensure a role is selected to reassign objects to before the user can …
Browse files Browse the repository at this point in the history
…click OK.
  • Loading branch information
akshay-joshi authored and dpage committed Aug 7, 2013
1 parent de460df commit 673f9ce
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pgadmin/dlg/dlgReassignDropOwned.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#define rbDrop CTRL_RADIOBUTTON("rbDrop")
#define cbRoles CTRL_COMBOBOX("cbRoles")
#define cbDatabases CTRL_COMBOBOX("cbDatabases")
#define btnOK CTRL_BUTTON("wxID_OK")

BEGIN_EVENT_TABLE(dlgReassignDropOwned, pgDialog)
EVT_RADIOBUTTON(XRCID("rbReassignTo"), dlgReassignDropOwned::OnChange)
Expand Down Expand Up @@ -71,6 +72,9 @@ dlgReassignDropOwned::dlgReassignDropOwned(frmMain *win, pgConn *conn,
cbDatabases->Append(databases.GetVal(wxT("datname")));
}
cbDatabases->SetSelection(0);

if(rbReassignTo->GetValue() && cbRoles->GetStrings().Count() <= 0)
btnOK->Disable();
}

dlgReassignDropOwned::~dlgReassignDropOwned()
Expand All @@ -93,6 +97,10 @@ void dlgReassignDropOwned::OnCancel(wxCommandEvent &ev)
void dlgReassignDropOwned::OnChange(wxCommandEvent &ev)
{
cbRoles->Enable(rbReassignTo->GetValue() && cbRoles->GetStrings().Count() > 0);
if(rbReassignTo->GetValue() && cbRoles->GetStrings().Count() <= 0)
btnOK->Disable();
else
btnOK->Enable();
}

wxString dlgReassignDropOwned::GetDatabase()
Expand Down

0 comments on commit 673f9ce

Please sign in to comment.