Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder Public Beta Tests » View Thread |
Messages 1 to 3 of 3 total |
TImageElement onLoad event.. |
Wed, May 6 2020 7:59 AM | Permanent Link |
R&D team @ Environment Canada | Hi
I'm having trouble compiling a small test project where I try to assign an event handler to TImageElement.onLoad. Below is a sample project which compiles in EWB v2, but gives an error in EWB v3. Note in particular the line: imgTemp.OnLoad := onLoadImage; gives an error: "Expected a variable, parameter, constant, property, or type reference, instead found onLoadImage" ////////////////// sample project below ////////////// unit Unit1; interface uses WebCore, WebUI, WebForms, WebCtrls, WebBtns, WebPaint, WebDom; type TForm1 = class(TForm) Button1: TButton; Paint1: TPaint; procedure Button1Click(Sender: TObject); procedure onLoadImage(sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation procedure TForm1.Button1Click(Sender: TObject); var imgTemp: TImageElement; begin imgTemp := TImageElement.create('',nil,HTML_TAG_IMG); imgTemp.URL := 'apple.png'; imgTemp.OnLoad := onLoadImage; end; procedure Tform1.onLoadImage(sender: TObject); begin // do something with the image.. end; end. |
Wed, May 6 2020 4:30 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | << I'm having trouble compiling a small test project where I try to assign an event handler to TImageElement.onLoad.
Below is a sample project which compiles in EWB v2, but gives an error in EWB v3. >> This is the probably a case of the EWB 2 compiler being "not so great". The signature for the TImageElement.OnLoad event type is this: TWebElementEvent = procedure (AElement: TWebElement) of object; (WebUI unit) This is the fixed source code: unit Unit1; interface uses WebCore, WebUI, WebForms, WebCtrls, WebBtns, WebPaint, WebDom; type TForm1 = class(TForm) Button1: TButton; Paint1: TPaint; procedure Button1Click(Sender: TObject); procedure onLoadImage(AElement: TWebElement); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation procedure TForm1.Button1Click(Sender: TObject); var imgTemp: TImageElement; begin imgTemp := TImageElement.create('',nil,HTML_TAG_IMG); imgTemp.URL := 'apple.png'; imgTemp.OnLoad := onLoadImage; end; procedure TForm1.onLoadImage(AElement: TWebElement); begin // do something with the image.. end; end. Tim Young Elevate Software www.elevatesoft.com |
Wed, May 6 2020 5:13 PM | Permanent Link |
R&D team @ Environment Canada | Thanks Tim!
.. Bruno procedure TForm1.onLoadImage(AElement: TWebElement); begin // do something with the image.. end; end. Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Friday, March 29, 2024 at 03:30 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |