Google Groups unterstützt keine neuen Usenet-Beiträge oder ‑Abos mehr. Bisherige Inhalte sind weiterhin sichtbar.

TOpenDialog Position ?

0 Aufrufe
Direkt zur ersten ungelesenen Nachricht

Alexander Mueller

ungelesen,
12.07.1999, 03:00:0012.07.99
an
This cant work as the dialog is closed when the program returns from
Execute. But unfortunately I also didnt get a solution. I tried to send
the dialog a WM_MOVE message but it ignored it. I think that the dialog
handle becomes valid when the dialog is executed and becomes invalid
when it is closed. So you would have to change the coordinates after
executing but before returning from execute. But these are just thoughts
;).

Alex

B&C wrote:
>
> Hi !
>
> How can I set the position of OpenDialog ? The following code doesn't
> work.
>
> with OpenDialog1 do begin Execute;
> SetWindowPos(Handle,HWND_NOTOPMOST,5,5,0,0,SWP_NOSIZE);
> end;
>
> Please send example. I think, I must use SendMessage to OpenDialog...
>
> Thanks for help.

KSG

ungelesen,
12.07.1999, 03:00:0012.07.99
an
The following solution was originally posted by Peter Below:

The problem here is that the VCL code responsible for centering the dialog is
executed after the DoShow method (which fires the OnShow event). You did not
mention where you have placed the code to change the window dimensions, but
with a standard TOpenDialog the following works in the OnShow event:

procedure TForm1.OpenDialog1Show(Sender: TObject);
var
r: TRect;
begin
with sender as topendialog do begin
GetWIndowRect( GetParent( handle ), r );
MOveWindow( GetParent( handle ),
10, 10, r.right-r.left,
r.bottom-r.top, true );
Abort;
end;
end;

The Abort prevents the WM_NOTIFY message that triggered the OnShow event from
reaching the dialogs original window proc, which would pass it to the
ExplorerHook function in dialogs.pas, which does the centering if the
notification is CBN_INITDONE.

B&C

ungelesen,
13.07.1999, 03:00:0013.07.99
an
Hi !

How can I set the position of OpenDialog ? The following code doesn't
work.

with OpenDialog1 do begin Execute;
SetWindowPos(Handle,HWND_NOTOPMOST,5,5,0,0,SWP_NOSIZE);
end;

Please send example. I think, I must use SendMessage to OpenDialog...

Thanks for help.


B&C

ungelesen,
13.07.1999, 03:00:0013.07.99
an
many thanks, it works correctly now ;-)

B&C


0 neue Nachrichten