Value (ScreenField property): Difference between revisions

From m204wiki
Jump to navigation Jump to search
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Template:ScreenField:Value subtitle}}
{{Template:ScreenField:Value subtitle}}
The <var>Value</var> property sets or returns the value of a <var>ScreenField</var>. The value is set from or copied to a User Language string, and it may be from 0-255 characters in length.
The <var>Value</var> property sets or returns the value of a <var>ScreenField</var>. The value is set from or copied to a <var class="product">User Language</var> string, and it may be from 0-255 characters in length.


==Syntax==
==Syntax==
Line 22: Line 22:
==Examples==
==Examples==
In the following example, a screenfield <code>%scrfmsg</code> set up to display an error message to the user is populated according to the user command input in screenfield <code>%scrfcmd</code>.  The <var>[[$SirMsg]]</var> argument identifies the number of the line to be returned from a procedure designated by <var>[[$SirMsgP]]</var> (not shown).
In the following example, a screenfield <code>%scrfmsg</code> set up to display an error message to the user is populated according to the user command input in screenfield <code>%scrfcmd</code>.  The <var>[[$SirMsg]]</var> argument identifies the number of the line to be returned from a procedure designated by <var>[[$SirMsgP]]</var> (not shown).
<p class="code">     ...
<p class="code"> ...
  %scr is object screen
%scr is object screen
  %scrfmsg is object screenfield
%scrfmsg is object screenfield
  %scrfcmd is object screenfield
%scrfcmd is object screenfield
  %scrfmsg = %sscr:<var>addField</var>(row=3, column=1, -
%scrfmsg = %sscr:<var>addField</var>(row=3, column=1, -
  width=%scr:columns - 1, -
width=%scr:columns - 1, color=red)
                color=red)
  ...
    ...
%scr:read
  %scr:read
if %scrfcmd:value = 'x' then
  if %scrfcmd:value = 'x' then
  %msg = <var>$Sirmsg</var>(11)
      %msg = <var>$Sirmsg</var>(11)
if %scrfcmd:value = 'y' then
  if %scrfcmd:value = 'y' then
  %msg = <var>$Sirmsg</var>(12)
      %msg = <var>$Sirmsg</var>(12)
  ...
    ...
%scrfmsg:<var>value</var> = %msg
  %scrfmsg:<var>value</var> = %msg
  ...
    ...
</p>
</p>


==See also==
==See also==
<ul><li>The <var>[[Screen class#AddField function|AddField]]</var> method, whose <var>Value</var> parameter can set display data when the <var>ScreenField</var> is instantiated.
<ul>
<li>The <var>[[Screen class#AddField function|AddField]]</var> method's <var>Value</var> parameter can set display data when the <var>ScreenField</var> is instantiated.
</ul>
</ul>
{{Template:ScreenField:Value footer}}
{{Template:ScreenField:Value footer}}

Latest revision as of 20:09, 20 November 2012

Set or return the value of a screenfield (ScreenField class)

The Value property sets or returns the value of a ScreenField. The value is set from or copied to a User Language string, and it may be from 0-255 characters in length.

Syntax

%currentString = sfield:Value sfield:Value = newString

Syntax terms

%currentString A User Language string variable to contain the returned sfield data.
sfield A reference to an instance of a ScreenField object.
newString The string value to assign to sfield.

Usage notes

  • After a Read of a Screen object, you use the Value method to get any user-entered data for a non-protected field.
  • For an example using Value to set field display data, see the "Screen object sample code".
  • For an example using Value to get user-entered data, see the example below.

Examples

In the following example, a screenfield %scrfmsg set up to display an error message to the user is populated according to the user command input in screenfield %scrfcmd. The $SirMsg argument identifies the number of the line to be returned from a procedure designated by $SirMsgP (not shown).

... %scr is object screen %scrfmsg is object screenfield %scrfcmd is object screenfield %scrfmsg = %sscr:addField(row=3, column=1, - width=%scr:columns - 1, color=red) ... %scr:read if %scrfcmd:value = 'x' then %msg = $Sirmsg(11) if %scrfcmd:value = 'y' then %msg = $Sirmsg(12) ... %scrfmsg:value = %msg ...

See also

  • The AddField method's Value parameter can set display data when the ScreenField is instantiated.