lcl: set PopupMode to pmAuto to fix problems with showing input/message/question dialogs to users from StayOnTop forms

win32: fix ShowModal of child forms which has WS_EX_TOPMOST parent

git-svn-id: trunk@28200 -
This commit is contained in:
paul 2010-11-13 09:12:04 +00:00
parent 06f15d8c61
commit 511b386b50
3 changed files with 10 additions and 2 deletions

View File

@ -41,6 +41,7 @@ begin
Form.CreateNew(nil, 0); Form.CreateNew(nil, 0);
with Form do with Form do
begin begin
PopupMode := pmAuto;
BorderStyle := bsDialog; BorderStyle := bsDialog;
Caption := InputCaption; Caption := InputCaption;
Position := poScreenCenter; Position := poScreenCenter;

View File

@ -182,6 +182,7 @@ begin
//debugln('TPromptDialog.CreateMessageDialog A ButtonCount=',dbgs(ButtonCount)); //debugln('TPromptDialog.CreateMessageDialog A ButtonCount=',dbgs(ButtonCount));
ControlStyle:= ControlStyle-[csSetCaption]; ControlStyle:= ControlStyle-[csSetCaption];
PopupMode := pmAuto;
BorderStyle := bsDialog; BorderStyle := bsDialog;
Position := poScreenCenter; Position := poScreenCenter;
SetInitialBounds(0,0,200,100); SetInitialBounds(0,0,200,100);
@ -794,7 +795,7 @@ var
IsDefault: Boolean; IsDefault: Boolean;
begin begin
inherited Create(nil); inherited Create(nil);
PopupMode := pmAuto;
BorderStyle := bsDialog; BorderStyle := bsDialog;
Position := poScreenCenter; Position := poScreenCenter;
MessageTxt := ConvertLineEndings(aMsg); MessageTxt := ConvertLineEndings(aMsg);

View File

@ -661,8 +661,14 @@ begin
end; end;
class procedure TWin32WSCustomForm.ShowModal(const ACustomForm: TCustomForm); class procedure TWin32WSCustomForm.ShowModal(const ACustomForm: TCustomForm);
var
Parent: HWND;
begin begin
BringWindowToTop(ACustomForm.Handle); Parent := GetParent(ACustomForm.Handle);
if (Parent <> 0) and (GetWindowLong(Parent, GWL_EXSTYLE) and WS_EX_TOPMOST <> 0) then
SetWindowPos(ACustomForm.Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE or SWP_NOSIZE)
else
BringWindowToTop(ACustomForm.Handle);
end; end;
class procedure TWin32WSCustomForm.SetAlphaBlend(const ACustomForm: TCustomForm; class procedure TWin32WSCustomForm.SetAlphaBlend(const ACustomForm: TCustomForm;