![]() |
<< Index >> |
FutureBasic 5 |
edit field | statement | |
|
edit field [#]idExpr [,[text][,[rect][,[type],¬ [efClass],[keyFilterProc]]]]
edit field -idExpr
edit field 0
edit field
statement are different from those created with the appearance button
statement. Text items made with appearance button
do not accommodate multiple runs of styled text, proper scrolling, and other necessary items. Text items created with the edit field
statement have most of the features found in Standard BASIC edit fields with the added advantages of Appearance Manager compliance.edit field
with a negative value. To gray out field #22, you would use the statement edit field -22
.local fn numeralFilter
dim k as Str15
k = tekey$
long if k >= "0" and k <= "9"
tekey$ = k
xelse
select asc( k )
case < 32 : rem allow for control keys
tekey$ = k
case else
beep
end select
end if
end fn
dim @ filter as pointer
dim r as Rect
window 1
SetRect( r, 10, 10, 450, 60 )
filterFN = @fn numeralFilter
edit field 1, "Numbers Only", @r,,, filterFN
do HandleEvents until 0
HandleEvents
periodically (it's a good idea for your program to do this in any case). This will allow the user's keypresses and mouse events to be transmitted to the active field as appropriate, and will cause the field's contents to be updated correspondingly. Your program can use the edit$
function or the get field
statement to check the contents of a field at any time._noAutoClip
feature is set.idExpr
, such that abs(idExpr)
is different from the ID numbers of all other existing edit fields or picture fields in the current window. The rect
parameter is required in this case. If idExpr
is positive, then a "non-styled" edit field is created, and is assigned an ID number equal to idExpr
. If idExpr
is negative, then a "multistyled" edit field is created, and is assigned an ID number equal to abs(idExpr)
. A "non-styled" edit field adopts the text characteristics (font family, size, style and color) that were in effect for the window at the time the field was created, and all the text in that field has those characteristics. A "multistyled" edit field can contain different pieces of text which each have different text characteristics. NOTE: When you create a new non-static edit field, the new field becomes the active field in that window.text
defaults to a null string (i.e., the field is empty)
type
defaults to _framedNoCR
(this is one of the editable types)
efClass
defaults to zero, which is one of the left-justified classes.
idExpr
. You don't need to specify any other parameters, unless you also wish to alter some of the field's characteristics.idExpr
, and specify one or more of the other parameters. Any parameter that you omit won't have its characteristic changed. Note that if the field is editable (non-static), this command will also make it the active field.edit$
statement. The edit$
statement will not make the field active.edit field 0
syntax.type
parameter.edit field 0
or by activating a different field), and then specify any of the static types in the type
parameter.text
This parameter can be specified in any of the following forms:Core Foundation String(i.e. CFStringRef )
-- Any Core Foundation string expression.
PascalString
-- Pascal strings are rejected in FB 5.7.102+. Use the CFString option above instead.
&ZTXThandle&
-- An "&
" symbol followed by a handle to a "ZTXT
" structure.
%TEXTresID%
-- A "%
" symbol followed by the resource ID number of a "text
" resource.
#container$$
-- A "#
" symbol followed by a container variable indicates that the contents of the container should be copied to the field. If the container has a length that is greater than 32,767, then only the first 32,767 bytes are copied to the field.
edit$
statement; see the edit$statement for more information.rect
This parameter specifies the "view rectangle" for the field. No text will be drawn outside of this rectangle. This parameter can be specified in either of the following forms:(x1%, y1%)-(x2%, y2%)
-- These coordinates specify two diagonally opposite corners of the rectangle.
rectAddr&
-- A pointer or long integer expression. This is interpreted as the address of a standard 8-byte "rect
" structure.
type
This is an integer which specifies several characteristics about the field._statFramedGray
_statNoFramedGray
_statFramedInvert
_statNoFramedInvert
_statFramedInvert + _hilite
_statNoFramedInvert + _hilite
_usePlainFrame
, making 48 altogether):
_copyOnlyFramed |
_copyOnlyFramed_autoGray |
_copyOnlyNoFramed |
_copyOnlyNoFramed_autoGray |
_framedNoCR |
_framedNoCR_autoGray |
_framed |
_framed_autoGray |
_noFramedNoCR |
_noFramedNoCR_autoGray |
_noFramed |
_noFramed_autoGray |
_framedNoCR_noDrawFocus |
_framedNoCR_autoGray_noDrawFocus |
_framed_noDrawFocus |
_framed_autoGray_noDrawFocus |
_noFramedNoCR_noDrawFocus |
_noFramedNoCR_autoGray_noDrawFocus |
_noFramed_noDrawFocus |
_noFramed_autoGray_noDrawFocus |
_statFramed |
_statFramed_noAutoGray |
_statNoFramed |
_statNoFramed_noAutoGray |
_framedNoCR (1) |
Frame is drawn. "Return" key does not advance line, but generates an _efReturn event. This is the default type. |
_framed (2) |
Frame is drawn. "Return" key advances insertion point to next line, does not generate an _efReturn event. |
_noFramedNoCR (3) |
Like _framedNoCR , but no frame is drawn. |
_noFramed (4) |
Like _framed , but no frame is drawn. |
_statFramed (5) |
Frame is drawn. |
_statNoFramed (7) |
No frame is drawn. |
_statFramedGray (9) |
Frame is drawn; frame and text are dimmed. |
_statNoFramedGray (11) |
No frame is drawn; text is dimmed. |
_statFramedInvert (13) |
Frame is drawn; text and background colors are inverted. |
_statNoFramedInvert (15) |
No frame is drawn; text and background colors are inverted. |
_statFramedInvert+hilite (29) |
Frame is drawn; text and background are highlighted using system highlight colors. |
_statNoFramedInvert+hilite (31) |
No frame is drawn; text and background are highlighted using system highlight colors. |
_noDrawFocus (256) |
Use this option if you don't want the focus rectangle outlining the active field. |
_noAutoGray (512) |
When the window goes to the background, text in this field will not be grayed. |
_autoGray (1024) |
Text is automatically grayed when the window goes to the background. |
_copyOnlyFramed (2048) |
The user may selct and copy text from this field but may not edit the text. |
_copyOnlyNoFramed (2051) |
This is the same as _copyOnlyFramed without the frame. |
_usePlainFrame (4096) |
When added to a _framed or _framedNoCR type, gives an old-fashioned but crisp rectangular frame instead of the trendy fuzz obtained with DrawThemeEditTextFrame. The runtime currently requires a frame/CR constant to be supplied as well as the special _usePlainFrame . Thus you will have to specify:
_framedNoCR_usePlainFrame or _framed_usePlainFrame |
efClass
This parameter must be within the range 0 through 255 (0 through 536,870,912 in the Appearance Manager). It serves two purposes:window(_efClass)
function when the field is active.
efClass
is zero, then the text will be left-justified. Otherwise, text justification is determined by the low-order two bits in efClass
(given by efClass mod 4
), as follows:
If efClass mod 4 is: |
Then the text is: |
zero |
Right justified. |
_leftJust (1) |
Left justified. |
_centerJust (2) |
Centered. |
_rightJust (3) |
Right justified. |
efClass
to one of the constants _leftJust
, _centerJust
or _rightJust
.edit field
statement is not the only means by which an inactive field can become active. If the user clicks on an inactive editable field, FutureBasic automatically activates the field the next time your program executes the HandleEvents
statement.