%eb - Edit Box

Purpose

To insert an edit box.

Syntax

winio@('%N.Meb[options]',bufferbuff_size)
winio@('%`N.Meb[options]',bufferbuff_size, edit_info)
character(*) buffer     (input/output)
integer buff_size     (input)
integer edit_info(24)     (input/output)

Modifiers

Caret (^) - the call-back function is called when a key is pressed or the mouse is moved.

Question mark (?) - a help string is supplied.

Grave accent (`) - the program supplies edit information. The array name edit_info is placed in the argument list after any grey control variable and before any call-back function. This is an EDIT_INFO block which can be used to manipulate the edit box.

Tilde (~) - adds a variable that controls the grey (enable/disable) state. The variable should precede the call-back function (if any) in the argument list.

Description

An edit box created using %eb provides a wide range of advanced text editing features. See Edit box topics for details.

N represents the width of the box in average characters. M represents the depth which, if omitted, defaults to 1.

buffer is a character string for the text which must be terminated with chr(0).

buff_size is the size of the buffer. A zero value may be supplied to allow the edit box to allocate its own memory re-sizing as required (buffer is ignored).

%eb will take a pivot (%pv (Pivot)).

If the caret modifier (^) is used and the call-back function does not handle the response to control keys such as Delete, Backspace, etc., then it should return a zero value.

Routines such as OPEN_EDIT_FILE@ that take an EDIT_INFO block as their first argument can now alternatively use the Windows handle (HWND) of the control for this first argument. This handle is typically obtained by using %lc (Handle of Last Control).

The following functions may be used with this enhanced control. These functions take an INTEGER(7) value HWND, typically obtained via %lc (Handle of Last Control). If HWND is zero (0_7) then the control that has the current focus is used.

INTEGER FUNCTION GetEditText@(HWND, BUFFER, SIZE)
INTEGER(7) HWND
CHARACTER(*) BUFFER
INTEGER SIZE
Gets the contents of the control. Returns zero if the HWND is not valid or the buffer is not large enough. SIZE is the size of the buffer. Edit controls are limited to a maximum of 32K characters.

INTEGER FUNCTION OpenEditFile@(HWND, FILENAME)
INTEGER(7) HWND
CHARACTER(*) FILENAME
Opens and reads the text file into the control and associates the control with this FILENAME. Return zero if the HWND is not valid or the file cannot be opened and read. This function can be used in a callback associated with the "FILE_OPENR" standard callback and the %ft (Filter for File Dialog) format code for file "filters".

INTEGER FUNCTION EditFileSave@(HWND)
INTEGER(7) HWND
The function uses the file name associated with the control if it has one, otherwise it opens a standard "Open file" dialog and creates the file association. No action is taken if an association exists and the text has not changed. Returns zero if the HWND is not valid or the file cannot be saved. File "filters" can be provided via the %ft (Filter for File Dialog) format code.

INTEGER FUNCTION EditFileSaveAs@(HWND)
INTEGER(7) HWND
The function opens a standard "Open file" dialog to get a full path for a file and then saves it, creating a new file association for the control. Returns zero if the HWND is not valid or the file cannot be saved. File "filters" can be provided via the %ft (Filter for File Dialog) format code.

INTEGER FUNCTION EditFileClosePrompt@(HWND, CAPTION, MESSAGE)
INTEGER(7) HWND
CHARACTER(*) CAPTION,MESSAGE
Used when closing the control's window (e.g. within a %cc (Control Closure) callback). If the text has changed since the last "save" operation then a dialog is presented prompting for a save before closing. The possible responses are Yes, No and Cancel. CAPTION is the title for the prompting dialog and MESSAGE is its message. If %s is used within this MESSAGE string then %s is replaced by the short name of the associated file if there is one. The function returns zero for "No" and one for "Yes" when the save is successful. This return value can be used directly as the return value of a %cc (Control Closure) callback.

INTEGER FUNCTION EditFileModified@(HWND)
INTEGER(7) HWND
Returns 1 if the text has been changed since the last save operation, otherwise it returns zero.

See also

%cc (Control Closure)

 

 

 

Basket
Empty
 
Copyright © 1999-2024 Silverfrost Limited