Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 3 of 3 total |
Problem using a variant |
Wed, Aug 2 2017 4:49 AM | Permanent Link |
Michael Dreher | I've a TButtonComboBox on a form for font selection and setup the OnChange event handler.
procedure TForm1.Form1Show(Sender: TObject); begin cbFont.ItemIndex := 0; cbFont.OnChange := OnFontChange; end; procedure TForm1.OnFontChange(sender : TObject); var v : variant; begin v := cbFont.OnChange; // (*) cbFont.OnChange := NIL; // disable handler // do something... cbFont.OnChange := v; // restore handler; end; On runtime the effect is a "to much recursion" or "not enough stack space". The reason is (*) is compiled to a function call. // main_tform1.$p.tform1_onfontchange = function(sender) // { // var $t = this, v; // v = $t.tform1_cbfont.tbindablecolumncontrol_fonchange(); <<--function call, should be a reference // $t.tform1_cbfont.tbindablecolumncontrol_fonchange = null; // $t.tform1_cbfont.tbindablecolumncontrol_fonchange = v; // }; I'm now using type TNotifyEvent instead of variant and the JavaScript is correct. Example code in the attachment. Michael Dreher Attachments: Example.zip |
Thu, Aug 3 2017 10:37 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Michael,
<< On runtime the effect is a "to much recursion" or "not enough stack space". The reason is (*) is compiled to a function call. >> Okay, I'll check it out. Tim Young Elevate Software www.elevatesoft.com |
Tue, Sep 12 2017 12:32 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Michael,
I'm putting together 2.06 B6 right now, and I'm going to have to hold off on implementing any fixes for this issue for now. The primary reason is that there are limitations to what can be done with variants at the compiler level, especially with respect to method/function/procedure references. There are situations where the compiler simply cannot figure out what to do with such types because there is insufficient information. This isn't one of those cases, but the fact that there exist such cases gives me pause about recommending or allowing such constructs in the code, so I may simple turn them off and have the compiler issue a compilation error. Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Friday, December 6, 2024 at 05:39 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |