Welcome
Contents of ctFile

  The ctFile object is a control used to activate the file common dialogue window.

The control is used to activate the FileOpen and FileSave common dialogue boxes. The dialogue boxes allow the user to search, select, or set up a name of a file that is to be opened or saved.

This control is invisible in an EXE file. It will still be visible and accessible during development time.

File Names

Control File	: CTFILE.OCX

License File 	: ctFile.lic

Class Name

CCtFileCtrl

See Also :

Events

Methods

Properties

ctFile © 2001,  Gamesman Inc.


Events

ctFile Event	Occurs
Cancel	Occurs when the Cancel button on the dialogue is pressed.
Help	Occurs when the Help button on the dialogue is pressed.
OK	Occurs when the OK button on the dialogue is pressed.


Methods

ctFile Method	Return Type	Description
ShowOpen	boolean	Initiates the FileOpen common dialogue box.
ShowSave	boolean	Initiates the FileSave common dialogue box.


Properties

ctFile Property	Data Type	Description
AllowMultiSelect	boolean	Specifies whether or not multiple files can be chosen from the dialogue box.
DialogueLeft	integer	Specifies the initial horizontal coordinate position of the box.
DialogueTop	integer	Specifies the initial vertical coordinate position of the box.
DlgTitle	string	Specifies the text to place in the title of the dialogue. Any text placed here will override the default text used by the dialogue.
Explorer	boolean	Specifies whether or not the dialogue will be displayed in the Windows 95 explorer style.
FileCount	integer	Retrieves the total amount of selected files from the dialog.
FileExt	string	Retrieves the name of the file extension in the dialogue.
FileName	string	Retrieves the name of the file in the dialogue.
FileTitle	string	Specifies the name of the file to be opened or saved.
Filter	string	Specifies the filter conditions from which only files with certain extensions will be displayed.
HideReadOnly	boolean	Specifies whether or not the Read Only check box will be displayed within the file dialogue box.
InitialDir	string	Specifies the full path of the initial directory for the dialog box.
MultiPathName	string	Retrieves the full name of a file selected from a list of multiple selected files.
OverWritePrompt	boolean	Specifies whether or not the user will be prompted to continue if an attempt is made to save a file that already exists.
Owner	Long (handle)	Specifies the Windows handle describing the owner of the dialogue.
PathName	string	Retrieves the full name of the file in the dialogue.
Position	integer (enumerated)	Specifies how the dialogue will be positioned when it becomes visible. Valid values include ... • 0 - Default • 1 - Defined  • 2 - Center
ShowHelp	boolean	Specifies whether or not the Help button is displayed in the dialogue box.


AllowMultiSelect
AllowMultiSelect Property

Description

Specifies whether or not multiple files can be chosen from the dialogue box. Multiple file paths and names can be retrieved using the MultiPathName property.

Syntax

[form.]ctFile.AllowMultiSelect [ = { True | False } ]

Data Type

Boolean

Example

ctFile.AllowMultiSelect = TRUE


DialogueLeft
DialogueLeft Property

Description

Specifies the initial horizontal coordinate position of the box. This property has no effect unless the Position property is set to a value of 1 (Defined).

Syntax

[form.]ctFile.DialogueLeft [ = setting% ]

Data Type

Integer

Example

ctFile.DialogueLeft = 100


DialogueTop
DialogueTop Property

Description

Specifies the initial vertical coordinate position of the box. This property has no effect unless the Position property is set to a value of 1 (Defined).

Syntax

[form.]ctFile.DialogueTop [ = setting% ]

Data Type

Integer

Example

ctFile.DialogueTop = -1


DlgTitle
DlgTitle Property

Description

Specifies the text to place in the title of the dialogue. Any text placed here will override the default text used by the dialogue.

Syntax

[form.]ctFile.DlgTitle [ = string% ]

Data Type

String

Example

ctFile.DlgTitle = "Open My Files"


Explorer
Explorer Property

Description

Specifies whether or not the dialogue will be displayed in the Windows 95 explorer style. This property will only work with Windows 95, and may cause errors in other Windows environments.

Syntax

[form.]ctFile.Explorer [ = { True | False } ]

Data Type

Boolean

Example

ctFile.Explorer = TRUE


FileCount
FileCount Property

Description

Retrieves the total amount of selected files from the dialog. This property has no effect unless the AllowMultiSelect property is set to a value of True. This is a read-only property.

Syntax

[form.]ctFile.FileCount

Data Type

Integer

Example

nItems = ctFile.FileCount


FileExt
FileExt Property

Description

Retrieves the name of the file extension in the dialogue. This is a read-only property.

Syntax

[form.]ctFile.FileExt

Data Type

String

Example

cFileExtension = ctFile.FileExt


FileName
FileName Property

Description

Retrieves the name of the file in the dialogue. This is a file name only. No extension, or path information is included. This is a read-only property.

Syntax

[form.]ctFile.FileName

Data Type

String

Example

cFileName = ctFile.FileName


FileTitle
FileTitle Property

Description

Specifies the name of the file to be opened or saved. (No path information)

Syntax

[form.]ctFile.FileTitle [ = string% ]

Data Type

String

Example

ctFile.FileTitle = "TEXT.TXT"


Filter
Filter Property

Description

Specifies the filter conditions from which only files with certain extensions will be displayed. Each filter condition should be set up as two parts. The first part should describe the type of files to be displayed. The second part should contain the wild card value required to display those files. As well, each part or section should be separated by a coma or a line bar ( | ).

Syntax

[form.]ctFile.Filter [ = string% ]

Data Type

String

Example

ctFile.Filter = "All File (*.*)|*.*|Document Files (*.doc)|*.doc"


HideReadOnly
HideReadOnly Property

Description

Specifies whether or not the Read Only check box will be displayed within the file dialogue box.

Syntax

[form.]ctFile.HideReadOnly [ = { True | False } ]

Data Type

Boolean

Example

ctFile.HideReadOnly = TRUE


InitialDir
InitialDir Property

Description

Specifies the full path of the initial directory for the dialog box. If this property has not been explicitly set, the initial directory is the current directory.

Syntax

[form.]ctFile.InitialDir [ = string% ]

Data Type

String

Example

ctFile.InitialDir = “C:\Windows”


MultiPathName
MultiPathName Property

Description

Retrieves the full name of a file selected from a list of multiple selected files. This includes the drive letter, path information, file name and extension. If the programmer only required the file name, they will need to parse the return string themselves. This property will have no effect unless the AllowMultiSelect property is set to True. The amount of file names can be determined through the FileCount property. This is a read-only property.

Syntax

[form.]ctFile.MultiPathName( &nIndex )

Return Type

string

Parameters

•	1 - nIndex	: ( integer ) The index of the file item

Example

    If (ctFile1.ShowOpen) Then

 For nCntr = 1 To ctFile1.FileCount

           List1.AddItem ctFile1.MultiPathName(nCntr)

        Next

    End If


OverWritePrompt
OverWritePrompt Property

Description

Specifies whether or not the user will be prompted to continue if an attempt is made to save a file that already exists.

Syntax

[form.]ctFile.OverWritePrompt [ = { True | False } ]

Data Type

Boolean

Example

ctFile.OverWritePrompt = TRUE


Owner
Owner Property

Description

Specifies the Windows handle describing the owner of the dialogue. By default, the control attempts to use the host form as the parent. This is not always possible and the dialogue is not modal to the parent form when it appears. This property allows the programmer to directly assign the parent of the dialogue to the dialogue.

Syntax

[form.]ctFile.Owner [ = setting% ]

Data Type

Long (handle)

Example

ctFile.Owner = Form1.Hwnd


PathName
PathName Property

Description

Retrieves the full name of the file in the dialogue. This includes the drive letter, path information, file name and extension. This is a read-only property.

Syntax

[form.]ctFile.PathName

Data Type

String

Example

cFilePath = ctFile.PathName


Position
Position Property

Description

Specifies how the dialogue will be positioned when it becomes visible. Valid values include ...

•	0 - Default	: Position defined by the owner form

•	1 - Defined 	: Coordinates provided by the programmer

•	2 - Center	: The center of the screen

Syntax

[form.]ctFile.Position [ = setting% ]

Data Type

Integer ( enumerated )

Example

ctFile.Position = 1


ShowHelp
ShowHelp Property

Description

Specifies whether or not the Help button is displayed in the dialogue box.

Syntax

[form.]ctFile.ShowHelp [ = { True | False } ]

Data Type

Boolean

Example

ctFile.ShowHelp = TRUE


ShowOpen
ShowOpen Method

Description

Initiates the File Open common dialogue box.

Syntax

[form.]ctFile.ShowOpen

Return Type

boolean

Parameters

None

Example

if ctFile.ShowOpen Then

   ' The OK button was pressed

   	Else

   ' The Cancel button was pressed

End If


ShowSave
ShowSave Method

Description

Initiates the File Save common dialogue box.

Syntax

[form.]ctFile.ShowSave

Return Type

boolean

Parameters

None

Example

if ctFile.ShowSave Then

   ' The OK button was pressed

   	Else

   ' The Cancel button was pressed

End If


Cancel
Cancel Event

Description

Occurs when the Cancel button in the file dialogue is clicked..

Parameters

None


Help
Help Event

Description

Occurs when the Help button in the file dialogue is clicked..

Parameters

None


OK
OK Event

Description

Occurs when the OK button in the file dialogue is clicked..

Parameters

None

Notes

Code concerning the selection of a new file could be placed in this event.