Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: TComboBox causes TWebBrowser to fail - conflict?


This question is not answered. Helpful answers available: 1. Correct answers available: 1.


Permlink Replies: 8 - Last Post: Feb 23, 2018 12:29 PM Last Post By: Nikolay Lyan
Cascade S

Posts: 4
Registered: 9/29/16
TComboBox causes TWebBrowser to fail - conflict?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 15, 2016 3:48 AM
When I place a TComboBox and a TWebBrowser control on a form, the WebBrowser fails when the ComboBox menu drops down, and never fully recovers. Closing the app then results in an Access Violation error. What am I doing wrong?

Steps:
1. Add a ComboBox to an FMX form, and give it a few items (e.g. item1,item2).
2. Add a WebBrowser to the same form, and set its URL property to https://www.embarcadero.com
3. Add a Button to the form and set its OnClick handler as follows:

WebBrowser1.EvaluateJavascript('alert("Hello World");');

Run the app. The WebBrowser loads the requested URL as expected. Click the Button, and the alert message "Hello World" appears. OK so far.

Click the ComboBox so its dropdown menu of items appears. Notice that the WebBrowser immediately fails, blanking out to a white rectangle. Close the dropdown menu. The WebBrowser appears to recover, rendering the web page once more. However it is damaged and no longer responds to commands: click the Button, the alert message fails to appear. Attempt to close the app - Access Violation.

Is it possible to have a ComboBox and a WebBrowser on the same form? I've tried switching the ComboBox style between Platform and Custom, in case there's some kind of conflict with two native controls, but it makes no difference.

Delphi 10.1 Berlin Starter Edition, Windows 10.
Robert Triest

Posts: 687
Registered: 3/24/05
Re: TComboBox causes TWebBrowser to fail - conflict?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 15, 2016 5:15 AM   in response to: Cascade S in response to: Cascade S
I've seen this in Win32 app's also. There are problems when putting a TWebbrowser on a PageControl.
When the WebBrowser looses focus things can go weird. I don't know if this is related to FireMonkey also..
Take a look if you find some clue by : Webbrowser.HandleNeeded();
http://qc.embarcadero.com/wc/qcmain.aspx?d=100965
(message Daniel Frimerman at 8/7/2012 3:42:29 AM - on that page)
Markus Humm

Posts: 5,113
Registered: 11/9/03
Re: TComboBox causes TWebBrowser to fail - conflict?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 15, 2016 10:46 AM   in response to: Cascade S in response to: Cascade S
Am 15.09.2016 um 12:48 schrieb Cascade S:
When I place a TComboBox and a TWebBrowser control on a form, the WebBrowser fails when the ComboBox menu drops down, and never fully recovers. Closing the app then results in an Access Violation error. What am I doing wrong?

Steps:
1. Add a ComboBox to an FMX form, and give it a few items (e.g. item1,item2).
2. Add a WebBrowser to the same form, and set its URL property to https://www.embarcadero.com
3. Add a Button to the form and set its OnClick handler as follows:

WebBrowser1.EvaluateJavascript('alert("Hello World");');

Run the app. The WebBrowser loads the requested URL as expected. Click the Button, and the alert message "Hello World" appears. OK so far.

Click the ComboBox so its dropdown menu of items appears. Notice that the WebBrowser immediately fails, blanking out to a white rectangle. Close the dropdown menu. The WebBrowser appears to recover, rendering the web page once more. However it is damaged and no longer responds to commands: click the Button, the alert message fails to appear. Attempt to close the app - Access Violation.

Is it possible to have a ComboBox and a WebBrowser on the same form? I've tried switching the ComboBox style between Platform and Custom, in case there's some kind of conflict with two native controls, but it makes no difference.

Delphi 10.1 Berlin Starter Edition, Windows 10.

Can you report that into quality.embarcadero.com, best would be with a
simplistic sample app.

Greetings

Markus
Cascade S

