Previous | Contents |
The Create Key Table routine creates a table for key definitions.
SMG$CREATE_KEY_TABLE key-table-id
OpenVMS usage cond_value type longword (unsigned) access write only mechanism by value
key-table-id
OpenVMS usage identifier type longword (unsigned) access write only mechanism by reference
Receives the identifier of the newly created key table. The key-table-id argument is the address of an unsigned longword into which is written the key table identifier.
SMG$CREATE_KEY_TABLE creates a key definition table. Key definitions can then be added to this table with the SMG$ADD_KEY_DEF, SMG$LOAD_KEY_DEFS, and SMG$DEFINE_KEY routines, and used with the SMG$READ_COMPOSED_LINE routine.
SS$_NORMAL Normal successful completion. SMG$_WRONUMARG Wrong number of arguments. LIB$_INSVIRMEM Insufficient virtual memory.
The Fill the Virtual Display with a Menu routine displays menu choices in the virtual display indicated, starting at the specified row.
SMG$CREATE_MENU display-id ,choices [,menu-type] [,flags] [,row] [,rendition-set] [,rendition-complement]
OpenVMS usage cond_value type longword (unsigned) access write only mechanism by value
display-id
OpenVMS usage identifier type longword (unsigned) access read only mechanism by reference
Display identifier of the virtual display in which the menu is created. The display-id argument is the address of an unsigned longword containing this identifier.choices
OpenVMS usage static array of char_string type character string access read only mechanism by descriptor
Static array in which each element corresponds to an item to be displayed in the menu. The choices argument is the address of a descriptor pointing to this static array of character strings. Note that blank menu items are ignored.menu-type
OpenVMS usage longword_unsigned type longword (unsigned) access read only mechanism by reference
Optional bit mask specifying the type of menu to be displayed. The menu-type argument is the address of a longword bit mask that specifies this menu type. Valid values are as follows:
SMG$K_BLOCK The menu items are displayed in matrix format (default). SMG$K_VERTICAL Each menu item is displayed on its own line. SMG$K_HORIZONTAL The menu items are displayed all on one line. flags
OpenVMS usage mask_longword type longword (unsigned) access read only mechanism by reference
Optional bit mask specifying the attributes to be used for the menu. The flags argument is the address of an unsigned longword that contains the flag. Valid values are as follows:
SMG$M_DOUBLE_SPACE Double-spaced rows of menu items. The default is single spaced. SMG$M_FIXED_FORMAT Each menu item is in a fixed-length field. The field is the size of the largest menu item. The default is compress. SMG$M_WIDE_MENU Wide characters are used in the menu items. The default is normal sized characters. row
OpenVMS usage longword_signed type longword (signed) access read only mechanism by reference
Optional row number in the specified virtual display at which the first menu item is displayed. The row argument is the address of a signed longword that contains this row number. If row is omitted, the first row of the virtual display's scrolling region is used.rendition-set
OpenVMS usage mask_longword type longword (unsigned) access read only mechanism by reference
Attribute specifier. The optional rendition-set argument is the address of a longword bit mask in which each attribute set causes the corresponding attribute to be used when writing out the menu choices. The following attributes can be specified using the rendition-set argument:
SMG$M_BLINK Displays blinking characters. SMG$M_BOLD Displays characters in higher-than-normal intensity. SMG$M_REVERSE Displays characters in reverse video, that is, using the opposite of the default rendition of the virtual display. SMG$M_UNDERLINE Displays underlined characters. SMG$M_USER1 through
SMG$M_USER8Displays user-defined attributes. The display-id argument must be specified when you use the rendition-set argument.
rendition-complement
OpenVMS usage mask_longword type longword (unsigned) access read only mechanism by reference
Attribute complement specifier. The optional rendition-complement argument is the address of a longword bit mask in which each attribute set causes the corresponding attribute to be complemented in the display. All of the attributes that can be specified with the rendition-set argument can be complemented with the rendition-complement argument. The display-id argument must be specified when you use the rendition-complement argument.The optional arguments rendition-set and rendition-complement let the user control the attributes of the virtual display. The rendition-set argument sets certain virtual display attributes, while rendition-complement complements these attributes. If the same bit is specified in both the rendition-set and rendition-complement parameters, rendition-set is evaluated first, followed by rendition-complement. By using these two parameters together, the user can control each virtual display attribute in a single procedure call. On a single-attribute basis, the user can cause the following transformations:
Set Complement Action 0 0 Attribute set to default 1 0 Attribute on 0 1 Attribute set to complement of default setting 1 1 Attribute off
SMG$CREATE_MENU displays a list of menu choices in the virtual display's virtual scrolling region, starting in a specified row. Menu items start in the second column of the virtual display. Multiple menu items on the same row are separated by four spaces.The choices are displayed with the specified rendition attributes in any one of the following formats:
Vertical Each menu item is on its own line. Horizontal The menu items are all on one line. Block The menu items appear in matrix format. Any menu items that do not fit within the bounds of the virtual display are not displayed, but are saved for later scrolling by SMG$SELECT_FROM_MENU. The choices will be single spaced by default, but if requested this can be changed to double spaced. Four spaces separate each menu item horizontally. If requested, the items can also be displayed in fixed format columns where the width of the column is equal to the size of the largest string passed.
After a call to SMG$CREATE_MENU, the user must not output any characters to the display that will disturb the rows containing the newly created menu. If characters are output that do interfere with the menu, unpredictable results will be generated. Use the SMG$SELECT_FROM_MENU routine to select an item from this menu.
SMG$CREATE_MENU supports one-dimensional NCA and VSA string arrays. NCA and VSA string arrays include all string arrays generated by VAX Ada, VAX BASIC, VAX DIBOL, DEC Fortran, VAX Pascal, and VAX PL/I. (Note that if you are calling SMG$CREATE_MENU from VAX BASIC you must still use a MAP statement to declare the array.)
The character set attribute of the menu items are decided by that of the virtual display on which the menu items are displayed.
SS$_NORMAL Normal successful completion. SMG$_INVDIS_ID The display identifier is invalid or contains a viewport. LIB$_xxxx Any condition value returned by LIB$CREATE_VM_ZONE, LIB$GET_VM, and LIB$FREE_VM. SMG$_xxxx Any condition value returned by SMG$PUT_CHARS, SMG$BEGIN_DISPLAY_UPDATE, and SMG$END_DISPLAY_UPDATE.
#module menu "001" /*****************/ /* INCLUDE FILES */ /*****************/ #include <descrip.h> #include <smgdef.h> /************************/ /* EXTERNAL DEFINITIONS */ /************************/ globalvalue SS$_NORMAL; extern int SMG$CREATE_MENU(); extern int SMG$SELECT_FROM_MENU(); extern int SMG$CREATE_PASTEBOARD(); extern int SMG$CREATE_VIRTUAL_DISPLAY(); extern int SMG$CREATE_VIRTUAL_KEYBOARD(); extern int SMG$PASTE_VIRTUAL_DISPLAY(); extern int SMG$PUT_LINE(); extern int LIB$SIGNAL(); extern int LIB$SFREE1_DD(); /*********************/ /* MACRO DEFINITIONS */ /*********************/ #define K_NUM_STRINGS 13 /****************/ /* MAIN PROGRAM */ /****************/ int main (argc, argv) unsigned int argc; char **argv; { struct dsc$descriptor_s s_desc; struct dsc$descriptor_a array_desc; int pbid, kbid, did, did1, sts, s, a_size, n = 0, max_len = 0; char *array, *p; char *months[K_NUM_STRINGS] = {"January", "February", "March", "April", "May", "June","July","August","September", "October", "November", "December", "Exit menu"}; /***********************************************************/ /* Set up the string descriptor for the returned menu item */ /***********************************************************/ s_desc.dsc$w_length = 0; s_desc.dsc$b_dtype = DSC$K_DTYPE_T; s_desc.dsc$b_class = DSC$K_CLASS_D; s_desc.dsc$a_pointer = 0; /*********************************/ /* find length of largest string */ /*********************************/ for (s=0; s<K_NUM_STRINGS; s++) max_len = max_len > strlen(months[s]) ? max_len : strlen(months[s]); /******************************/ /* put the menu choices in vm */ /******************************/ a_size = max_len * K_NUM_STRINGS; p = array = malloc(a_size); for (s=0; s<K_NUM_STRINGS; s++) { strncpy(p, months[s], max_len); p += max_len; }; /***********************************************************/ /* Set up the string array descriptor for the menu choices */ /***********************************************************/ array_desc.dsc$w_length = max_len; array_desc.dsc$b_dtype = DSC$K_DTYPE_T; array_desc.dsc$b_class = DSC$K_CLASS_A; array_desc.dsc$a_pointer = array; array_desc.dsc$b_aflags.dsc$v_fl_bounds = 0; array_desc.dsc$b_dimct = 1; array_desc.dsc$l_arsize = a_size; /*********************************************************/ /* set up the pasteboard, keyboard, and virtual displays */ /*********************************************************/ sts = SMG$CREATE_PASTEBOARD(&pbid); if (sts != SS$_NORMAL) s = LIB$SIGNAL(sts); sts = SMG$CREATE_VIRTUAL_KEYBOARD(&kbid); if (sts != SS$_NORMAL) s = LIB$SIGNAL(sts); sts = SMG$CREATE_VIRTUAL_DISPLAY(&6, &50, &did, &SMG$M_BORDER); if (sts != SS$_NORMAL) s = LIB$SIGNAL(sts); sts = SMG$CREATE_VIRTUAL_DISPLAY(&6, &50, &did1, &SMG$M_BORDER); if (sts != SS$_NORMAL) s = LIB$SIGNAL(sts); sts = SMG$PASTE_VIRTUAL_DISPLAY(&did, &pbid, &2, &2); if (sts != SS$_NORMAL) s = LIB$SIGNAL(sts); sts = SMG$PASTE_VIRTUAL_DISPLAY(&did1, &pbid, &10, &2); if (sts != SS$_NORMAL) s = LIB$SIGNAL(sts); /*******************/ /* set up the menu */ /*******************/ sts = SMG$CREATE_MENU(&did1, &array_desc, &SMG$K_BLOCK, &SMG$M_DOUBLE_SPACE, 0, &SMG$M_BOLD); if (sts != SS$_NORMAL) s = LIB$SIGNAL(sts); while (n<13) { sts = SMG$SELECT_FROM_MENU(&kbid, &did1, &n, 0, 0, 0, 0, 0, &s_desc); if (sts != SS$_NORMAL) s = LIB$SIGNAL(sts); sts = SMG$PUT_LINE(&did, &s_desc); if (sts != SS$_NORMAL) s = LIB$SIGNAL(sts); } /*************************/ /* Free unneeded storage */ /*************************/ free(array); sts = LIB$SFREE1_DD(&s_desc); if (sts != SS$_NORMAL) s = LIB$SIGNAL(sts); return; } |
The Create Pasteboard routine creates a pasteboard and returns its assigned pasteboard identifier.
SMG$CREATE_PASTEBOARD pasteboard-id [,output-device] [,number-of-pasteboard-rows] [,number-of-pasteboard-columns] [,flags] [,type-of-terminal] [,device-name]
OpenVMS usage cond_value type longword (unsigned) access write only mechanism by value
pasteboard-id
OpenVMS usage identifier type longword (unsigned) access write only mechanism by reference
Receives the identifier of the newly created pasteboard. The pasteboard-id argument is the address of an unsigned longword into which is written the new pasteboard identifier.output-device
OpenVMS usage device_name type character string access read only mechanism by descriptor
Specifies the file specification or logical name to which the output associated with this pasteboard will be written. The output-device argument is the address of a descriptor that points to the name of the output device. If omitted, output is sent to SYS$OUTPUT.
Note
An RMS file is not supported as an output device in Korean Screen Management Facility.number-of-pasteboard-rows
OpenVMS usage longword_signed type longword (signed) access write only mechanism by reference
Receives the number of rows on the device specified in the output-device argument. The number-of-pasteboard-rows argument is the address of a signed longword into which is written the number of rows on the specified device, which will be the number of rows in the pasteboard.number-of-pasteboard-columns
OpenVMS usage longword_signed type longword (signed) access write only mechanism by reference
Receives the number of columns on the device specified in the output-device argument. The number-of-pasteboard-columns argument is the address of a signed longword into which is written the number of columns on the specified device.flags
OpenVMS usage mask_longword type longword (unsigned) access read only mechanism by reference
Specifies the attributes to be used in the pasteboard. The flags argument is the address of an unsigned longword that contains the flag. The default action is to clear the screen when the pasteboard is created.Valid value is:
SMG$M_KEEP_CONTENTS The screen is not initially cleared. The Screen Management Facility works best when it can manage the entire screen. Therefore, using SMG$M_KEEP_CONTENTS is discouraged. type-of-terminal
OpenVMS usage mask_longword type longword (unsigned) access write only mechanism by reference
Receives the SMG$ internal device type to which the output associated with this pasteboard will be written. The type-of-terminal argument is the address of an unsigned longword into which is written the terminal type.The returned values are as follows:
SMG$K_UNKNOWN
SMG$K_VTFOREIGN
SMG$K_HARDCOPY
SMG$K_VTTERMTABLEIf a value other than SMG$K_VTTERMTABLE is returned, you must use SMG$SNAPSHOT to output the contents of the pasteboard.
Note
SMG$SNAPSHOT is not supported in Korean Screen Management Facility.
SMG$CREATE_PASTEBOARD creates a new pasteboard, associates it with the device specified by output-device, and returns its assigned pasteboard-id. Note that if you request a pasteboard on a device that already has a pasteboard assigned, this routine returns the pasteboard-id of the existing pasteboard and returns the SMG$_PASALREXI status code.If a program calls both SMG$CREATE_PASTEBOARD and SMG$CREATE_VIRTUAL_KEYBOARD, make sure SMG$CREATE_PASTEBOARD is called first. The program will not function correctly if SMG$CREATE_VIRTUAL_KEYBOARD is called before SMG$CREATE_PASTEBOARD.
SS$_NORMAL Normal successful completion. SMG$_PASALREXI Successful completion. A pasteboard already exists for this device. SMG$_WRONUMARG Wrong number of arguments. LIB$_INSVIRMEM Insufficient virtual memory to allocate needed buffer.
Any condition values returned by LIB$GET_EF, LIB$GET_VM, $QIO, $GETDVI, $ASSIGN.
0 | 1 | 2 | 3 | 4 | 5 | 6 | 1234567890123456789012345678901234567890123456789012345678901234567890 |
#1 |
---|
C* RPG example for SMG$CREATE_PASTEBOARD. C CREPAS EXTRN'SMG$CREATE_PASTEBOARD' C CREDIS EXTRN'SMG$CREATE_VIRTUAL_DISPLAY' C PUTCHA EXTRN'SMG$PUT_CHARS' C PASDIS EXTRN'SMG$PASTE_VIRTUAL_DISPLAY' C Z-ADD0 ZERO 90 C Z-ADD1 LINCOL 90 C Z-ADD2 LINE 90 C Z-ADD5 COLUMN 90 C MOVE 'Menu' OUT 4 C* Create the pasteboard. C CALL CREPAS C PARM PASTID 90 WL C PARMV ZERO C PARM HEIGHT 90 WL C PARM WIDTH 90 WL C* Create the virtual display. C CALL CREDIS C PARM HEIGHT RL C PARM WIDTH RL C PARM DISPID 90 WL C* Output the 'Menu'. C CALL PUTCHA C PARM DISPID RL C PARMD OUT C PARM LINE RL C PARM COLUMN RL C* Paste the virtual display. C CALL PASDIS C PARM DISPID RL C PARM PASTID RL C PARM LINCOL RL C PARM LINCOL RL C SETON LR |
The RPG II program above displays 'Menu' beginning at line 2, column 5.
#2 |
---|
C+ SMG1.FOR C This DEC Fortran example program demonstrates the use of C SMG$CREATE_PASTEBOARD. C- IMPLICIT INTEGER*4 (A-Z) SMG$M_BOLD = 1 SMG$M_REVERSE = 2 SMG$M_BLINK = 4 SMG$M_UNDERLINE = 8 C+ C Establish the terminal screen as a pasteboard C by calling SMG$CREATE_PASTEBOARD. C- STATUS = SMG$CREATE_PASTEBOARD (NEW_PID,,,) IF (.NOT. STATUS) CALL LIB$STOP(%VAL(STATUS)) C+ C Establish a virtual display region by calling C SMG$CREATE_VIRTUAL_DISPLAY. C- STATUS = SMG$CREATE_VIRTUAL_DISPLAY (5,80,DISPLAY_ID,,,) IF (.NOT. STATUS) CALL LIB$STOP(%VAL(STATUS)) C+ C Paste the virtual display to the screen, starting at C row 10, column 15 using SMG$PASTE_VIRTUAL_DISPLAY. C- STATUS = SMG$PASTE_VIRTUAL_DISPLAY(DISPLAY_ID,NEW_PID,10,15) IF (.NOT. STATUS) CALL LIB$STOP(%VAL(STATUS)) C+ C Write three lines to the screen using SMG$PUT_LINE. C- STATUS = SMG$PUT_LINE (DISPLAY_ID,'This line is underlined',2, 1 SMG$M_UNDERLINE,0,,) IF (.NOT. STATUS) CALL LIB$STOP(%VAL(STATUS)) STATUS = SMG$PUT_LINE (DISPLAY_ID,'This line is blinking',2, 1 SMG$M_BLINK,0,,) IF (.NOT. STATUS) CALL LIB$STOP(%VAL(STATUS)) STATUS = SMG$PUT_LINE (DISPLAY_ID,'This line is reverse video',2, 1 SMG$M_REVERSE,0,,) IF (.NOT. STATUS) CALL LIB$STOP(%VAL(STATUS)) END |
Previous Next Contents