NOTICE() Function - Get SYSGUI Notice String

Syntax

NOTICE(sysgui,nfyid{,ERR=lineref})

Description

The NOTICE() function uses the passed Notify ID and retrieves the Notice string from the SYSGUI channel.

Parameter

Description

sysgui

Valid SYSGUI channel.

nfyid

Value passed in the X field of the event templated string. Nfyid is an integer counter that starts at 1 at the beginning of the program and is incremented throughout the program. After reaching 65535, it recycles back to 1.

The PRO/5 User's Reference Guide provides additional information for the template definition used when reading the event queue. For Notify events, the X field of the event string is not used to pass the horizontal location of the mouse but to pass this parameter for the occurring Notify event.

ERR=lineref

Branch to be taken if an error occurs during execution.

Notify Event Template

The following template is retrieved using NOTICETPL(0,0) and identifies the fields that are common to all Notify events.

context:u(2),code:i(1),id:u(2),objtype:i(2)

Field

Description

context

Context the event occurred in.

code

Notify event code.

id

ID of the resource that caused the event.

objtype

Type of resource that caused the event.

The remaining portion of the template is specific to each control. See Grid control, Tab control, Edit control, List Edit controls, INPUTE and INPUTN controls, and List Button.

Example

The following example shows the basic structure of an event loop in a Visual PRO/5 program, including details on how to interpret arbitrary Notify events:

sysgui=unt; open (sysgui)"X0"
print (sysgui)'window'(0,40,640,400,"Event Loop",$0401088f$,$ffffffff$)
print (sysgui)'inpute'(101,40,40,200,0,$1000$,10,"","INPUTE")
dim event$:tmpl(sysgui),base$:noticetpl(0,0)
event_len=len(event$),done=0
repeat
read record(sysgui,siz=event_len)event$
switch asc(event.code$)
case asc("N"); rem ' Notify event
base$=notice(sysgui,event.x%); rem ' Get notice string.
Dim notice$:noticetpl(base.objtype%,event.flags%)
notice$=base$; rem ' Assign notice string to template.
Switch notice.objtype%
case 19; rem ' List Button Control
break
case 20; rem ' List Edit Control
break
case 104; rem ' INPUTE Control
switch event.flags
case 1; print hta(notice.key$); rem ' Keypress
break
case 2; print notice.error; rem ' Error
break
swend
break
case 105; rem ' INPUTN Control
break
case 106; rem ' Tab Control
break
case 107; rem ' Grid Control
break
swend; rem notice.objtype%
break
case asc("X"); rem - Close box operated
done=1
swend; rem asc(event.code$)
until done
stop

See Also

Functions - Alphabetical Listing