Posts: 4
Registered: 9/29/16
Re: TComboBox causes TWebBrowser to fail - conflict?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 21, 2016 3:53 AM   in response to: Markus Humm in response to: Markus Humm
Thanks for the replies. I've just noticed Update 1 is now available for Delphi 10.1 Berlin - and fixes for TWebBrowser are listed, so there's a possibility this has been addressed.

However I'm not sure whether Update 1 is available for the Starter Edition?
Eli M

Posts: 1,346
Registered: 11/9/13
Re: TComboBox causes TWebBrowser to fail - conflict?
Helpful
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 28, 2016 9:44 PM   in response to: Cascade S in response to: Cascade S
There is a new Starter edition available with the newest Update. You might have to register for it again though.
Cascade S

Posts: 4
Registered: 9/29/16
Re: TComboBox causes TWebBrowser to fail - conflict?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 3, 2016 1:53 PM   in response to: Eli M in response to: Eli M
Thank you!

After a quick test, it seems Update 1 has partially fixed the issue. Dropping down any ComboBox causes the WebBrowser to blank out then reload its current web page - which is slightly frustrating. However the WebBrowser does recover once the ComboBox is closed, and no longer gives an Access Violation when the application in closed.

I wonder if there's any way to stop the WebBrowser reloading the web page whenever a ComboBox is clicked?

Eli M wrote:
There is a new Starter edition available with the newest Update. You might have to register for it again though.

Edited by: Cascade S on Oct 3, 2016 1:58 PM
William Kuipers

Posts: 1
Registered: 11/13/08
Re: TComboBox causes TWebBrowser to fail - conflict?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 22, 2017 9:11 AM   in response to: Cascade S in response to: Cascade S
I change the WebBrowsers parent before and after loading html:
// Very clumsy method to avoid unwanted refresh of WB!!!
wb->Parent = this;
wb->URL = fn; // no trouble with base URL
// this helps to avoid unwante refresh when other controlls repaint:
wb->Parent = NULL;
Regards,

Cascade S wrote:
When I place a TComboBox and a TWebBrowser control on a form, the WebBrowser fails when the ComboBox menu drops down, and never fully recovers. Closing the app then results in an Access Violation error. What am I doing wrong?

Steps:
1. Add a ComboBox to an FMX form, and give it a few items (e.g. item1,item2).
2. Add a WebBrowser to the same form, and set its URL property to https://www.embarcadero.com
3. Add a Button to the form and set its OnClick handler as follows:

WebBrowser1.EvaluateJavascript('alert("Hello World");');

Run the app. The WebBrowser loads the requested URL as expected. Click the Button, and the alert message "Hello World" appears. OK so far.

Click the ComboBox so its dropdown menu of items appears. Notice that the WebBrowser immediately fails, blanking out to a white rectangle. Close the dropdown menu. The WebBrowser appears to recover, rendering the web page once more. However it is damaged and no longer responds to commands: click the Button, the alert message fails to appear. Attempt to close the app - Access Violation.

Is it possible to have a ComboBox and a WebBrowser on the same form? I've tried switching the ComboBox style between Platform and Custom, in case there's some kind of conflict with two native controls, but it makes no difference.

Delphi 10.1 Berlin Starter Edition, Windows 10.
Markus Humm

Posts: 5,113
Registered: 11/9/03
Re: TComboBox causes TWebBrowser to fail - conflict?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 23, 2017 9:02 AM   in response to: William Kuipers in response to: William Kuipers
Am 22.02.2017 um 18:11 schrieb William Kuipers:
I change the WebBrowsers parent before and after loading html:
// Very clumsy method to avoid unwanted refresh of WB!!!
wb->Parent = this;
wb->URL = fn; // no trouble with base URL
// this helps to avoid unwante refresh when other controlls repaint:
wb->Parent = NULL;
Regards,

