Textbox Control
The textbox control provides a way to display and edit single or multi-line text.

Arguments
The Control Add statement is used to create all new controls. Here are the statement's arguments and any special significance to the textbox control.

Usage Notes
By default, text is a single line and scrolls to the right. Use %es_multiline to allow text to wrap. To allow pressing ENTER to create a new line, add %es_wantreturn (it overrides default handling of ENTER, which is to activate the dialog default button).

Justification (left/center/right) only works with multiline text.

User input can be constrained to upper/lower/number/password content with %es_upper, %es_lower, %es_number and %es_password. Upper/lower/password constraint is applied to text entered in the Control Add statement, but not so for number constraint.

Scrollbars only apply to multiline text.

Selected text gets inverted. By default, when a textbox loses focus the selection is hidden. Use %es_nohidesel to keep selection visible when focus is lost.

With %es_autohscroll, autowrapping is disabled.

With %es_autovscroll and %es_wantreturn, ENTER forces textbox to scroll when on last line.

Textbox Control-Specific PowerBASIC Statements
Although PowerBASIC provides control-specific statements for some controls (Treeview, Imagelist, ...), there are no TEXTBOX PowerBASIC statements.

Messages, Notifications, Styles, and ExtSstyles
There are four types of named constants in the following table. All are pulled from the MSDN web site.

The first column contains control-specific named constants and the second column contains generic window named constants (textbox controls are windows).

Also, if the PowerBASIC Help file has an entry on the value, it is highlighted in yellow. If the value was noted in PowerBASIC Help as a default value, it is also shown in bold text.

In the values for notifications, descriptions starting with -n and -c refer to events received through the %wm_notify and %wm_command messages. By default, PowerBASIC controls can receive both of these messages.

   

And here is a short description of many of the named constants corresponding to notifications, styles, and extstyle - particularly those discussed in the PowerBASIC Help topics.

    %en_change             -c text has changed (after screen updated)
    %en_errspace           -c insufficient space
    %en_hscroll            -c horizontal scroll bar clicked (before update)
    %en_killfocus          -c textbox loses keyboard focus
    %en_maxtext            -c maximum character length exceeded. truncates text.
    %en_setfocus           -c textbox receives keyboard focus
    %en_update             -c text change, before screen update
    %en_vscroll            -c vertical scrollbar clicked (before update)
    %es_autohscroll        - auto horizontal scroll (10 chars)
    %es_autovscroll        - auto vertical scroll, use WANTRETURN, MULTILINE
    %es_center             - center text
    %es_left               - left align text
    %es_lowercase          - convert to lowercase (during entry)
    %es_multiline          - allow multi-line of text. use ES_WANTRETURN
    %es_nohidesel          - invert selection, regardless of focus
    %es_number             - allow only digits (- + not allowed)
    %es_oemconvert         - convert to OEM character set
    %es_password           - display all * regardless of character entered
    %es_readonly           - prevent text entry. allows select/copy
    %es_right              - right align text
    %es_uppercase          - convert to uppercase (during entry)
    %es_wantreturn         - ENTER inserts CRLF. n/a on single line textbox
    %wm_ctlcoloredit       -  before read-only/disabled control redrawn
    %ws_border             - use thin line border
    %ws_ex_clientedge      - apply sunken edge border
    %ws_ex_left            - generic left-aligned properties
    %ws_ex_right           - generic right-aligned properties
    %ws_ex_staticedge      - apply 3D border
    %ws_ex_transparent     - draw controls/windows beneath control first
    %ws_ex_windowedge      - apply raised edge border
    %ws_group              - starts/ends group. use %ws_tabstop style.
    %ws_hscroll            - autodisplay horizontal scroll
    %ws_tabstop            - allows receipt of keyboard focus
    %ws_vscroll            - autodisplay vertical scroll

Callback Function
A control can have its own callback function, or use the parent dialog callback function.

A control callback function should return TRUE to indicate it has processed the message. This prevents unnecessarily calling the dialog callback function, which will process the message if no control callback function is available, or if the control callback function returns FALSE.

By default, both %WM_COMMAND and %WM_NOTIFY messages are received. However, if the #MESSAGE COMMAND compiler directive is invoked, the %WM_NOTIFY messages will not be available.

Here's a sample textbox control callback function.

   CallBack Function cbTextBox()
      Select Case CB.MSG
         Case %WM_COMMAND
            Select Case CB.CTLMSG
               Case %en_change
               Case %en_errspace
               Case %en_hscroll
               Case %en_killfocus
               Case %en_maxtext
               Case %en_setfocus
               Case %en_update
               Case %en_vscroll
            End Selection
      End Select
   End Function

In each Case section, add the statements the application needs to respond to the event. Also, be sure to add "Function=1" as appropriate to indicate that the event was handled by the callback function.

CONTROL Statement Syntax
The following table lists the various Control statements (except the ADD statements). Most, but not all, can be used with the textbox control. A one-line description of the statement and then its syntax are presented.

If you have any suggestions or corrections, please let me know.