Reputation: 6782
I have TWebBrowser embedded in a TForm. Whenever I press Alt button the browser window becomes white. If I drag the form around it repaints correctly.
What I am doing wrong?
I have DevExpress Bars and Quantum Grid if that matters?
I use Delphi 2010 and Windows 7 and XP SP2. IE version is 7 and 8. Reproducible on all.
Before pressing Alt:
After pressing Alt:
I have resolved it by usnig the following:
procedure TMainForm.WndProc(var Message: TMessage);
begin
inherited WndProc(Message);
if Message.Msg = WM_UPDATEUISTATE then
begin
if Assigned(ProblematicWebBrowser) then
ProblematicWebBrowser.Repaint;
end;
end;
Upvotes: 3
Views: 664
Reputation: 13590
You don't say what version of Delphi you're using, what version of Windows you're using, or what version of IE you have installed, which is what TWebBrowser wraps. (As a general note because you're a new user here, you really need to provide more information when asking a question like this. Pretend it was a user of your software reporting this bug - you'd throw your hands up and say "Bah, not reproduced. Why can't they tell me what they're doing?" Same for us when reading your question.)
But, that said, the fact it vanishes when you press the Alt key is a hint. Windows has an option to hide accelerator keys (the underline mark such as the underlined F on a File menu) until the user presses the Alt key. When it does, controls are sent a WM_DRAWITEM message indicating something's changed. See also WM_CHANGEUISTATE.
There have been bugs in past versions of Delphi handling this (see this example bug) including a bug where controls completely vanished when the Alt key was pressed. TWebBrowser isn't listed in that QC item, but it's quite possible it's affected.
So my guess is:
Solution: upgrade Delphi or apply the fix listed in the QC item.
Upvotes: 3
Reputation: 21650
FWIW, with a plain vanilla Form with a TWebBrowser in D2010, pressing Alt has not effect on the WebBrowser display.
Upvotes: 0