Watch, Follow, &
Connect with Us

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


Welcome, Guest
Guest Settings
Help

Thread: TWebbrowser or TEdit unresponsive if additional form opened from main form



Permlink Replies: 0
Andreas Wegener

Posts: 25
Registered: 12/6/12
TWebbrowser or TEdit unresponsive if additional form opened from main form
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 12, 2017 1:02 PM
Hi Forum
Did you ever notice the following issue:

I have an application where I load a page in TWebbrowser.
I also have an additional TForm that opens, shows some info and can be closed by user.

As long I do not create the form I can open the web page and the page is shown correctly in TWebBrowser.
Touching my TEdit opens the keyboard.

If I create a new instance of my additional form, open the form and close it ,
the website is not shown anymore. TWebbrowser keeps blank.
Also the Tedit is not responsive (no keyboard shown) if clicked.

Good news at least for Berlin (10.1) i got a workaround for IOS and Android working.
Windows has no issues with that.

10.2 is totally messing up the layout if a TWebBrowser is on a form with buttons etc. so I can’t use the current version

TEdit is responsive again.
Trick is to call

Show() 


of the main form after hiding the info form to get TEdit responsive again.
A workaround for the TWebbrowser issue being unresponsive after form closes comes from Embarcadero support.
I can refresh the website after my info form has shown and closed

Thats what they suggested
There have always been issues with TWebBrowser and any other native controls where the TWebBrowser wants to be at the top of the z-order. The workaround is to make use of the CaptureBitmap() method create a bitmap, which can be loaded into a TImage that occupies the same area of screen as the TWebBrowser. You then set the visible property of the TWebBrowser to false and the visible property of the TImage to true. It is then possible to display the Form on top.

(crazy idea btw :-)) but it let me reload or open a webpage after my additional form is shown and closed again.

To have my TWebBrowser responsive again I modified the example an call

Show();
Image1->Visible = false;
WebBrowser1->Visible = true;


after the info form hides.

For that I delegated the OnHide Event of the Info form to a function in the main form to have access to all controls.
I create a new instance of my info form in the constructor of the main form
Hope this will be helpful for someone .
So here is the Code from the main form

- Button1 loads Web Site
- Button 2 opens a kind of info form with only a Close button

__fastcall TForm3::TForm3(TComponent* Owner)
	: TForm(Owner)
{
mJustAForm = new TJustAForm(this);
mJustAForm->OnHide= InfoFormHide;
}
//---------------------------------------------------------------------------
void __fastcall TForm3::Button1Click(TObject *Sender)
{
/*
Using goolge maps under Windows with TWebBrwoser  may require the folowing registry change
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION and add a new DWORD value. The name of the value is the name of the executable, ie WebBrowserTest.exe. The decimal value is 11001. When you have added this, the route will display the next time you run the app. You could add this registry value programatically, of course.
*/
this->WebBrowser1->Navigate("https://www.google.de");
 
}
//---------------------------------------------------------------------------
 
void __fastcall TForm3::Button2Click(TObject *Sender)
{
TBitmap* MapBitMap = WebBrowser1->CaptureBitmap();
Image1->Bitmap = MapBitMap;
WebBrowser1->Visible = false;
Image1->Visible = True;
mJustAForm->Show();
 
 
}
//---------------------------------------------------------------------------
 
void __fastcall TForm3::InfoFormHide(TObject *Sender)
{
Show();
Image1->Visible = false;
WebBrowser1->Visible = true;
}


The Info Form :
//---------------------------------------------------------------------------
__fastcall TJustAForm::TJustAForm(TComponent* Owner)
	: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TJustAForm::Button1Click(TObject *Sender)
{
 
Hide();
}


Edited by: Andreas Wegener on May 12, 2017 1:05 PM
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02