QCubed - A PHP5 rapid development MVC framework.
Home  |  Updates

Dialog

QDialogBox Error in 2.0

I am having an issue dynamically loading QPanels in a QDialogBox in QCubed version 2.0.1. When I click a control that triggers the QDialogBox the first time it renders properly, however when I close the QDialog and click a control to open it again the Dynamically loaded panel does not appear. After closing the second attempt and then clicking another control that triggers the panel the dynamic panel now appears again. Here is the simplified code. It is basically the same logic as the form drafts, except the edit panel is loaded into a QDialogBox rather than a QPanel. This code works in QCubed Version 1.1.2.

DialogTest.php

<?php
   
require_once('qcubed.inc.php'); 
   
    class
DialogTest extends QForm {       
        protected
$pnlTopLeft;
        protected
$pnlTopCenter;        
       
        protected
$pnlDialog;
        protected
$pnlEdit;

        protected function
Form_Create() {
          
           
$this->pnlDialog = new QDialogBox($this);
           
$this->pnlDialog->AutoRenderChildren = true;

           
$this->pnlTopLeft = new QPanel($this, 'TopLeft');
           
$this->pnlTopLeft->AutoRenderChildren = true;
           
           
$this->pnlTopCenter = new QPanel($this, 'TopCenter');
           
$this->pnlTopCenter->AutoRenderChildren = true;          
           
           
$this->pnlEdit = new QPanel($this->pnlDialog, 'pnlEdit');
           
$this->pnlEdit->Text = 'PnlEdit Rendered';
           
$this->pnlEdit->AutoRenderChildren = true;
           
           
$pnlCompliance = new UserListPanel($this->pnlTopCenter, 'SetEditPane', 'CloseEditPane');
           
$pnlCBC = new VendorListPanel($this->pnlTopLeft, 'SetEditPane', 'CloseEditPane');           
        }
        public function
CloseEditPane($blnUpdatesMade) {
           
// Close the Edit Pane                     
           
$this->pnlEdit->RemoveChildControls(true);
           
$this->pnlDialog->HideDialogBox();
        }

        public function
SetEditPane(QPanel $objPanel = null) {
           
$this->pnlEdit->RemoveChildControls(true);
            if (
$objPanel) {
               
$objPanel->SetParentControl($this->pnlEdit);
               
$this->pnlDialog->ShowDialogBox();
            } else {
               
$this->pnlDialog->HideDialogBox();
            }
        }
    }

   
DialogTest::Run('DialogTest');
?>

DialogTest.tpl.php

<?php
   
include('includes/configuration/header.inc.php');
   
$this->RenderBegin();
   
$this->pnlDialog->Render();
   
$this->pnlTopLeft->Render();
   
$this->pnlTopCenter->Render();
   
$this->RenderEnd();
    include(
'includes/configuration/footer.inc.php');
?>