QdialogBox problem : Resize and Move
Wed, 07/20/2011 - 09:49
Hello all,
it's my first post on this forum,
i've a problem with qdialogBox, i wan't render qdialogBox without Resize and Move functionnalities, but don't work.
this is my qdialog class :
<?php
class FormulaireFournisseur extends QDialog
{
public $btnSave;
public $btnCancel;
// Object Variables
protected $strCloseCallback;
//Contrôles d'édition
protected $txtLibelle;
// Default Overrides
protected $blnMatteClickable = false;
protected $blnDisplay = false;
protected $blnMoveable = false;
protected $blnResizable = false;
protected $strTemplate = 'fournisseur_formulaire.tpl.php';
public function __construct($strCloseCallback, $objParentObject, $strControlId = null)
{
parent::__construct($objParentObject, $strControlId);
$this->strCloseCallback = $strCloseCallback;
// Définition des contrôles enfants
$this->txtLibelle=new QTextBox($this);
$this->txtLibelle->Required = true;
$this->txtLibelle->MaxLength = 200;
$this->txtLibelle->Width = 250;
$this->btnCancel = new QImageButton($this);
$this->btnCancel->ImageUrl = __VIRTUAL_DIRECTORY__ . __IMAGE_ANC__ . '/annuler.png';
$this->btnCancel->Width=20;
$this->btnCancel->Height=20;
$this->btnCancel->AddAction(new QClickEvent(), new QAjaxAction('btnCancel_Click'));
$this->btnCancel->CausesValidation = false;
$this->btnSave= new QImageButton($this);
$this->btnSave->ImageUrl = __VIRTUAL_DIRECTORY__ . __IMAGE_ANC__ . '/valider.png';
$this->btnSave->Width=20;
$this->btnSave->Height=20;
$this->btnSave->AddAction(new QClickEvent(), new QAjaxAction('btnCancel_Click'));
$this->btnSave->CausesValidation = false;
}
public function btnSave_Click()
{
}
public function btnCancel_Click()
{
}
public function ShowDialogBox()
{
parent::ShowDialogBox();
}
}
?>thanks for your help!
yero

Soluce : override QDialogBox :
<?php
class ANCDialogBox extends QDialogBox
{
public function GetShowDialogJavaScript()
{
$strOptions = 'autoOpen: false';
$strOptions .= ', modal: '.($this->blnModal ? 'true' : 'false');
if ($this->strTitle)
$strOptions .= ', title: "'.$this->strTitle.'"';
if ($this->blnResizable==false||$this->blnResizable==true)
$strOptions .= ', resizable: '.($this->blnResizable==false ? 'false' : 'true');
if ($this->blnMovable==false||$this->blnMovable==true)
$strOptions .= ', draggable: '.($this->blnMovable==false ? 'false' : 'true');
if ($this->strCssClass)
$strOptions .= ', dialogClass: "'.$this->strCssClass.'"';
if (null === $this->strWidth)
$strOptions .= ", width: 'auto'";
else if ($this->strWidth)
$strOptions .= ', width: '. $this->strWidth;
if (null === $this->strHeight)
$strOptions .= ", height: 'auto'";
else if ($this->strHeight)
$strOptions .= ', height: '. $this->strHeight;
$strParentId = $this->ParentControl ? $this->ParentControl->ControlId : $this->Form->FormId;
//move both the dialog and the matte back into the form, to ensure they continue to function
$strOptions .= sprintf(', open: function() { $j(this).parent().appendTo("#%s"); $j(".ui-widget-overlay").appendTo("#%s"); }', $strParentId, $strParentId);
return sprintf('$j(qc.getW("%s")).dialog({%s}); $j(qc.getW("%s")).dialog("open");', $this->strControlId, $strOptions, $this->strControlId);
}
}
?>
To hide close button in QdialogBox, place this in css :
.ui-dialog-titlebar-close{display: none;
}