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.

Strange problem with TCEFWindowParent

Post Reply
donatop
Posts: 5
Joined: Sun Jul 12, 2020 9:36 am

Strange problem with TCEFWindowParent

Post by donatop »

i have written a VCL application with a form in which i have TChromium component and TCEFWindowParent. I have exactly copied all procedures and events fromthe SimpleBrowser2 demo and all works well except for a strange behaviour when the application starts.

The form is designed with
Position := poScreenCenter
WindowState := wsNormal

The TCEFWindowParent is placed in a Panel aligned to the Form, but the size of TCEFWindowParent at design time is NOT aligned to the father panel and has a specific size (just for my decision).

Once the application is started i add the following two lines of code in the FormShow function:
crmWindow.Align := alClient; // crmWindow is TCEFWindowParent component
crmWindow.Visible := true;
FrmPortale.WindowState := wsMaximized; //FrmPortale is the form

At this point the form is showed on the screen and it appears maximized, but the TCEFWindowParent has the strange behaviour you may see in the attached image. A blank screen is showed aligned to the form, but the requested page is showed in a corner.

If i minimize the application and maximize it again the page is showed correctly.

The behaviour doesn't change if at design time i place the TCEFWindowParent aligned to the father panel/form already.

Do you have idea the reason for this behaviour ?
You do not have the required permissions to view the files attached to this post.
User avatar
salvadordf
Posts: 4016
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Strange problem with TCEFWindowParent

Post by salvadordf »

TCEFWinControl overrides the "Resize" procedure to update the browser contents to the new TCEFWindowParent size but perhaps it needs to be visible in order to have some real effect.

You can try a couple of solutions :
  • Try changing the order in your code : Set crmWindow.Visible first and then set crmWindow.Align.
  • Leave the code order as it is but try calling crmWindow.UpdateSize manually when the crmWindow has the final size.
donatop
Posts: 5
Joined: Sun Jul 12, 2020 9:36 am

Re: Strange problem with TCEFWindowParent

Post by donatop »

It seems to be resolved with UpdateSize.

thank you.

Donato.
Post Reply