Cascade S wrote:
When I place a TComboBox and a TWebBrowser control on a form, the WebBrowser fails when the ComboBox menu drops down, and never fully recovers. Closing the app then results in an Access Violation error. What am I doing wrong?

Steps:
1. Add a ComboBox to an FMX form, and give it a few items (e.g. item1,item2).
2. Add a WebBrowser to the same form, and set its URL property to https://www.embarcadero.com
3. Add a Button to the form and set its OnClick handler as follows:

WebBrowser1.EvaluateJavascript('alert("Hello World");');

Run the app. The WebBrowser loads the requested URL as expected. Click the Button, and the alert message "Hello World" appears. OK so far.

Click the ComboBox so its dropdown menu of items appears. Notice that the WebBrowser immediately fails, blanking out to a white rectangle. Close the dropdown menu. The WebBrowser appears to recover, rendering the web page once more. However it is damaged and no longer responds to commands: click the Button, the alert message fails to appear. Attempt to close the app - Access Violation.

Is it possible to have a ComboBox and a WebBrowser on the same form? I've tried switching the ComboBox style between Platform and Custom, in case there's some kind of conflict with two native controls, but it makes no difference.

Delphi 10.1 Berlin Starter Edition, Windows 10.

Hello,

1. is there a QP report for this issue? if not go ahead to
quality.embarcadero,com and create one
2. add your solution to it
3. please put your answers below the text you're answering to in the
furture as this is being considered norm here. This is not Newsgroup.

Greetings

Markus
Nikolay Lyan

Posts: 1
Registered: 5/20/13
Re: TComboBox causes TWebBrowser to fail - conflict?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 23, 2018 12:27 PM   in response to: Markus Humm in response to: Markus Humm
Markus Humm wrote:
Am 22.02.2017 um 18:11 schrieb William Kuipers:
I change the WebBrowsers parent before and after loading html:
// Very clumsy method to avoid unwanted refresh of WB!!!
wb->Parent = this;
wb->URL = fn; // no trouble with base URL
// this helps to avoid unwante refresh when other controlls repaint:
wb->Parent = NULL;
Regards,

Cascade S wrote:
When I place a TComboBox and a TWebBrowser control on a form, the WebBrowser fails when the ComboBox menu drops down, and never fully recovers. Closing the app then results in an Access Violation error. What am I doing wrong?

Steps:
1. Add a ComboBox to an FMX form, and give it a few items (e.g. item1,item2).
2. Add a WebBrowser to the same form, and set its URL property to https://www.embarcadero.com
3. Add a Button to the form and set its OnClick handler as follows:

WebBrowser1.EvaluateJavascript('alert("Hello World");');

Run the app. The WebBrowser loads the requested URL as expected. Click the Button, and the alert message "Hello World" appears. OK so far.

Click the ComboBox so its dropdown menu of items appears. Notice that the WebBrowser immediately fails, blanking out to a white rectangle. Close the dropdown menu. The WebBrowser appears to recover, rendering the web page once more. However it is damaged and no longer responds to commands: click the Button, the alert message fails to appear. Attempt to close the app - Access Violation.

Is it possible to have a ComboBox and a WebBrowser on the same form? I've tried switching the ComboBox style between Platform and Custom, in case there's some kind of conflict with two native controls, but it makes no difference.

Delphi 10.1 Berlin Starter Edition, Windows 10.

Hello,

1. is there a QP report for this issue? if not go ahead to
quality.embarcadero,com and create one
2. add your solution to it
3. please put your answers below the text you're answering to in the
furture as this is being considered norm here. This is not Newsgroup.

Greetings

Markus

I tried your solution, WebBrowser does not refresh anymore, yep, but after popup of a ComboBox it fails in a different way — now you can't interact with it before you change the parent back, and when you do it, it immediately refreshes.
Sorry Markus, I replied to you mistakely, my reply is for William Kuipers.

Edited by: Nikolay Lyan on Feb 23, 2018 12:29 PM

Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02