User Tools

Site Tools


k12:k12.4:k12.4.2:start

12.4.2 Class Dialogue (gb.qt4)

The component provides standard dialogues for calling dialogue boxes. In this chapter, properties and methods of the class Dialog (gb.qt4) are presented. Examples and a project complete the description.

12.4.2.1 Properties

The Dialog (gb.qt4) class has these properties:

PropertyDataTypeDescription
ShowHiddenBooleanReturns the value or sets with True that hidden files should also be shown in the dialogue box.
ColorIntegerDetermines the colour selected in the colour selection dialogue or sets the colour in the colour selection dialogue as default colour.
FilterString[]Determines the filter used in the dialogue (file extension) or sets the filter. Filter is a string array where each entry consists of a filter and a filter description. A filter is a list of file extensions with placeholders separated by a semicolon. A filter description can be any string. A filter is automatically appended to the filter description when displayed.
FontFontDetermines the font selected in the font selection dialogue or sets the font in the font selection dialogue as the default font.
PathStringReturns the selected file path in the file selection dialog as string or sets the file path in the file dialog as default path.
PathsString[]Returns the selected file paths in the file open dialog as a string array.
TitleStringReturns the (window) title selected in the dialogue or sets the title for the dialogue.

Table 12.4.2.1.1 : Properties of the Dialog class (gb.qt4)

12.4.2.2 Methods

Class Dialog (gb.qt4) has the following methods. Note optional arguments.

MethodDescription
OpenFile( [ Multi As Boolean ] ) As BooleanInvokes the file open dialog to retrieve the file name of the file to be opened. If the optional argument 'Multi' has the value False (default), the user can select exactly one file. The return value is the path to the selected file - stored in the path property Dialog.Path. If the optional argument 'Multi' has the value True, the user can select multiple files. The return value is a string array containing the paths to all selected files - stored in the Dialog.Paths property. The method itself returns True if the user has pressed the Cancel button or False if the user has pressed the OK button.
SaveFile( ) As Boolean
SelectDirectory( ) As BooleanCalls the file standard dialogue to read out an existing directory name. The method itself returns True if the user pressed the Cancel button or False if the user pressed the OK button.
SelectFont( ) As BooleanCalls the standard font selection dialogue. The method itself returns True if the user pressed the Cancel button or False if the user pressed the OK button.
SelectColor() As BooleanCalls the standard colour selection dialogue. The method itself returns True if the user pressed the Cancel button or False if the user pressed the OK button.

Table 12.4.2.2.1 : Methods of the class Dialog (gb.qt4)

12.4.2.3 Examples

In order to be able to reproduce all the examples, you will find a project archive in the download area. Since this project is based on the project presented in chapter → 12.4.1 Class Dialogue (gb.form.dialog) and only the component gb.form.dialog has been omitted, only the dialogue boxes and the program interface are presented.

12.4.2.4 Dialog.SelectDirectory()

B1
Figure 12.4.2.4.1: Directory select dialogue box.

12.4.2.5 Dialog.Openfile(..) - image files

B2
Figure 12.4.2.5.1: File Open dialogue box - 1

12.4.2.6 Dialog.Openfile(..) - text files

B3
Figure 12.4.2.6.1: File Open dialogue box - 2

12.4.2.7 Dialog.SelectFont()

B4
Figure 12.4.2.7.1: Font dialogue box

12.4.2.8 Dialog.SelectColor()

B5
Figure 12.4.2.8.1: Colour dialogue box

12.4.2.9 Dialog.SaveFile()

B6
Figure 12.4.2.9.1: File Save dialogue box.

12.4.2.10 Programme interface

Here you can see the programme interface for the project:

B7
Figure 12.4.2.10.1: Programme interface

Download

Project

Download

The website uses a temporary session cookie. This technically necessary cookie is deleted when the browser is closed. You can find information on cookies in our privacy policy.
k12/k12.4/k12.4.2/start.txt · Last modified: 01.02.2022 (external edit)

Page Tools