Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 6 of 6 total |
Calling a published event |
Wed, Mar 13 2019 2:40 PM | Permanent Link |
Matthew Jones | Here's an odd one. I wanted to call the OnCloseQuery of a form, if it has one. I don't want to actually close it. But I can't, it seems, just call it directly. Any reason why?
procedure TfrmAdminWelcome.ConfirmClose; var Sender: TObject; bClose : Boolean; xEvent : TCloseQueryEvent; // = function (Sender: TObject): Boolean of object; begin if assigned(m_xActiveForm) then begin if (assigned(m_xActiveForm.OnCloseQuery)) then begin // this version works - I copy it to a local and can call it xEvent := m_xActiveForm.OnCloseQuery; bClose := xEvent(self); if not bClose then raise Exception; // these versions won't compile // bClose := TForm(m_xActiveForm).OnCloseQuery(self); // if (not m_xActiveForm.OnCloseQuery()) then // Abort; end; end; end; It's not critical, I'd just like to understand it. -- Matthew Jones |
Wed, Mar 13 2019 8:22 PM | Permanent Link |
Raul Team Elevate | On 3/13/2019 2:40 PM, Matthew Jones wrote:
> Here's an odd one. I wanted to call the OnCloseQuery of a form, if it has one. I don't want to actually close it. But I can't, it seems, just call it directly. Any reason why? .... > It's not critical, I'd just like to understand it. > Why not just call Close ? As long as your OnCloseQuery returns false it should not actually close. Otherwise i think this is because this is an internal implementation. More interesting question is why would you want to call it direct to begin with !? Raul |
Thu, Mar 14 2019 12:39 AM | Permanent Link |
Raul Team Elevate | On 3/13/2019 8:22 PM, Raul wrote:
> Otherwise i think this is because this is an internal implementation. Never mind - i totally misread the question. It looks like a limitation of the compiler. m_xActiveForm.OnCloseQuery should be callable IMHO - i suspect due to it being a property so it's not resolving to TCloseQueryEvent properly but need Tim to answer this one as as its pure speculation. Raul |
Thu, Mar 14 2019 1:44 AM | Permanent Link |
ooptimum | It's shortcoming of the compiler. I first encountered it when I tried to skip calling of inherited constructor in a class constructor and call a constructor of a predecessor of the class ancestor, i.e. instead of calling
inherited Create; call to TAncestorsPredecessor.Create; |
Thu, Mar 14 2019 4:35 AM | Permanent Link |
Matthew Jones | Raul wrote:
> It looks like a limitation of the compiler. Indeed, so long as it isn't me being daft. 8-) Thanks both. -- Matthew Jones |
Thu, Mar 21 2019 11:03 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Matthew,
<< Here's an odd one. I wanted to call the OnCloseQuery of a form, if it has one. I don't want to actually close it. But I can't, it seems, just call it directly. Any reason why? >> I know that this thread is old, but for the record, EWB 3's compiler won't have issues like this anymore. I've taken the time to re-do the front-end of the compiler, also, and I've fixed various issues with symbol resolution, as well as more esoteric things like this where the current compiler has a hard time: calling method properties, calling method instances that are returned from other functions/methods, or calling method instances that are stored in arrays. Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Wednesday, June 12, 2024 at 01:54 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |