INPUTE Mnemonic - Create Graphical Edit (INPUTE) Control

Syntax

'INPUTE'(id,x,y,w,h,flags$,len,pad${,initpos,restore$},val$)
'INPUTE'(id,x,y,w,h,flags$,mask$,pad${,initpos,restore$},val$)

Description

For BBj-specific information, see INPUTE Mnemonic - Create Graphical Edit Control BBj.

The 'INPUTE' mnemonic creates a graphical edit control that accepts user input in a manner similar to the INPUTE verb but does not provide string verification.

Parameter

Description

id

INPUTE control ID.

x

Horizontal position of the upper-left corner of the INPUTE control.

y

Vertical position of the upper-left corner of the INPUTE control.

w

Width of the INPUTE control.

h

Height of the INPUTE control. To create a standard size control, set the h parameter to 0.

flags$

Control flags, as follows:

 

Flag

Description

 

$0001$

Sets the control to be initially disabled.

 

$0002$

Passes the Enter key to the parent window.

 

$0004$

Passes the Tab key to the parent window.

 

$0008$

Prompts non-mouse events on the control to highlight the control text.

 

$0010$

Sets the control to be initially invisible.

 

$0200$

Defines the edit text as read-only (Visual PRO/5 Rev. 3.12 or later).

 

$0800$

Draws a recessed client edge around the control.

 

$1000$

Draws a raised edge around the control.

len

Length of the returned string.

mask$

Input mask (provides character-type verification).

pad$

Input pad character.

initpos

Beginning of the input region.

restore$

Restore string.

val$

Default value.

Input Mask Descriptions

The following defines the input mask characters for the mask$ parameter:

Mask Character

Accepts

X

Any printable character.

a

Any alphabetic character.

A

Any alphabetic character. Converts lower-case alphabetic characters to upper case.

0

Any digit.

U

Any digit, alphabetic, space, or punctuation character. Converts lower-case alphabetic characters to upper case.

z

Any digit or alphabetic character.

Z

Any digit or alphabetic character. Converts lower-case alphabetic characters to upper case.

The INPUTE control displays all other mask characters. Visual PRO/5 does not require that every input mask position be filled.

For example, "(000) 000-0000" is a valid mask for a North American-style telephone number. Visual PRO/5 displays the mask with the parentheses, space, and dash. As the user types, the cursor automatically skips over any position in the mask that is not a "0".

The optional initpos and restore$ parameters allow applications to resume input as though 'INPUTE' were never terminated. The initpos parameter contains a simple numeric variable. The restore$ parameter can contain any string expression.

INPUTE Control Operation Rules

The INPUTE control does not use pad characters if pad$ is empty. Otherwise, it displays the contents of val$, beginning at the x,y location and includes any supplied imask$ characters. All remaining columns in the input region are displayed using the pad$ character. If pad$ is set, the INPUTE control displays the contents of val$, beginning at x,y and including any supplied imask$ characters.

If initpos is specified, the cursor starts at the specified position (where initpos =1 indicates the beginning of the input region). Otherwise, the cursor starts at the beginning of the input region.

If user input starts at the beginning of the input region, entering a new value overwrites the existing value. If user input starts with an editing or cursor movement command, the old value is retained and can be edited. (Editing is always active, even when entering a new value.)

If the user performs a restore operation during input, the input region is set to the value of restore$. If restore$ is not provided, the input region is set to the initial value of val$. If the value of the INPUTE is changed using the 'TITLE' mnemonic or SENDMSG(21), then the restore$ value will become the value given.

The editing commands can be found in PRO/5 Editing.

If the contents of val$ does not fit the mask, INPUTE generates an !ERROR=29 with a TCB(10) value of 43. INPUTE generates the same error if the 'TITLE' mnemonic is used to change the control's title and the new title does not fit the mask. See the list of INPUTE-generated errors.

Unlike the INPUTE verb, the INPUTE control allows users to remove and reassert focus but cannot include an Exit key because it is inconsistent with normal Windows behavior.

INPUTE Clipboard Operations

The INPUTE control processes the standard Ctrl+X (Cut), Ctrl+C (Copy), and Ctrl+V (Paste) clipboard functions. It can only process user-editable character positions because it serves as the edit control for the grid control. This allows for copy and paste operations between INPUTE controls.

If the text pasted into an INPUTE control does not mask correctly, the application generates an Error Code Notify event.

INPUTE SENDMSG() Functions

The following describes the parameters for the SENDMSG() functions that work with INPUTE controls:

Parameter

Description

sysgui

Valid SYSGUI channel.

id

Object ID.

function

Specific function, described in the SENDMSG() function documentation

Int

Four-byte integer that contains an argument for a given function.

string$

String argument for a given function.

context

Context containing the specified ID. This parameter is only necessary for objects that do not pertain to the current context.

The TF$ return value from many INPUTE SENDMSG() functions is a string that indicates the success or failure of the operation: $01$ indicates success, while $00$ indicates failure. Although the error is returned by the Notify event, it can also be requested. INPUTE SENDMSG() functions are described in the SENDMSG() function documentation.

Example

begin
sysgui = unt
open(sysgui)"X0"
print(sysgui)'context'(context)
print(sysgui)'window'(80,80,390,180,"INPUTE Sample Window", $00010000$,$$)
ctl1 = 100
ctl2 = 105
ctl3 = 110
ctl4 = 115
ctl5 = 500

rem 'create a control that accepts any character up to a max of 5 characters
print(sysgui)'inpute'(ctl1,10,10,100,30,$0804$,5,"","")

rem 'create a control that inputs and displays a telephone number
print(sysgui)'inpute'(ctl2,10,50,200,30,$0804$,"(000) 000-0000","","")

rem 'create a control that accepts any character up to a max of 6 and inserts
rem 'the value "NET " when the user hits the restore key (normally ESCAPE)
print(sysgui)'inpute'(ctl3,10,90,200,30,$0804$,6,"_",5,"NET ","NET ")

rem 'create a control that accepts only alphabetic characters and converts
rem 'all to upper case, limiting input to 10 characters, and inserting
rem 'the value "STANDARD" when the user hits the restore key (normally ESCAPE)
print(sysgui)'inpute'(ctl4,10,130,200,30,$0804$,"AAAAAAAAAA","",1, "STANDARD","")

rem 'create a Done button
print(sysgui)'button'(ctl5,270,10,100,40,"&Done",$$)

rem 'set focus to the first inpute control
print(sysgui)'focus'(ctl1)

rem 'set up the event template
dim event$:tmpl(sysgui)
eventlen=len(event$)

rem 'event loop
done=0
repeat
    read record(sysgui,len=eventlen)event$
    if (event.context=context and event.code$="B" and event.id=ctl5) then done=1
until done
end

See Also

Mnemonics - Alphabetical Listing

Mnemonics - Group Listing