ThisWindow

ThisWindow

A data structure that provides information about the state of the system and of the current window at the time of the last event in that window.

The ThisWindow data structure provides information about the state of the system and of the current window at the time of the last event in that window.

The ThisWindow structure contains a number of fields that are reset when the current window changes. By trapping these values, the application enables the user to change the current window and later return to pick up where things were left.

If the current window is non-modal, note that the last event in the window is not necessarily the last event in the interface overall.

The fields in the ThisWindow structure are

AltKey, CtrlKey, ShiftKey, EventName, EventTag, EventType, KeyPressed, MouseClick, ScrollingKey, WindowCol, WindowHeight, WindowName, WindowNum, WindowRow, WindowState, WindowTag, WindowWidth

Syntax #1 – AltKey, CtrlKey, ShiftKey

The state of the Alt, Ctrl or Shift key at the time of the last event in the current window.

thiswindow.altkey

thiswindow.ctrlkey

thiswindow.shiftkey

Return Value

“1” ($True), or “0” ($False), character string (binary). Can be reset by an application program.

Description

The variables indicate the state of the Alt, Ctrl and Shift keys at the time of the last event in the current window.

Each variable is set to ‘1’ ($True) if the corresponding key was down when the last event in the current window occurred. Otherwise, each is set to ‘0’ ($False).

Syntax #2 – EventName

Identifies the last event that occurred in the current window.

thiswindow.eventname

One of

Break, Canceled, Click, Closed, DoubleClick, GotFocus, HangUp, LostFocus, LostFocusModified, Modified, PanicExit, Timeout, WindowFocusSwitch, or keyname

Cannot be reset by an application program.

Return Value

Character string (alpha). Can be reset by an application program.

Description

Identifies, by name, the last event to occur in the current window.

This variable is not set in all operating environments.

ThisWindow.EventType gives additional information about the type of event, and ThisWindow.EventTag gives additional information about the type of object involved in the event.

Syntax #3 – EventTag

Identifies the tag of the object in which the last event in the current window occurred.

thiswindow.eventtag

Return Value

The identification tag of the object in which the last event in the current window occurred. Can be reset by an application program.

Description

Identifies the object in which the last event in the current window occurred.

The identification tag selected varies with the type of object involved in the event.

ThisWindow.EventName names the event, and ThisWindow.EventType gives additional information about the type of event.

Can be, depending on the type of object involved

EventType TypeSource for EventTag Value
WindowEvent.WindowTag
MenuEvent.MenuTag
MenuitemEvent.MenuItemTag
FormEvent.FormTag
FormfieldEvent.FieldTag
AcceleratorEvent.FieldTag
SystemEvent.FieldTag

Syntax #4 – EventType

Identifies the type of event that last occurred in the current window.

thiswindow.eventtype

One of

Window, Menu, MenuItem, Form, FormField, Accelerator, System

Return Value

Character string (alpha). Can be reset by an application program.

Description

Identifies the type of event that last occurred in the current window. ThisWindow.EventName names the event, and ThisWindow.EventTag identifies the object in which the event occurred.

Syntax #5 – KeyPressed

Indicates the key that, pressed, caused the event that last occurred in the current window.

thiswindow.keypressed

Return Value

Character string (alpha). Can be reset by an application program.

Description

The name of the key that, pressed by the application user, caused the last event to occur in the current window. Can be reset by an application program.

For example, if the application user presses the a key in a form field and the Modified event is intercepted by the application program, then ThisWindow.KeyPressed is set to “a”.

Note: The name of the key that caused an accelerator event is recorded in the ThisWindow.EventName variable.

Syntax #6 – MouseClick

Indicates if a mouse button accelerator caused the event that last occurred in the current window.

thiswindow.mouseclick

Return Value

“1” ($True), or “0” ($False). Can be reset by an application program.

Description

Set to “1” ($True) if the last event to occur in the current window was caused by the press of a mouse button that is defined as an accelerator for the window. Otherwise, set to “0” ($False).

If SET MOUSE is OFF, ThisWindow.MouseClick is 0.

Syntax #7 – ScrollingKey

Indicates if the accelerator that caused the event that last occurred was also a defined SCROLL key.

thiswindow.scrollingkey

Return Value

“1” ($True), or “0” ($False). Can be reset by an application program.

Description

Set to “1” ($True) if the accelerator key that caused the last event in the current window was also a defined SCROLL key. Otherwise, set to “0” ($False).

Example

window set scroll Up up Down down
window set accelerator up down escape
form open fEmployee
form set scroll fEmployee from EmpSet
form display
while
if thiswindow.scrollingkey = $true
change EmpSet from fEmployee
form scroll
continue
endif
… other commands …
endwhile

In the preceding code fragment, employee records are scrolled through a form and the application user can update the data. ThisWindow.ScrollingKey detects if a scrolling key was pressed, enabling the scrolling action to be performed under program control after any changes to the data are saved.

Syntax #8 – ScrollingKey

thiswindow.scrollingkey

Return Value

Character string (binary). Can be reset by an applicatio
n program.

Description

The variable indicates if the accelerator that cased the event that last occurred was also a defined SCROLL key.

ThisWindow.ScrollingKey is set to ‘1’ ($True) if the accelerator that caused the last event in the current window was also a defined SCROLL key. Otherwise, it is set to ‘0’ ($False).

Syntax #9 – WindowCol, WindowRow

The character column or row position of the current window.

thiswindow.windowcol

thiswindow.windowrow

Return Value

A number. Cannot be reset by an application program.

Description

The variables indicate the physical size of the current window in character rows (WindowHeight) and character columns (WindowWidth).

The physical dimensions of a window determine the visible space inside the window (i.e., the client area). This area changes in size when the dimensions of the window change. An application user can change the size of a window by using the resize feature. A program can change the size of a window using the WINDOW SIZE command.

An application program can position a window using the WINDOW MOVE command.

Syntax #10 – WindowHeight, WindowWidth

The physical height or width of the current window in character rows.

thiswindow.windowheight

thiswindow.windowwidth

Return Value

Number (INT). Cannot be reset by an application program.

Description

The variables indicate the physical size of the current window in character rows (WindowHeight) and character columns (WindowWidth).

The physical dimensions of a window determine the visible space inside the window (i.e., the client area). This area changes in size when the dimensions of the window change. An application user can change the size of a window by using the resize feature. A program can change the size of a window using the WINDOW SIZE command.

Syntax #11 – WindowName

The name of the current window.

thiswindow.windowname

Return Value

A character string. Can be reset by an application program.

Description

The variable identifies, by name, the current window.

Example

You can use ThisWindow.WindowName to restore the focus to a window, making it the current window:

let SaveWin = ThisWindow.WindowName
window open Window2
… other commands …
window set current SaveWin

Syntax #12 – WindowNum

The identification number of the current window.

thiswindow.windownum

Return Value

A number. Can be reset by an application program.

Description

The variable identifies, by identification number, the current window.

Syntax #13 – WindowTag

thiswindow.windownum

Return Value

Character string (alpha). Can be reset by the application program.

Description

The variable identifies, by identification tag, the current window.

Syntax #13 – WindowState

Indicates whether the current window is maximized, minimized, or otherwise.

thiswindow.windownum

Return Value

A number. Cannot be reset by an application program.

Description

Indicates the state of the current window at the time of the last event in that window.

ValueMeaning
-1The current window is minimized.
0The current window is neither minimized nor maximized.
1The current window is maximized.

See Also

FORM INPUT

FORM SET

MENU INPUT

MENU SET

SCREEN CLEAR

SCREEN RESET

ThisForm

WINDOW SET

CHANGE

Changes data in EntitySets, relationships, forms, or result sets.

Syntax #1

Changes specific fields in one or more records in an EntitySet, relationship, form, or set. The existing values in target fields are changed to specified values. The LET subcommand explicitly assigns values to the target fields. Only fields explicitly named in the LET subcommand are changed.

CHANGE [num] [setspec] [LET clause] [EVALUATE clause] [-> clause]

Syntax #2

Changes one or more records in an EntitySet, relationship, form, or set from data found in a set specification. Data for the target fields in the records is taken from a specified set. The LET subcommand can be used to direct the source data to particular target fields, and, if desired, to process the source data in some manner before assignment.

CHANGE [num] [setspec] [FROM source] [LET clause] [EVALUATE clause] [-> clause]

Syntax #3

Changes one or more records in an EntitySet, relationship, form, or set from data found in an application document. Date for the target fields in the records is taken from an unstructured application document or a set whose only component is an unstructured application document. You can use the FORMAT clause to direct the source data to particular target fields. The PROMPT clause performs the same function, but, in addition, sends the field names and their current values to the current output destination for display. You can use the LET subcommand to process the source data in some manner before assignment.

CHANGE [num] [setspec] FROM doc [LET clause]

[FORMAT | PROMPT [field]] [EVALUATE clause] [-> clause]

Parameters

numCan be
an integer constant (15, 200);
a variable, form field, or parameter that evaluates to an integer;
the word ALL.
If num is omitted, or less than 0, it defaults to 1.
setspecThe set specification (made up of application documents, EntitySets, relationships, forms, or result sets), designating the records to be changed. If omitted, the current set (if available) is used.
Application documents named in the set specification cannot be updated.
sourceThe set specification where the data to replace the existing values in setspec can be found. If omitted, the data is taken from the current set (if available).
docThe name of an unstructured application document, or a result set whose only component is an unstructured application document, from which you are taking data to replace existing values in setspec.
FORMATSpecifies the order in which data for the specified fields of setspec appears in doc. If omitted, the data is assumed to appear in full, field-sequential order (as setspec’s fields were defined). Used to direct the source data to particular target fields.
PROMPTSpecifies the order in which data for the specified fields of setspec appears in doc (which is normally TERMINAL in this context), and displays the field name(s) on the terminal. If omitted, prompts for the data appear in full, field-sequential order (as the fields were defined for setspec). Used to direct the source data to particular target fields.
fieldSpecifies one or more fields that are to be prompted for or formatted. If omitted from the PROMPT or FORMAT clause, all fields in the object being changed are prompted for or formatted.

Comments

Any number of fields can be assigned a value through the LET clause. Any target field that has not explicitly been assigned a data value by LET is supplied with a data value from the field in source that has the same name (if any). If no field in source has the same name as a target field and if no value has been explicitly assigned, then the target field is left unchanged.

The FORMAT clause specifies the order in which data for each field appears. The PROMPT clause performs the same function, but, in addition, it displays the field names and the old values on the terminal. Target fields not assigned data values by LET, FORMAT, or PROMPT are left unchanged.

Special rules apply when data is taken from an unstructured application document to change the values in target fields:

  • If the current delimiter is not a space (see the SET DELIMITER command), then two delimiters side-by-side indicate that a field is $Null. For example, if a slash (/) were the delimiter, then abc/def// would generate three assignments: abc, def, and $Null.
  • If the current line in the application document does not contain enough values for the fields in the records, the remaining fields are left unchanged.
  • An input line of zero length is taken as an end-of-file indicator and stops the CHANGE command, unless a SET EOFVALUE command has been issued.
  • An asterisk (*) used with CHANGE indicates that an existing value is to be left untouched. To specify an asterisk as a literal character, place a backslash () preceding it.

Before all fields are assigned their new values, they are checked to ensure that a required field is not $Null. If a required field is $Null, an error is generated and the record is not changed. This check can be turned off with the SET CHECKNULLS command.

Messages marking the progress of a CHANGE command can be displayed on the terminal. See SET MEMBERCOUNT and SET MEMBERINTERVAL for details.

Refrain from using the CHANGE command to modify records to the Object Dictionary EntitySets for user interface objects (windows, menus, forms/displays, and form field/menu items).
The records contain many fields, often with important inter-field dependencies. Records modified using CHANGE are not validated in the usual way, and incorrect values in the record could cause the software to behave unexpectedly or even crash.
Use the Screen Painter to modify all user interface objects.

Rules for Value Assignments to Fields During CHANGE

The software assigns a value to each target field based on the first of the following situations that holds true for that field:

  1. The target field is explicitly assigned a new value in a LET subcommand.
  2. The structured source object contains an identically-named field whose value is implicitly assigned to the target field.

OR

The unstructured source object contains a value in the sequential position that matches the sequential position of the target field’s name in the FORMAT or PROMPT clause.

OR

The unstructured source object contains a value in the same sequential position of the target field in the records. This occurs when no FORMAT or PROMPT clause is supplied, or when the clause does not specify field names.

  1. In all other cases, the value of the target field does not change.

Once new values have been determined for all target fields in the record, the software checks to ensure that a Required field is not $Null. If a Required field is $Null, the software raises an error, and the record is not changed. This check can be switched off with a SET CHECKNULLS OFF command.

Special rules apply when the data in an EntitySet or relationship is being changed using data from an unstructured application document (Syntax #3):

  1. The $Null property can be explicitly assigned to a field using the following technique:
    • If the current delimiter is not a space (see SET DELIMITER), then two delimiters side-by-side explicitly indicate an unassigned value ($Null). For example, if a slash (/) is the delimiter, then abc/def// generates three values: abc, def and $Null.
  2. If a line in the document fails to provide a value for every field in the record being changed, each field not assigned a value remains unchanged.
  3. An asterisk (*) explicitly indicates a field that is to be left unchanged. For example, abc * def generates three values: abc, “no change”, and def. To specify an asterisk as a literal character, place a backslash ( – Escape) before it. For example, if you want a particular field to have the value 5*6, type 5*6 into the source document. Alternatively, use SET SPECIALSCAN to control how the metacharacters backslash () and asterisk (*) are to be handled when they appear in an unstructured application document that is being used as a data source. When SET SPECIALSCAN is ON, the backslash and asterisk characters have their special meanings. When SET SPECIALSCAN is OFF, the backslash and asterisk characters are treated as ordinary data.
  4. A line of zero length in the source document (i.e., the line consists solely of a carriage return or a newline character) is taken as an end-of-file indicator by default. The CHANGE command stops unless a SET EOFVALUE command has been issued.

Example

change all Emps from terminal prompt LastName FirstName

LastName  FirstName

Smith   John

:

Prompts with the existing values for each record and waits for input.

LastName  FirstName

Smith   John

:* Jim

LastName  FirstName

Jones   Fred

:

Typing * Jim and pressing Return changes the first name from John to Jim. A prompt for the next record appears.

LastName  FirstName

Jones   Fred

:Johnston

LastName  FirstName

Samuels  Jim

:

Typing Johnston and pressing Return changes the last name from Jones to Johnston. A prompt for the next record appears.

Pressing Return without typing anything terminates the CHANGE command.

change WaterSamples from fWaterSamples

Updates an EntitySet based on the data in a form.

change Employees (unrelated) WorkOn Projects

sorted by LastName from NewProjects

where ProjAssigned = “N”

sorted by ProjDate descending

let Employees.ProjNum = NewProjects.ProjId

Assigns a new project to Employees that are not currently working on a project. The employee records that are unrelated to any project are sorted in LastName order. The sorted records are updated from the set of NewProjects that are not assigned (ProjAssigned=”N”).

change let LastName = “Smith”

Changes the last name in the current member of the current set.

change all Employees where DeptNum = D01 let DeptNum = D02

Changes department number D01 to D02 for the entire set.

form open dInvoice

change all fInvItem from LineItems

form display input

Fills the occurrences of a particular form with data from a particular set.

See Also

ADD

UPDATE

Reserved Characters and Words

Certain characters and words are reserved for special purposes in the Zim software.

Reserved Characters

These characters are sometimes called meta-characters. Reserved characters include

  • quotation marks (” and ‘) that define and enclose character strings
  • spaces that are the default field separator (delimiter)
  • backslashes () that escape other characters
  • percent signs (%) that mark the start of a comment
  • question marks (?) that, when not in quotation marks, are a wildcard indicator
  • braces ({ and }) that mark and enclose case expressions

Reserved Words

You cannot use any reserved word as a database, application, or filename in Zim. Reserved words include

  • any automatically generated filename in the form “prefix_99999″ where the prefix is a name automatically generated by Zim
  • the strings, words, commands, and function names are found in the following table:
$absolute$toupperinout
$acos$tovirtualinput
$adddays$translateinsert
$addhours$trimintersect
$addminutes$truncateinto
$addmonths$ttrimis
$addseconds$userfunctionkeep
$addticks$usrfn1label
$addweeks$usrfn2leftmargin
$addyears$usrfn3let
$and$valuelevel
$ansitodos$weekdayli
$asin$wraplike
$atan$yearline
$atan2accesslist
$averageacrosslocal
$browsefileactivatelocalprocedure
$centeraddlocate
$centrealllogin
$chopalwaysmask
$compilestatusandmax
$concatanymaximize
$cosappendmenu
$coshasmessages
$countascendingmethod
$currentmemberatmin
$dayavgminimize
$daynamebackgroundminus
$ddefunctionbeginmousepointer
$deletebetweenmove
$dirpathbordernewline
$distinctbottomnewpage
$dostoansibottommarginnext
$errmsgbreakablenoprint
$eventparameterbyenot
$exist$callnull
$expcaseobjectevent
$filebrowsecenteroff
$filenumcentreoldline
$filepathchangeon
$fileprintclassopen
$fillclearscreenor
$fncloseorder
$getpropertycolumnotherwise
$hourscolumnbreakoutput
$insertcolumnspacingowner
$isalphabeticcommitpage
$isalphanumericcompilepagelines
$isdatecompletepagesize
$isdigitscomputepagewidth
$islowerconnectparse
$isnumberconstpassword
$isnumericconstantpause
$isoddcontinuepencolor
$isuppercountpermission
$iswinopencreate$$pointsize
$iszimnamecurrentsetprevious
$javacursorprint
$lastmemberdeactivateprocedure
$leftdeadlockprompt
$leftjustifydecryptquittransaction
$lengthdefaulttyperead
$logdefinerelationship
$log10deleterelease
$ltrimdependencyremoteexec
$maskdescendingrename
$maxdetailreport
$maxofdirectoryrequired
$messageboxdisconnectreset
$mindisplayrestore
$minofdisposereturn
$minutesdistinctright
$modulusdocumentrole
$moneydownrollback
$monthdynamiclistsave
$monthnameeditscreen
$notelsescroll
$nullelseifselectivity
$objcreateencryptserverexec
$objdestroyendset
$objgetpropertyendcasesize
$objrunmethodendclasssleep
$objsetpropertyendifsome
$objstatusendmethodsorted
$objsubroutineendonspaces
$oleinsertdialogendprocedurespan
$oleobjectattrsendreportstartcase
$orendtransactionstatusbartext
$pagesetupendwhilestop
$paintfunctionentsum
$positionentersuppress
$printersetupentitysetsystem
$randomeraseto
$replaceerrorstoolbar
$replicateevaluatetop
$rightexceptiontopmargin
$rightclickmenuexectransaction
$rightjustifyexiststransform
$roundexposetransmit
$screenprintfieldtrim
$screensavefillcoloruncompile
$secondsfindunderline
$sendtoserverfld
$serverfunctionflowunrelated
$setpropertyfocusup
$sinfontupdate
$sinhfontsizeusing
$snfootingvalues
$soundexforvariable
$sqrtforegroundverb
$squeezeformwarnings
$substringformatwh
$sysdiridfromwidth
$sysseqnofunctionkeyswhen
$tangeneratewhere
$tanhgotowhile
$ticksgraphwidth
$toalphagroupwindow
$tocharacterhavingwork
$tochrheadingswrap
$todatehelpxor
$tolowerhidexref
$tonumberif
$toordimmediately
$totalin

$year

Extracts the year number associated with a specified date value.

Syntax

$year(date)

Parameters

datea data, or an expression that evaluates to a date, in the form YYYYMMDD

Return Value

Character string.

Comments

This function extracts day information from standard date values. Date is often the system variable $Date.

Example

$year(19981225)

Evaluates to “1998”.

$year($date + 7)

Evaluates to “1999” when $Date is 19991225.

See Also

$addyears

$Date

$day

$dayname

$month

$monthname

$weekday

About Data Types

About Functional Expressions

$iszimname

Tests if a character string is a valid object name.

Syntax

$iszimname(string)

Parameters

stringa character string or an expression that evaluates to a character string

Return Value

1-character binary string. Evaluates to 1 ($True) if string meets the validation test; otherwise, evaluates to 0 ($False).

Comments

This function tests if a particular character string is valid zim object name.

Example

$iszimname(189)

Evaluates to $False.

$iszimname("Fields")

Evaluates to $True.

See Also

$isalphabetic

$isalphanumeric

$isdate

$isdigit

$islower

$isnumber

$isupper

About Character Literals

About Functional Expressions

SET PAGEWIDTH

Controls the overall width of pages output by the LIST command.

Syntax

SET PAGEWIDTH num

Parameters

numNum specifies, in characters, the width of an output page.
Num can be
an integer constant (e.g., 15, 200).
a variable, form field, menu item, or parameter that evaluates to an integer.

Comments

The PAGEWIDTH option is set to 80 characters by default.
If the data generated by LIST or SELECT exceeds the current PAGEWIDTH, the software assumes that the output device wraps data onto subsequent lines.

Example

set output printer

set pause on

set pagesize 40

set pagewidth 120

list all Employees sorted by Department

Here, the SET PAGEWIDTH command (together with SET PAGESIZE) sets LIST output for printing in the landscape orientation.

See Also

SET HEADINGS

SET PAUSE

$weekday

Determines the day-of-the-week number associated with a specified date value.

Syntax

$weekday(date)

Parameters

datea date, or an expression that evaluates to a date, in the form YYYYMMDD

Return Value

Character string.

Comments

This function extracts day information from standard date values. Date is often the system variable $Date.

Example

$weekday(19981225)

Evaluates to “7”.

$weekday($date+7)

Evaluates to “7” when $Date is 19981225.

See Also

$addmonths

$Date

$day

$dayname

$month

$monthname

$year

About Data Types

About Functional Expressions

$isnumber

Tests if an expression produces a valid number after its evaluation.

Syntax

$isnumber(expression)

Parameters

expression            a character string or an expression that evaluates to a character string

Return Value

Returns 1 ($True) if string meets the validation test; otherwise, returns 0 ($False).

Example

$isnumber(2+3)
$isnumber($trim("  3.5"))

Evaluates to $True.

$isnumber($trim(LastName))

Evaluates to $False.

See Also

$isalphabetic

$isalphanumeric

$isdate

$isdigit

$islower

$isupper

$iszimname

About Character Literals

About Functional Expressions

$toord

Converts a character into its ordinal number value.

Syntax

$toord(char)

Parameters

chara character string, or any expression that evaluates to a character string

Return Value

Number.

Comments

Each of the decimal numbers from 0 to 255 represents a character output by your workstation. $Toord converts the given character to the corresponding decimal number.

If char contains more than one character, only the first character is converted.

The number produced by the $toord function can be converted back to a character by the $tochr function.

Example

$toord(" ")

Evaluates to 32 (on ASCII machines).

$toord(tochr(anynumber ))

Evaluates to any number.

See Also

$toalpha

$tocharacter

$tochr

$todate

About Functional Expressions

Number Literals

SET PAGESIZE

Controls the overall length of pages output by the LIST command.

Syntax

SET PAGESIZE num

Parameters

numNum specifies, in lines, the height of an output page.
Num can be:
an integer constant (e.g., 15, 200);
a variable, form field, menu item, or parameter that evaluates to an integer.

Comments

The PAGESIZE option is set to 24 lines by default.

The PAGESIZE option should be adjusted to suit the current output device (e.g., 66 lines for a printer, 24 lines for a terminal screen).

Example

set output printer
set pause on
set pagesize 40
set pagewidth 120
list all Employees sorted by Department

Here, the SET PAGESIZE command (together with SET PAGEWIDTH) sets LIST output for printing in the landscape orientation.

See Also

LIST

SET HEADINGS

SET PAGEWIDTH

SET PAUSE

pt_BRPortuguese