cdk_template(3) cdk_template(3)
NAME
newCDKTemplate, activateCDKTemplate, injectCDKTemplate, setCDKTemplate, setCDKTemplateValue, getCDKTemplateValue, setCDKTemplateMin, getCDKTemplateMin, setCDKTemplateBox, getCDKTemplateBox, setCDKTemplateULChar, setCDKTemplateUR- Char, setCDKTemplateLLChar, setCDKTemplateLRChar, setCDK- TemplateVerticalChar, setCDKTemplateHorizontalChar, setCD- KTemplateBoxAttribute, setCDKTemplateBackgroundColor, setCDKTemplateCB, drawCDKTemplate, eraseCDKTemplate, cleanCDKTemplate, mixCDKTemplate, unmixCDKTemplate, destroyCDKTemplate, setCDKTemplatePreProcess, setCDKTem- platePostProcess - Creates a managed curses template wid- get.
SYNOPSIS
cc [ flag ... ] file ... -lcdk [ library ... ] #include <cdk.h> CDKTEMPLATE *newCDKTemplate (CDKSCREEN *cdkscreen, int xpos, int ypos, char *title, char *label, char *plate, char *overlay, boolean box, boolean shadow); char *activateCDKTemplate (CDKTEMPLATE *template, chtype * actions); char *injectCDKTemplate (CDKTEMPLATE *template, chtype input); void setCDKTemplate (CDKTEMPLATE *template, char *value, boolean box); void setCDKTemplateValue (CDKTEMPLATE *template, char *value); char *getCDKTemplateValue (CDKTEMPLATE *template); void setCDKTemplateMin (CDKTEMPLATE *template, int mini- mum); int getCDKTemplateMin (CDKTEMPLATE *template); void setCDKTemplateBox (CDKTEMPLATE *template, boolean box); boolean getCDKTemplateBox (CDKTEMPLATE *template); void setCDKTemplateCB (CDKTEMPLATE *template, TEMPLATECB callbackFunction); void setCDKTemplateULChar (CDKTEMPLATE *,template, chtype character); void setCDKTemplateURChar (CDKTEMPLATE *,template, chtype 18 March 1997 1 cdk_template(3) cdk_template(3) character); void setCDKTemplateLLChar (CDKTEMPLATE *,template, chtype character); void setCDKTemplateLRChar (CDKTEMPLATE *,template, chtype character); void setCDKTemplateVerticalChar (CDKTEMPLATE *,template, chtype character); void setCDKTemplateHorizontalChar (CDKTEMPLATE *,template, chtype character); void setCDKTemplateBoxAttribute (CDKTEMPLATE *,template, chtype character); void setCDKTemplateBackgroundColor (CDKTEMPLATE *,tem- plate, char * color); void moveCDKTemplate (CDKTEMPLATE *template, int box, int box, boolean relative, boolean refresh); void positionCDKTemplate (CDKTEMPLATE *template); void drawCDKTemplate (CDKTEMPLATE *template, boolean box); void eraseCDKTemplate (CDKTEMPLATE *template); void cleanCDKTemplate (CDKTEMPLATE *template); char *mixCDKTemplate (CDKTEMPLATE *template); char *unmixCDKTemplate (CDKTEMPLATE *template); void destroyCDKTemplate (CDKTEMPLATE *template); void setCDKTemplatePreProcess (CDKTEMPLATE *template, PRO- CESSFN callback, void * data); void setCDKTemplatePostProcess (CDKTEMPLATE *template, PROCESSFN callback, void * data); void bindCDKObject (EObjectType widgetType, void *object, chtype key, BINDFN function, void *data);
DESCRIPTION
The Cdk template widget creates a template widget which allows a user to type information into an entry field with a pre-set field format. Typical uses for this widget would be a date field or a time field. The following are func- tions which create or manipulate the Cdk template box wid- get. 18 March 1997 2 cdk_template(3) cdk_template(3)
AVAILABLE FUNCTIONS
CDKTEMPLATE *newCDKTemplate (CDKSCREEN *screen, int xpos, int ypos, char *title, char *label, char *plate, char *overlay, boolean box, boolean shadow); This function creates a pointer to a template widget. The screen parameter is the screen you wish this widget to be placed in. The parameter xpos controls the place- ment of the object along the horizontal axis. This parameter can accept an integer value or one of the pre-defined values of LEFT, RIGHT, and CENTER. The parameter ypos controls the placement of the object along the vertical axis. This parameter can accept an integer value or one of the pre-defined values of TOP, BOTTOM, and CENTER. The title parameter is the string which will be displayed at the top of the widget. The title can be more than one line; just provide a car- riage return character at the line break. The label parameter is the string which will be displayed in the label of the template field. The plate parameter defines what character is allowed at what position in the template field. This is done by creating a charac- ter plate by using special format character to tell the template widget what type of character is allowed where in the template widget. The following table lists all of the current format types. Plate_Character Effect # Accepts an integer value. A Accepts an alphabetic value. C Accepts an alphabetic value. Automatically converts the character to upper case. c Accepts an alphabetic value. Automatically converts the character to lower case. M Accepts alphanumeric characters. X Accepts alphanumeric characters. Automatically converts the character to upper case. x Accepts alphanumeric characters. Automatically converts the character to upper case. Anything else Ignored and assumed a non-editable position. The overlay parameter is the overlay of the template field. If the field needed some sort of overlay, this parameter supplies this. A date field could have YY/MM/DD, the overlay parameter would display YY/MM/DD on an empty template field. The box parameter states whether the widget will be drawn with a box around it or not. The shadow parameter accepts a boolean value to turn the shadow on or off around this widget. The box parameter states whether the widget will be drawn with a box around it or not. The shadow parameter accepts a boolean value to turn the shadow on or off around this widget. If the widget could not be created then a NULL pointer is returned. 18 March 1997 3 cdk_template(3) cdk_template(3) char *activateCDKTemplate (CDKTEMPLATE *template, chtype *actions); This function activates the template widget and lets the user interact with the widget. The parameter tem- plate is a pointer to a non-NULL template widget. If the actions parameter is passed with a non-NULL value, the characters in the array will be injected into the widget. To activate the widget interactively pass in a NULL pointer for actions. If the character entered into this widget is RETURN or TAB then this function will return a char * representing the information typed into the widget and the structure member exitType will be set to vNORMAL. If the character entered was ESCAPE then the function will returns NULL pointer and the structure member exitType is set to vESCAPE_HIT. char *injectCDKTemplate (CDKTEMPLATE *template, chtype character); This function injects a single character into the wid- get. The parameter template is a pointer to a non-NULL template. The parameter character is the character to inject into the widget. If the character injected into this widget was RETURN or TAB then this function will return a char * representing the information typed into the widget and the structure member exitType will be set to vNORMAL. If the character entered was ESCAPE then the function will returns NULL pointer and the structure member exitType is set to vESCAPE_HIT. Any other character injected into the widget will set the structure member exitType to vEARLY_EXIT and the func- tion will return a NULL pointer. void setCDKTemplate (CDKTEMPLATE *template, char *value, boolean box); This function lets the programmer modify certain ele- ments of an already defined template widget. The param- eter names correspond to the same parameter names listed in the newCDKTemplate function. void setCDKTemplateValue (CDKTEMPLATE *template, char *value); This sets the value in the widget. char *getCDKTemplateValue (CDKTEMPLATE *template); This returns the current value of the widget. void setCDKTemplateMin (CDKTEMPLATE *template, int min); This sets the minimum number of characters that have to be entered before the widget will exit. int getCDKTemplateMin (CDKTEMPLATE *template); This returns the minimum characters that have to be entered before the widget will exit. 18 March 1997 4 cdk_template(3) cdk_template(3) void setCDKTemplateBox (CDKTEMPLATE *template, boolean Box); This sets whether or not the widget will be draw with a box around it. boolean getCDKTemplateBox (CDKTEMPLATE *template); This returns whether or not the widget will be drawn with a box around it. void setCDKTemplateULChar (CDKTEMPLATE *template, chtype character); This function sets the upper left hand corner of the widgets box to the given character. void setCDKTemplateURChar (CDKTEMPLATE *template, chtype character); This function sets the upper right hand corner of the widgets box to the given character. void setCDKTemplateLLChar (CDKTEMPLATE *template, chtype character); This function sets the lower left hand corner of the widgets box to the given character. void setCDKTemplateLRChar (CDKTEMPLATE *template, chtype character); This function sets the lower right hand corner of the widgets box to the given character. void setCDKTemplateVerticalChar (CDKTEMPLATE *template, chtype character); This function sets the vertical drawing character for the box to the given character. void setCDKTemplateHorizontalChar (CDKTEMPLATE *template, chtype character); This function sets the horizontal drawing character for the box to the given character. void setCDKTemplateBoxAttribute (CDKTEMPLATE *template, chtype attribute); This function sets the attribute of the box. void setCDKTemplateBackgroundColor (CDKTEMPLATE *template, char *color); This sets the background color of the widget. The parameter color is in the format of the Cdk format strings. To get more information look at the cdk_dis- play manual page. void setCDKTemplateCB (CDKTEMPLATE *template, TEMPLATECB callbackFunction); This function allows the programmer to set a different widget input handler. The parameter callbackFunction 18 March 1997 5 cdk_template(3) cdk_template(3) is of type TEMPLATECB. The current default function is CDKTemplateCallBack. void moveCDKTemplate (CDKTEMPLATE *template, int xpos, int ypos, boolean relative, boolean refresh); This function moves the given widget to the given posi- tion. The parameters xpos and ypos is the new position of the widget. The parameter xpos can accept an integer value or one of the pre-defined values of TOP, BOTTOM, and CENTER. The parameter ypos can accept an integer value or one of the pre-defined values of LEFT, RIGHT, and CENTER. The parameter relative states whether the xpos/ypos pair is a relative move or an absolute move. For example if xpos = 1 and ypos = 2 and relative = TRUE, then the widget would move one row down and two columns right. If the value of relative was FALSE then the widget would move to the position (1,2). Do not use the values of TOP, BOTTOM, LEFT, RIGHT, or CENTER when relative = TRUE. (weird things may happen). The final parameter refresh is a boolean value which states whether the widget will get refreshed after the move or not. void positionCDKTemplate (CDKTEMPLATE *template); This function allows the user to move the widget around the screen via the cursor/keypad keys. The following key bindings can be used to move the widget around the screen. Key Bindings Key Action Up Arrow Moves the widget up one line. Down Arrow Moves the widget down one line. Left Arrow Moves the widget left one column Right Arrow Moves the widget right one column Keypad-1 Moves the widget down one line and left one column. Keypad-2 Moves the widget down one line. Keypad-3 Moves the widget down one line and right one column. Keypad-4 Moves the widget left one column Keypad-5 Centers the widget both vertically and horizontally. Keypad-6 Moves the widget right one column Keypad-7 Moves the widget up one line and left one column. Keypad-8 Moves the widget up one line. Keypad-9 Moves the widget up one line and right one column. t Moves the widget to the top of the screen. b Moves the widget to the bottom of the screen. l Moves the widget to the left of the screen. r Moves the widget to the right of the screen. c Centers the widget between the left and 18 March 1997 6 cdk_template(3) cdk_template(3) right of the window. C Centers the widget between the top and bottom of the window. Escape Returns the widget to it's original position. Return Exits the function and leaves the widget where it was. Keypad means that if the keyboard you are using has a keypad, then the Num-Lock light has to be on in order to use the keys as listed. (The numeric keys at the top of the keyboard will work as well.) void drawCDKTemplate (CDKTEMPLATE *template, boolean box); This function draws the template widget on the screen. The box option draws the widget with or without a box. void eraseCDKTemplate (CDKTEMPLATE *template); This function removes the widget from the screen. This does NOT destroy the widget. void cleanCDKTemplate (CDKTEMPLATE *template); This function clears the information from the field. char *mixCDKTemplate (CDKTEMPLATE *template); This function returns a char * pointer to the field value and the plate. char *unmixCDKTemplate (CDKTEMPLATE *template); This function returns a char * pointer to the field value without any plate characters. void destroyCDKTemplate (CDKTEMPLATE *template); This function removes the widget from the screen and frees up any memory the object may be using. void setCDKTemplatePreProcess (CDKTEMPLATE *tem- plate, PROCESSFN function, void *data); This function allows the user to have the widget call a function after a key is hit and before the key is applied to the widget. The parameter func- tion if of type PROCESSFN. The parameter data is a pointer to void. To learn more about pre-pro- cessing read the cdk_process manual page. void setCDKTemplatePostProcess (CDKTEMPLATE *tem- plate, PROCESSFN function, void *data); This function allows the user to have the widget call a function after the key has been applied to the widget. The parameter function if of type PROCESSFN. The parameter data is a pointer to void. To learn more about post-processing read 18 March 1997 7 cdk_template(3) cdk_template(3) the cdk_process manual page. void bindCDKObject (EObjectType widgetType, void *object, char key, BINDFN function, void *data); This function allows the user to create special key bindings. The widgetType parameter is a defined type which states what Cdk object type is being used. To learn more about the type EOb- jectType read the cdk_binding manual page. The object parameter is the pointer to the widget object. The key is the character to bind. The function is the function type. To learn more about the key binding callback function types read the cdk_binding manual page. The last param- eter data is a pointer to any data that needs to get passed to the callback function.
KEY BINDINGS
When the widget is activated there are several default key bindings which will help the user enter or manipulate the information quickly. The following table outlines the keys and their actions for this widget. Key Action Delete Deletes the character to the left of the cursor. Backspace Deletes the character to the left of the cursor. Ctrl-P Pastes whatever is in the paste buffer, into the widget. Ctrl-K Cuts the contents from the widget and saves a copy in the paste buffer. Ctrl-T Copies the contents of the widget into the paste buffer. Ctrl-E Erases the contents of the widget. Return Exits the widget and returns a char * representing the information which was typed into the field. It also sets the structure member exitType in the widget pointer to vNORMAL. Tab Exits the widget and returns a char * representing the information which was typed into the field. It also sets the structure member exitType in the widget pointer to vNORMAL. Escape Exits the widget and returns a NULL pointer. It also sets the structure member exitType in the widget pointer to the value of vESCAPE_HIT. Ctrl-L Refreshes the screen.
SEE ALSO
cdk(3), cdk_binding(3), cdk_display(3), cdk_screen(3)
NOTES
The header file <cdk.h> automatically includes the header files <curses.h>, <stdlib.h>, <string.h>, <ctype.h>, <unistd.h>, <dirent.h>, <time.h>, <errno.h>, <pwd.h>, <grp.h>, <sys/stat.h>, and <sys/types.h>. The <curses.h> header file includes <stdio.h> and <unctrl.h>. 18 March 1997 8 cdk_template(3) cdk_template(3) If you have Ncurses installed on your machine add -DNCURSES to the compile line to include the Ncurses header files instead. 18 March 1997 9
Powered by man-cgi (2024-08-26). Maintained for NetBSD by Kimmo Suominen. Based on man-cgi by Panagiotis Christias.