I want to show a document (here: a PDF) within a TWebBrowserControl on a PopUp-Form. I created the popup form like so:
object ShowPDFForm: TShowPDFForm
Width = 640
Height = 480
Caption = 'PDF-Anzeige'
CSSLibrary = cssBootstrap
ElementFont = efCSS
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -15
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = False
OnShow = WebFormShow
object WB: TWebBrowserControl
Left = 0
Top = 0
Width = 640
Height = 480
Sandbox = []
end
end
Type
TShowPDFForm = Class(TWebForm)
WB : TWebBrowserControl;
Procedure WebFormShow(Sender: TObject);
Private
Public
PDFURL : String;
End;
Procedure TShowPDFForm.WebFormShow(Sender : TObject);
Begin
Self.Caption := 'PDF-Anzeige';
WB.URL := PDFURL;
End;
To show this form as a modal sizeable popup, I do this:
Procedure TMainForm.BtnViewDocClick(Sender: TObject);
Var PDFForm: TShowPDFForm;
Begin
PDFForm := TShowPDFForm.Create(Nil);
PDFForm.Popup := True;
PDFForm.Border := fbDialogSizeable;
PDFForm.PDFURL := BlobURL;
TAwait.ExecP<TModalResult>(PDFForm.Execute);
When executed, this shows a modal popup form, but unfortunately the form is empty. Well, after a closer look, it's not exactly empty. Because when dragging the caption bar of the popup form, suddenly the document unlurks from "behind" the popup form, "sticking" to the mouse pointer and can be moved around.
Tried this with all desktop browsers with the same result.
This picture shows the "dragged" document behind the popup. Hope it makes sense.
As a side note: The popup form also does not show the Caption, which was set to show the string "PDF-Anzeige" both at design time and runtime.
The question obviously is: How can I display the document "within" the popup form and not "behind" it?