?
Solved

Custom OpenDialog View Style

Posted on 2003-02-21
8
Medium Priority
?
803 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
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
Technology Partners: 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses
Course of the Month8 days, 13 hours left to enroll

621 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