Basically, I just wanted a QDialog with nameable buttons (at least two, but ideally a configurable number), and a way to register callbacks for when those buttons are hit.
Here's what I came up with:
<?php
protected function dlgConfirm_Create()
{
$this->dlgConfirm = new QDialogBox($this);
$this->dlgConfirm->Display = false;
$this->dlgConfirm->AutoRenderChildren = true;
$btnYes = new QButton($this->dlgConfirm);
$btnYes->Text = "Yes";
$btnYes->AddAction(new QClickEvent(), new QServerAction('btnYes_Click'));
$btnNo = new QButton($this->dlgConfirm);
$btnNo->Text = "No";
//nothing happens
$btnMaybe = new QButton($this->dlgConfirm, 'btnMaybe');
$btnMaybe->Text = "Maybe";
$btnMaybe->AddAction(new QClickEvent(), new QServerAction('btnMaybe_Click'));
}
public function btnYes_Click()
{
$this->dlgConfirm->HideDialog();
}
public function btnMaybe_Click()
{
//Don't give up that easily
$this->dlgConfirm->Text = "I mean it! Should I dissapear?";
$btnMaybe = $this->dlgConfirm->GetChildControl('btnMaybe');
$btnMaybe->Visible = false;
}
?>
