HiEditHiEdit is a multitabbed, ultra fast, large file edit control consuming very little memory. It can display non-printable characters in a readable format and can be used for any general purpose editing of text and birary files. Summary | HiEdit is a multitabbed, ultra fast, large file edit control consuming very little memory. | | | | Sets the autoindent state | | | | Convert case of selected text | | Find desired text in the control | | | | Get the index of the current file | | Returns count of open files. | | | | Returns the zero-based index of the uppermost visible line. | | Get the text of the desired line from the control | | Returns an integer specifying the number of lines in the HiEdit control. | | Returns redo type and/or data for desired redo level. | | Get letfmost and/or rightmost character positions of the selection | | | | Returns the length of text, in characters. | | Get range of characters from the control | | Returns undo type and/or data for desired undo level. | | Returns line number of the line containing specific character index. | | Returns the character index of the line. | | Returns the lenght of the line. | | Sets the line numbers bar state and looks. | | | | | | | | | | Replace selection with desired text | | | | Scroll content of control until caret is visible. | | | | | | | | | | | | | | | | Sets the image list of the tab navigation toolbar | | Show popup menu containg list of open files. | | | | | | |
Add| HE_Add( | hwnd, | | | | x, | | | | y, | | | | w, | | | | h, | | | | style | = | "HSCROLL VSCROLL", | | dllPath | = | "HiEdit.dll" | ) |
|
Add control to the GUI. Parameters| x,y,w,h | Position of the control | | style | Space separated list of control styles, by default both scroll bars are visible. You can use numbers or style strings. | | dllPath | Path of the control dll, by default control is searched in the current folder. |
StylesHSCROLL, VSCROLL, TABBED, HILIGHT, TABBEDBTOP, TABBEDHRZSB, TABBEDBOTTOM
AutoIndent| HE_AutoIndent( | hEdit, | | pState | ) |
|
Sets the autoindent state Parameters
CloseFile| HE_CloseFile( | hEdit, | | | | idx | = | -1 | ) |
|
Close file or all files Parameters| idx | Index of the file to close. -2 to close ALL opened files, -1 to close current file (default) |
ConvertCase| HE_ConvertCase( | hEdit, | | | | case | = | "toggle" | ) |
|
Convert case of selected text Parameters| case | can be “upper”, “lower”, “toggle” (default), “capitalize”. |
ReturnsReturns TRUE if successful, FALSE otherwise
FindText| HE_FindText( | hEdit, | | | | sText, | | | | cpMin | = | 0, | | cpMax | = | -1, | | flags | = | "" | ) |
|
Find desired text in the control Parameters| sText | Text to be searched for. | | cpMin | Start searching at this character position. By default 0. | | cpMax | End searching at this character position. By default -1. | | flags | Space separated combination of search flags: “WHOLEWORD” “MATCHCASE” |
ReturnsThe zero-based character position of the next match, or -1 if there are no more matches.
GetColors| HE_GetColors( | hEdit, | | | | color | = | "" | ) |
|
Get the control colors Parameters| colors | Set to the color name to return its value. Omit to return all colors in INI format |
ReturnsColor(s) or FAIL if unsuccessful. See SetColors for details about available colors
GetCurrentFileGet the index of the current file
GetFileCountReturns count of open files.
GetFileName| HE_GetFileName( | hEdit, | | | | idx | = | -1 | ) |
|
Get the file path. Parameters| idx | Index of the file. -1 to get file path of the current file (default) |
ReturnsTRUE if successful, FALSE otherwise
GetFirstVisibleLine| HE_GetFirstVisibleLine( | hEdit | ) |
|
Returns the zero-based index of the uppermost visible line.
GetLine| HE_GetLine( | hEdit, | | | | idx | = | -1 | ) |
|
Get the text of the desired line from the control Parameters| idx | Zero-based index of the line. -1 means current line. |
ReturnsThe return value is the number of characters copied. The return value is empty string if the line number specified by the line parameter is greater than the number of lines in the HiEdit control
GetLineCountReturns an integer specifying the number of lines in the HiEdit control. If no text is in the HiEdit control, the return value is 1.
GetRedoData| HE_GetRedoData( | hEdit, | | level | ) |
|
Returns redo type and/or data for desired redo level. The same rules as in GetUndoData
GetSel| HE_GetSel( | | hEdit, | | | | ByRef | start_pos | = | "@", | | ByRef | end_pos | = | "@" | ) |
|
Get letfmost and/or rightmost character positions of the selection Parameters| start_pos | Optional starting position of the selection. | | end_pos | Optional ending position of the selection. |
ReturnsStarting position.
GetTextLengthReturns the length of text, in characters.
GetTextRange| HE_GetTextRange( | hEdit, | | | | min | = | 0, | | max | = | -1 | ) |
|
Get range of characters from the control Parameters| min | Index of leftmost characther of the range. By default 0. | | max | Index of rightmost characther of the range. -1 means last character in the control. |
GetUndoData| HE_GetUndoData( | hEdit, | | level | ) |
|
Returns undo type and/or data for desired undo level. ParametersTypes| UNKNOWN | The type of undo action is unknown. | | TYPING | Typing operation. | | DELETE | Delete operation. | | DRAGDROP | Drag-and-drop operation. | | CUT | Cut operation. | | PASTE | Paste operation. | | SETTEXT | WM_SETTEXT message was used to set the control text | | REPLACESEL | EM_REPLACESEL message was used to insert text | | CLEAR | Delete selected text | | BACKSPACE | Back Space Operation | | INDENT | Increase Indent | | OUTDENT | Decrease Indent | | CODEPAGE | Convert codepage | | CASE | Convert case |
LineFromChar| HE_LineFromChar( | hEdit, | | ich | ) |
|
Returns line number of the line containing specific character index. Parameters| ich | The character index of the character contained in the line whose number is to be retrieved. If the ich parameter is -1, either the line number of the current line (the line containing the caret) is retrieved or, if there is a selection, the line number of the line containing the beginning of the selection is retrieved. |
ReturnsThe zero-based line number of the line containing the character index specified by ich.
LineIndex| HE_LineIndex( | hedit, | | | | idx | = | -1 | ) |
|
Returns the character index of the line. Parameters| idx | Line number for which to retreive character index. -1 (default) means current line. |
ReturnsThe character index of the line specified in the idx parameter, or -1 if the specified line number is greater than the number of lines.
LineLength| HE_LineLength( | hEdit, | | | | idx | = | -1 | ) |
|
Returns the lenght of the line. Parameters| idx | Line number for which to retreive line length. -1 (default) means current line. |
Returnsthe length, in characters, of the line
LineNumbersBar| HE_LineNumbersBar( | hEdit, | | | | state | = | "show", | | linw | = | 40, | | selw | = | 10 | ) |
|
Sets the line numbers bar state and looks. Parameters| state | Can be “show”, “hide”, “automaxsize”, “autosize” | | linw | Line numbers width (by default 40) | | selw | Selection bar width (by default 10) |
OpenFile| HE_OpenFile( | hEdit, | | | pFileName, | | | flag | = | ) |
|
Open file in new tab Parameters| pFileName | Path of the file to be opened | | flag | Set to TRUE to create new file if pFileName doesn’t exist. If set to FALSE, function fails if the file doesn’t exist (default). Returns: TRUE if successful/FALSE otherwise |
RedoDo redo operation ReturnsTRUE if the Redo operation succeeds, FALSE otherwise
ReloadFile| HE_ReloadFile( | hEdit, | | | | idx | = | -1 | ) |
|
Reload file Parameters| idx | Index of the file to reload. -1 to reload current file (default) |
ReplaceSel| HE_ReplaceSel( | hEdit, | | | | text | = | "" | ) |
|
Replace selection with desired text Parameters| text | Text to replace selection with. |
SaveFile| HE_SaveFile( | hEdit, | | | | pFileName, | | | | idx | = | -1 | ) |
|
Save file to disk Parameters| pFileName | File name. | | idx | Index of the file to save. -1 to save current file (default) |
ReturnsTRUE if successful, FALSE otherwise
ScrollCaretScroll content of control until caret is visible.
SetColors| HE_SetColors( | hEdit, | | | | colors, | | | | fRedraw | = | true | ) |
|
Set the control colors Parameters| colors | Any subset of available color options in INI format (array of NAME=COLOR lines). Skiped colors will not be changed. | | fRdraw | Set to TRUE to redraw control |
Colors| Text | Normal Text Color | | Back | Editor Back Color | | SelText | Selected Text Color | | ActSelBack | Active Selection Back Color | | InSelBack | Inactive Selection Back Color | | LineNumber | Line Numbers Color | | SelBarBack | Selection Bar Back Color | | NonPrintableBack | 0 - 31 special non printable chars | | Number | Number Color |
SetCurrentFile| HE_SetCurrentFile( | hEdit, | | idx | ) |
|
Set the the current file Parameters| idx | New file index to set as current. |
SetEvents| HE_SetEvents( | hEdit, | | | | func, | | | | e | = | "selchange" | ) |
|
Set notification events Parameters| func | Subroutine that will be called on events. | | e | White space separated list of events to monitor (by default “selchange”). |
Globals| HE_HWND | Control handle | | HE_EVENT | Specifies event that occurred. Event must be registered to be able to monitor them. Events “tabmclick” and “filechange” are registered automatically. | | HE_INFO | String specifying event info. You can access individual info elements as INFO_Start | | HE_RESULT | Placeholder for notification result, if its needed. |
Events & Infos| SelChange | S<start> E<end> L<line> [t|*] (t if tab changed, * if text changed) | | Key | key pressed | | Mouse | x<xcoord> y<ycoord> v<virtual_key> | | Scroll | Set HE_Result to 1 to prevent standard menu from showing ContextMenu - | | FileChange | <file_index> (file is changed outside of the application) | | Tabmclick | (middle button click over tab) |
Returns”OK” if succesiful, error string otherwise
SetFont| HE_SetFont( | hEdit, | | | | pFont | = | "" | ) |
|
Sets the control font Parameters| pFont | AHK font definition: “Style, FontName” |
SetKeywordFileSet syntax highlighting. ParametersKeyword File| [ext1,ext2,...,extN] | Each keyword definiton block starts with list of extensions in angular brackets. | | 0xSSRRGGBB=word1 word2 ... wordN | Color keywords on this line with BBGGRR color. SS is 00 by default. | | delimiters | High byte in the color (0x01xxxxxx) refers to delimiters. Delimiters are added from ALL sections for a file extension. | | string chars | A & at the end of keyword specifies a string char. For ex. “& means that everything enclosed in two “ is a string | | comments keyword | A + at the end of keyword specifies a comment char/keyword. For ex. //+ means that everything that follows is a comment. Multiline comments are not supported yet. A “-” at the end of keyword specifies that ALL text up to the end of line will be painted using the color specified UNLESS a comment indicator is found. | | ; | Line comment |
SetSel| HE_SetSel( | hEdit, | | | | nStart | = | 0, | | nEnd | = | -1 | ) |
|
Set the selection Parameters| nStart | Starting character position of the selection. Set -1 to remov current selection. | | nEnd | Ending character position of the selection. Set -1 to use position of the last character in the control. |
SetTabWidth| HE_SetTabWidth( | hEdit, | | | | pWidth, | | | | pRedraw | = | true | ) |
|
Sets the tab width Parameters| pWidth | Tab width in characters | | pRedraw | Set to true to redraw control (default) |
SetTabsImageList| HE_SetTabsImageList( | hEdit, | | | | pImg | = | "" | ) |
|
Sets the image list of the tab navigation toolbar Parameters| pImg | .BMP file with image list. Omit this parameter to use default image list. |
ShowFileList| HE_ShowFileList( | hEdit, | | | | x | = | 0, | | y | = | 0 | ) |
|
Show popup menu containg list of open files. Parameters| x, y | Position of popup window |
UndoDo undo operation ReturnsTRUE if the Undo operation succeeds, FALSE otherwise
ExampleGui, +LastFound hwnd := WinExist()
hEdit := HE_Add(hwnd,0,0,600,500) Gui, SHow, w600 h500
#include HiEdit.ahk
|