Libraries.Interface.Controls.FileFilter Documentation

This class represents a filter for files in an open or save dialog. It does not do much on its own, but is used in relation to the FileChooser class.

Example Code

use Libraries.Game.Game
        use Libraries.Interface.Controls.FileChooser
        use Libraries.Interface.Controls.FileFilter
        use Libraries.System.File

        class Main is Game

            action Main
                StartGame()
            end

            action CreateGame
                FileChooser chooser
                FileFilter filter
                filter:Add("png")
                File file = chooser:OpenFileDialog(filter)
                if file not= undefined
                    output file:GetAbsolutePath()
                end
            end
        end

Inherits from: Libraries.Language.Object

Summary

Actions Summary Table

ActionsDescription
Add(text value)This action adds a filter to the list.
AddMultipleFilter(Libraries.Containers.Array<text> multiple)This action adds a filter to the list.
Compare(Libraries.Language.Object object)This action compares two object hash codes and returns an integer.
Empty()This action tells the filter to empty itself.
Equals(Libraries.Language.Object object)This action determines if two objects are equal based on their hash code values.
Get(integer i)This action gets the item at a given location in an filter.
GetCombinedFilter()This action translates the file filter to something the low level native system understands.
GetHashCode()This action gets the hash code for an object.
GetIterator()This action gets the item at a given location in an filter.
GetSize()This action gets the item at a given location in an filter.
HasAcceptAll()This action tells us whether or not the filter should have a wildcard, meaning that it should accept any type of file.
IsEmpty()This action tells us whether or not the file filter is empty.
SetAcceptAll(boolean accept)This action tells us the filter whether or not it should have a wildcard, meaning whether it should accept any type of file.

Actions Documentation

Add(text value)

This action adds a filter to the list. This is represented by a file's file extention without a dot (e.g., png, not .png)

Example Code

use Libraries.Game.Game
        use Libraries.Interface.Controls.FileChooser
        use Libraries.Interface.Controls.FileFilter
        use Libraries.System.File

        class Main is Game

            action Main
                StartGame()
            end

            action CreateGame
                FileChooser chooser
                FileFilter filter
                filter:Add("png")
                File file = chooser:OpenFileDialog(filter)
                if file not= undefined
                    output file:GetAbsolutePath()
                end
            end
        end

Parameters

AddMultipleFilter(Libraries.Containers.Array<text> multiple)

This action adds a filter to the list. This is represented by a file's file extention without a dot (e.g., png, not .png). The primary difference between this action and the Add action is that this one uses multiple file types in one filter.

Example Code

use Libraries.Game.Game
        use Libraries.Interface.Controls.FileChooser
        use Libraries.Interface.Controls.FileFilter
        use Libraries.System.File
        use Libraries.Containers.Array

        class Main is Game

            action Main
                StartGame()
            end

            action CreateGame
                FileChooser chooser
                FileFilter filter
                Array<text> array
                array:Add("png")
                array:Add("bmp")
                filter:AddMultipleFilter(array)
                File file = chooser:OpenFileDialog(filter)
                if file not= undefined
                    output file:GetAbsolutePath()
                end
            end
        end

Parameters

Compare(Libraries.Language.Object object)

This action compares two object hash codes and returns an integer. The result is larger if this hash code is larger than the object passed as a parameter, smaller, or equal. In this case, -1 means smaller, 0 means equal, and 1 means larger. This action was changed in Quorum 7 to return an integer, instead of a CompareResult object, because the previous implementation was causing efficiency issues.

Example Code

Object o
        Object t
        integer result = o:Compare(t) //1 (larger), 0 (equal), or -1 (smaller)

Parameters

Return

integer: The Compare result, Smaller, Equal, or Larger.

Empty()

This action tells the filter to empty itself.

Example Code

use Libraries.Interface.Controls.FileFilter
        FileFilter filter
        filter:Add("png")
        output filter:Empty()

Equals(Libraries.Language.Object object)

This action determines if two objects are equal based on their hash code values.

Example Code

use Libraries.Language.Object
        use Libraries.Language.Types.Text
        Object o
        Text t
        boolean result = o:Equals(t)

Parameters

Return

boolean: True if the hash codes are equal and false if they are not equal.

Get(integer i)

This action gets the item at a given location in an filter. If the item returned is a comma separated list, then it is a multiple filter.

Example Code

use Libraries.Interface.Controls.FileFilter
        FileFilter filter
        filter:Add("png")
        output filter:Get(0)

Parameters

Return

text: The filter or multiple filter at the given location.

GetCombinedFilter()

This action translates the file filter to something the low level native system understands. It does not need to be called by a user.

Example Code

use Libraries.Interface.Controls.FileFilter
        FileFilter filter
        filter:Add("png")
        output filter:GetCombinedFilter()

Return

text: The iterator of all of the filters

GetHashCode()

This action gets the hash code for an object.

Example Code

Object o
        integer hash = o:GetHashCode()

Return

integer: The integer hash code of the object.

GetIterator()

This action gets the item at a given location in an filter. If the item returned is a comma separated list, then it is a multiple filter.

Example Code

use Libraries.Interface.Controls.FileFilter
        FileFilter filter
        filter:Add("png")
        Iterator<text> iterator = filter:GetIterator()
        repeat while iterator:HasNext()
            output iterator:Next()
        end

Return

Libraries.Containers.Iterator: The iterator of all of the filters

GetSize()

This action gets the item at a given location in an filter. If the item returned is a comma separated list, then it is a multiple filter.

Example Code

use Libraries.Interface.Controls.FileFilter
        FileFilter filter
        filter:Add("png")
        output filter:GetSize()

Return

integer: The filter or multiple filter at the given location.

HasAcceptAll()

This action tells us whether or not the filter should have a wildcard, meaning that it should accept any type of file.

Example Code

use Libraries.Interface.Controls.FileFilter
        FileFilter filter
        filter:Add("png")
        output filter:HasAcceptAll()

Return

boolean: The iterator of all of the filters

IsEmpty()

This action tells us whether or not the file filter is empty.

Example Code

use Libraries.Interface.Controls.FileFilter
        FileFilter filter
        filter:Add("png")
        output filter:IsEmpty()

Return

boolean: The iterator of all of the filters

SetAcceptAll(boolean accept)

This action tells us the filter whether or not it should have a wildcard, meaning whether it should accept any type of file.

Example Code

use Libraries.Interface.Controls.FileFilter
        FileFilter filter
        filter:Add("png")
        output filter:HasAcceptAll()

Parameters