Please I need to execute a method after my panel has been successfully rendered but before my form exits. Is there a QPanel AfterRender Method? How do I go about this please.
but Agsel, I was thinking that the $blnDisplayOutput was to control whether the output is immediately rendered or returned. From your code, I see that you returned the rendered output from the parent::Render() call to the variable $strHtml. With that, is the $blnDisplayOutput variable not supposed to be false? Please clarify me on this.
Well, it's true. If $blnDisplayOutput is true, then html is printed to the output and nothing is returned, eg $strHtml = null. So, it might be somewhat clearer, if you checked the value of $blnDisplayOutput and return $strHtml only when there output should be returned. eg the last line of Render method should be:
<?php if (!$blnDisplayOutput) return $strHtml; ?>
parent::Render() will do printing for you if needed (if $blnDisplayOutput == true)
Hi, this is almost correct. However, writing your method as such causes the Override-At-Render functionality to stop working. The following works better...
public function Render($blnDisplayOutput = true) { $this->RenderHelper(func_get_args(), __FUNCTION__); $strHtml = parent::Render($blnDisplayOutput); $this->PostOps(); return $strHtml; }
you might do:
<?phpclass YourPanel extends QPanel {
...
public function Render($blnDisplayOutput = true) {
$strHtml = parent::Render($blnDisplayOutput);
$this->CallToYourMethod();
return $strHtml;
}
}
?>
Thanks agsel. Let me try this.
but Agsel, I was thinking that the $blnDisplayOutput was to control whether the output is immediately rendered or returned. From your code, I see that you returned the rendered output from the parent::Render() call to the variable $strHtml. With that, is the $blnDisplayOutput variable not supposed to be false? Please clarify me on this.
Regards Agsel.
Well, it's true. If $blnDisplayOutput is true, then html is printed to the output and nothing is returned, eg $strHtml = null. So, it might be somewhat clearer, if you checked the value of $blnDisplayOutput and return $strHtml only when there output should be returned. eg the last line of Render method should be:
<?phpif (!$blnDisplayOutput) return $strHtml;
?>
parent::Render() will do printing for you if needed (if $blnDisplayOutput == true)
Hi, this is almost correct. However, writing your method as such causes the Override-At-Render functionality to stop working. The following works better...
public function Render($blnDisplayOutput = true){
$this->RenderHelper(func_get_args(), __FUNCTION__);
$strHtml = parent::Render($blnDisplayOutput);
$this->PostOps();
return $strHtml;
}
I am most grateful for the touch up OOPMan. Thanks so so much.