Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to programmatically change the size of the TOpenDialog window Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
21-Oct-02
Category
Dialogs
Language
Delphi 2.x
Views
263
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Jonas Bilinkevicius

Is there a way to programmatically change the size of the TOpenDialog window so 
that more files will be shown? In Win98, the user can drag the dialog window to 
increase its size. Can the window size be increased under program control?

Answer:

The OnShow event seems to be a bit too early to do it. It has to be delayed a bit. 
Like this:

1   type
2     TForm1 = class(TForm)
3       Button1: TButton;
4       OpenDialog1: TOpenDialog;
5       procedure Button1Click(Sender: TObject);
6       procedure OpenDialog1Show(Sender: TObject);
7     private
8       { Private declarations }
9       procedure MoveDialog(var Msg: TMessage); message WM_USER;
10    public
11      { Public declarations }
12    end;
13  
14  var
15    Form1: TForm1;
16  
17  implementation
18  
19  {$R *.DFM}
20  
21  procedure TForm1.Button1Click(Sender: TObject);
22  begin
23    if OpenDialog1.Execute then
24      Caption := OpenDialog1.FileName;
25  end;
26  
27  procedure TForm1.OpenDialog1Show(Sender: TObject);
28  begin
29    PostMessage(Self.Handle, WM_USER, 0, 0);
30  end;
31  
32  function GetDesktopWorkArea: TRect;
33  begin
34    if not SystemParametersInfo(SPI_GETWORKAREA, 0, @Result, 0) then
35      Result := Rect(0, 0, Screen.Width, Screen.Height);
36  end;
37  
38  procedure TForm1.MoveDialog(var Msg: TMessage);
39  var
40    rec: TRect;
41    wh: HWND;
42    l, t, r, b: Integer;
43  begin
44    wh := Windows.GetParent(OpenDialog1.Handle);
45    {if GetWindowRect(wh, rec) then}
46    if IsWindow(wh) then
47    begin
48      rec := GetDesktopWorkArea;
49      l := rec.Left;
50      t := rec.Top;
51      r := rec.Right;
52      b := rec.Bottom;
53      MoveWindow(wh, l, t, r, b, True);
54    end;
55  end;


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC