?
Solved

Custom OpenDialog View Style

Posted on 2003-02-21
8
Medium Priority
?
733 Views
Last Modified: 2010-04-04
Does anybody know how can I change the default view style of an OpenDialog to another style?

Thanks in advance,
Kambiz
0
Comment
Question by:kambiz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 2

Expert Comment

by:ferhad
ID: 7996424
You should set "ofOldStyleDialog" property into "True" and it will change its vie into old style
Hope i understood you true and help you
Regards Ferhad
0
 
LVL 2

Expert Comment

by:ferhad
ID: 7996437
You can change this property from Object Inspector Options/ofOldStyleDialog
0
 
LVL 2

Author Comment

by:kambiz
ID: 7998424
Thanks Ferhad for the comment.

I didn't ask my question clearly and I apologize. I want to change the view style of the ListView of the OpenDialog. In Delphi expression, the default view style of the ListView is vsList but I need to change it to vsIcons.

I wrote the following function for this purpose. The ListView handle obtains properly and the code for changing the style seems to be okay, however it doesn't change the view style. Can you please figure out the problem?

uses
  ComCtrls, CommCtrl, Dlgs;

function SetFileDialogViewStyle(OpenDialog: THandle; ViewStyle: TViewStyle): Boolean;
const
  ViewStyles: array[TViewStyle] of Integer =
    (LVS_ICON, LVS_SMALLICON, LVS_LIST, LVS_REPORT);
var
  ListView: THandle;
  Style: LongInt;
begin
  Result := False;
  ListView := GetDlgItem(GetWindow(GetDlgItem(GetParent(OpenDialog), lst1), GW_HWNDPREV), 1);
  if ListView <> 0 then
  begin
    Style := GetWindowLong(ListView, GWL_STYLE);
    Style := Style and (not LVS_TYPEMASK);
    Style := Style or ViewStyles[ViewStyle];
    SetWindowLong(ListView, GWL_STYLE, Style);
    Result := True;
  end;
end;

By the way, the above function should be call after OpenDialog.OnShow event, because before that, ListView (actually its parent) is not created yet.

Kambiz

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Author Comment

by:kambiz
ID: 7998440
Oops! In the above code, GW_HWNDPREV should be GW_HWNDNEXT. It was a mistake in writing the code in the comment, anyway the problem is still there.
0
 

Expert Comment

by:CleanupPing
ID: 9317139
kambiz:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
LVL 2

Author Comment

by:kambiz
ID: 9318763
CleanupPing:

Nobody has answered the question yet. And, seems nobody is going to do that.
I would be grateful if you remove this question.

Thanks in advance.
0
 
LVL 10

Expert Comment

by:kacor
ID: 9947831
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area for this question:
       the answers contains useful information, it would be mistake to delete,
       PAQ and refund points
Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Some days and here is the Christmas Time. I wish good luck and good health for you all and for your loved ones

kacor
EE Cleanup Volunteer
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 9989826
PAQed, with points refunded (100)

modulo
Community Support Moderator
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

766 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question