Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.

BorderStyle changes aren't being handled

Post Reply
toma1
Posts: 2
Joined: Fri Dec 15, 2023 12:26 pm

BorderStyle changes aren't being handled

Post by toma1 »

Hi there. Firstly thank you to the creator for the wonderful work that has been done here. Being able to replace my old IE based web containers with native chromium features has been huge.

I do have a problem though that is affecting the components and I was wondering if there is a workaround/advice for this situation.

The components do not seem to handle 'BorderStyle' changes correctly.

The use case is that I have an webpage that forwards F11 key presses to my Delphi application. Delphi interprets this and then acts like a traditional browser would, going fullscreen. This worked fine with my old IE components.

To achieve this functionality, I use standard practise of changing the BorderStyle property to 'none' which removes borders from the app, and then sending a command via 'ShowWindowAsync' of 'SW_MAXIMIZE' to go fullscreen.

The components completely break and lose all visuals when this happens unfortunately. This can be recreated by changing the 'BorderStyle' property at all during runtime, after the window has been created.

I have attached a simple Delphi 7 test project (I assume due to simplicity it will also build in higher version also) that shows this in action. But really, just changing BorderStyle at all after the components have been created will trigger the problem.
You do not have the required permissions to view the files attached to this post.
User avatar
salvadordf
Posts: 4056
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: BorderStyle changes aren't being handled

Post by salvadordf »

Hi,

Delphi 7 calls RecreateWnd inside the TCustomForm.SetBorderStyle procedure and the browser thinks the application is closing.

This issue can be avoided reparenting the browser while you change the BorderStyle property. Read this for more information :
https://github.com/salvadordf/WebView4Delphi/issues/13
toma1
Posts: 2
Joined: Fri Dec 15, 2023 12:26 pm

Re: BorderStyle changes aren't being handled

Post by toma1 »

Thank you for your response. The advice found inside the link provided helped me a great deal.

Someone there had created 'ChangeParent' and 'RestoreParent' procedures that I have used as a base for how I handle F11 windows messages. This implementation has worked perfectly.

Thanks again and all the best.
Post Reply