Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 6 of 6 total
Thread TBrowser OnLoad Problem
Wed, Aug 19 2015 4:14 PMPermanent Link

squiffy

Telemix Ltd.

Avatar

I can't seem to attach an OnLoad handler to  a TBrowser control programmatically. It's fine if I add it to the properties in the visual designer but it just doesn't seem to fire if I add it in code.

Reason is I want to create a TBrowser control to receive the response from a submitted form, but I don't see the need to have a visual control on the from itself.

No big thing - I've just dropped on on there and made it invisible - but should I be able to do programmatically create one and attach the handler in code?
Thu, Aug 20 2015 12:35 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

<< No big thing - I've just dropped on on there and made it invisible - but should I be able to do programmatically create one and attach the handler in code? >>

Sure, there is absolutely no difference between the two at runtime.  Are you sure that you're doing things correctly in your code ?  If you send me a sample, I can check it out.

Tim Young
Elevate Software
www.elevatesoft.com
Wed, Sep 2 2015 3:38 AMPermanent Link

squiffy

Telemix Ltd.

Avatar

Sorry for the delay in responding - attached is a working (broken?) example.

Clicking the form button fires the onUnload event, but the onLoad never fires.
This seems to work when I drag a browser onto the form.



Attachments: browser-onload-test.zip
Wed, Sep 2 2015 4:03 AMPermanent Link

squiffy

Telemix Ltd.

Avatar

Sorry - ignore that example. I zipped the wrong project.

See attached.
I have added a visual browser control (Browser2) to the form.
If you swap out Browser1 for Browser2 in the code it works, but Browser1 nothing fires.

What have I done wrong?



Attachments: browser-load-test-2.zip
Thu, Sep 3 2015 3:21 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

<< See attached. >>

Okay, three things:

1) There's a bug in your code, but the compiler isn't catching it:

procedure TForm1.Form1Create(Sender: TObject);
begin
  Browser1:=TBrowser.Create(TForm1);  <<<<<< TForm1 is a class, not a class instance
end;

2) You need to assign a name to the Browser1 control.  The name is used to hook up the HTML form to the control for output.

procedure TForm1.Form1Create(Sender: TObject);
begin
  Browser1:=TBrowser.Create(Form1);
  Browser1.Name:='TestBrowser';
end;

3) Even after all that, there's still a bug in the underlying frame element in the EWB UI layer that will prevent proper operation, and that's been fixed for B3.

Thanks,

Tim Young
Elevate Software
www.elevatesoft.com
Mon, Sep 7 2015 1:43 PMPermanent Link

squiffy

Telemix Ltd.

Avatar

Thanks, Tim.
Image