## Methods, General

function Open(const AFileName: WideString; APicture: TPicture = nil): Boolean; Opens a file. Result is True if file was successfully opened or False if file was not found or other open error occured. Pass the empty AFileName string to close the currently open file. APicture optional parameter can specify the preloaded image object. Notes: APicture parameter is introduced to reduce flickering when user loads multiple images. For example, user goes through an image directory using "File -- Next" interface command. After user has loaded an image, you can create a thread, that will load the next image in background and save it into TPicture object. When user performs "File -- Next" command again, you can quickly load the preloaded object using APicture parameter, and then create a thread that will load the next image etc. APicture parameter is used only when the Image mode is activated (see description of ModeDetect property for details).
function OpenFolder(const AFolderName: WideString): Boolean; Opens a folder using Lister plugin. Result is True if folder was opened using some plugin. Pass the empty AFolderName string to close the currently open plugin (you can also call Open('') for this). Notes: Examples of Lister plugins which can show folders are VisualDirSize and IEView. You cannot change Mode property while folder is opened: internal viewers cannot be used for folders.
procedure Reload; Reloads the currently opened file or folder. Note: This method just reassigns the old value of Mode property. As the result: when performed in Unicode mode, it switches between pure Unicode and Unicode/Hex modes; when performed in Plugins mode, it loads the next matched plugin.
function FindFirst(const AText: WideString; AOptions: TATStreamSearchOptions): Boolean; Starts text search. AText: text to search (Note: Unicode string must be in the Little-Endian format), AOptions: search options that are set of flags: asoWholeWords: search for whole words only asoCaseSens: case-sensitive search asoBackward: backward search (Note: not supported in RTF mode and for RegEx) asoRegEx: RegEx search (Note: supported only in Text/Binary/Hex/Unicode modes) asoFromPage: starts search from current page, otherwise in entire file (Note: supported in all text modes, but not for RegEx) Result is True if text was found and highlighted. Notes: RegEx search (asoRegEx option) is available only when RegEx library is compiled in. See ATStreamSearchOptions.inc file. Unicode-named files can be handled during search only when Tnt Unicode Controls are compiled in. See ATStreamSearchOptions.inc file. When non-RegEx search is performed, two different search functions are used: one for 1-byte Text/Binary/Hex modes and another for Unicode mode; they give different search results. In Text/Binary/Hex modes, when TextEncoding <> vencANSI, text is automatically decoded during search.
function FindNext(AFindPrevious: Boolean = False): Boolean; Continues text search. AFindPrevious: continue search in reverse direction. Result is the same as for FindFirst method. Notes: AFindPrevious option can be used only in Text/Binary/Hex/Unicode modes and cannot be used for RegEx search. After you change view mode or reload a file, you cannot continue search immediately, you must first call FindFirst method.
function FindDialog(AFindNext: Boolean): Boolean; Calls custom search dialog, specific to the current view mode or plugin. This may be MSIE search dialog in Internet mode, or active plugin's custom dialog. AFindNext should be set to True for "Find next" command. Result is True if custom dialog was successfully shown. In this case you don't need to show your own dialog. If Result is False, then you need to show your own dialog and then call FindFirst / FindNext methods.
procedure CopyToClipboard(AsHex: Boolean = False); Copies data to Clipboard. This method works differently in various view modes: Text/Binary/Hex: data is the current selection (AnsiString). AsHex parameter may be True, in this case the hex-encoded string (bytes in the hex form separated by spaces) will be copied. Unicode: data is the current selection (WideString). Multimedia: when an image is loaded (IsImage = True): data is the whole image. Internet: data is the current selection (usually HTML text). Plugins: data is the current selection; data type depends on plugin and plugin is responsible for performing the copying operation. RTF: data is the current selection (plain or RTF text). Note: This method may fail and show an error message if data size selected is too big.
procedure SelectAll; procedure SelectNone; SelectAll: Selects all text. Works in text, Internet, Plugins modes. SelectNone: Deselects text. Works in text, Internet modes.
procedure PrintDialog; procedure PrintSetup; procedure PrintPreview; PrintDialog: Shows "Print" dialog. Works in all modes. PrintSetup: Shows "Print Setup" dialog. Works in all modes. PrintPreview: Shows "Print Preview" dialog. Works in Text/Binary/Hex/Unicode, Multimedia (IsImage = True), Internet modes. Notes: PrintDialog / PrintPreview methods show preview form in text/Multimedia modes, but only when ATPrintPreview component is used by enabling the "PREVIEW" define in ATBinHexOptions.inc / ATViewerOptions.inc files. PrintPreview method always shows MSIE preview dialog in Internet mode.
procedure FocusActiveControl; Focuses the active embedded control (TATBinHex, TRichEdit, TWebBrowser etc). Notes: If you have ATViewer as main form control, you should call FocusActiveControl in your form's WM_ACTIVATE message handler to put focus back to ATViewer after some dialog has been shown. See also IsFocused property.
procedure IncreaseScale(AIncrement: Boolean); Increases (AIncrement = True) or decreases current font size or image scale. Works in text, Multimedia (IsImage = True), Internet modes.