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

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)

Parameters

  • text value: The file filter to add.

Example

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

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.

Parameters

Example

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

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.

Parameters

Return

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

Example

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

Empty()

This action tells the filter to empty itself.

Example

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.

Parameters

Return

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

Example

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

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.

Parameters

  • integer i

Return

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

Example

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

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.

Return

text: The iterator of all of the filters

Example

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

GetHashCode()

This action gets the hash code for an object.

Return

integer: The integer hash code of the object.

Example

Object o
integer hash = o:GetHashCode()

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.

Return

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

Example

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

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.

Return

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

Example

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

HasAcceptAll()

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

Return

boolean: The iterator of all of the filters

Example

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

IsEmpty()

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

Return

boolean: The iterator of all of the filters

Example

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

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.

Parameters

  • boolean accept

Example

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