cdk_entry(3) - NetBSD Manual Pages




cdk_entry(3)                                         cdk_entry(3)



NAME
newCDKEntry, activateCDKEntry, injectCDKEntry, setCDKEn- try, setCDKEntryValue, getCDKEntryValue, setCDKEntryMax, getCDKEntryMax, setCDKEntryMin, getCDKEntryMin, setCDKEn- tryFillerChar, getCDKEntryFillerChar, setCDKEntryHidden- Char, getCDKEntryHiddenChar, setCDKEntryBox, getCDKEntry- Box, setCDKEntryULChar, setCDKEntryURChar, setCDKEn- tryLLChar, setCDKEntryLRChar, setCDKEntryVerticalChar, setCDKEntryHorizontalChar, setCDKEntryBoxAttribute, setCD- KEntryBackgroundColor, setCDKEntryCB, drawCDKEntry, eraseCDKEntry, cleanCDKEntry, destroyCDKEntry, setCDKEn- tryPreProcess, setCDKEntryPostProcess - Creates a managed curses entry widget.
SYNOPSIS
cc [ flag ... ] file ... -lcdk [ library ... ] #include <cdk.h> CDKENTRY *newCDKEntry (CDKSCREEN *cdkscreen, int xpos, int ypos, char *title, char *label, chtype fieldAttribute, chtype fillerCharacter, EDisplayType displayType, int fieldWidth, int minimumLength, int maximumLength, boolean box, boolean shadow); char *activateCDKEntry (CDKENTRY *entry, chtype *actions); int injectCDKEntry (CDKENTRY *entry, chtype input); void setCDKEntry (CDKENTRY *entry, char *value, int mini- mumLength, int maximumLength, boolean box); void setCDKEntryValue (CDKENTRY *entry, char *value); char *getCDKEntryValue (CDKENTRY *entry); void setCDKEntryMax (CDKENTRY *entry, int maximum); int getCDKEntryMax (CDKENTRY *entry); void setCDKEntryMin (CDKENTRY *entry, int minimum); int getCDKEntryMin (CDKENTRY *entry); void setCDKEntryBox (CDKENTRY *entry, boolean box); void setCDKEntryFillerChar (CDKENTRY *entry, chtype char- acter); chtype getCDKEntryFillerChar *CDKENTRY *entry); void setCDKEntryHiddenChar (CDKENTRY *entry, chtype char- acter); 24 April 1997 1 cdk_entry(3) cdk_entry(3) chtype getCDKEntryHiddenChar *CDKENTRY *entry); boolean getCDKEntryBox (CDKENTRY *entry); void setCDKEntryBox (CDKENTRY *entry, boolean box); boolean getCDKEntryBox (CDKENTRY *entry); void setCDKEntryULChar (CDKENTRY *,entry, chtype charac- ter); void setCDKEntryURChar (CDKENTRY *,entry, chtype charac- ter); void setCDKEntryLLChar (CDKENTRY *,entry, chtype charac- ter); void setCDKEntryLRChar (CDKENTRY *,entry, chtype charac- ter); void setCDKEntryVerticalChar (CDKENTRY *,entry, chtype character); void setCDKEntryHorizontalChar (CDKENTRY *,entry, chtype character); void setCDKEntryBoxAttribute (CDKENTRY *,entry, chtype character); void setCDKEntryBackgroundColor (CDKENTRY *,entry, char * color); void setCDKEntryCB (CDKENTRY *entry, ENTRYCB callBackFunc- tion); void moveCDKEntry (CDKENTRY *entry, int box, int box, boolean relative, boolean refresh); void positionCDKEntry (CDKENTRY *entry); void drawCDKEntry (CDKENTRY *entry, boolean box); void eraseCDKEntry (CDKENTRY *entry); void cleanCDKEntry (CDKENTRY *entry); void destroyCDKEntry (CDKENTRY *entry); void setCDKEntryPreProcess (CDKENTRY *entry, PROCESSFN callback, void * data); void setCDKEntryPostProcess (CDKENTRY *entry, PROCESSFN callback, void * data); 24 April 1997 2 cdk_entry(3) cdk_entry(3) void bindCDKObject (EObjectType widgetType, void *object, chtypekey, BINDFNfunction, void *data);
DESCRIPTION
The Cdk entry widget creates an entry box with a label and an entry field. The following are functions which create or manipulate the Cdk entry box widget.
AVAILABLE FUNCTIONS
CDKENTRY *newCDKEntry (CDKSCREEN *screen, int xpos, int ypos, char *title, char *label, chtype fieldAttribute, chtype fillerCharacter, EDisplayType displayType, int fieldWidth, int minimumLength, int maximumLength, boolean box, boolean shadow); This function creates a pointer to an entry widget. The screen parameter is the screen you wish this widget to be placed in. The parameter xpos controls the placement 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 dis- played at the top of the widget. The title can be more than one line; just provide a carriage return character at the line break. The label parameter is the string which will be displayed in the label of the entry field. The fieldAttribute is the attribute of the char- acters to be displayed when they are typed in. filler is the character which is to be displayed in an empty space in the entry field. The parameter displayType tells how the entry field will behave when a character is entered into the field. The following table outlines valid values for this field and what they mean: Display_Type Meaning vCHAR Only accepts alphabetic characters. vLCHAR Only accepts alphabetic characters. Maps the character to lower case when a character has been accepted. vUCHAR Only accepts alphabetic characters. Maps the character to upper case when a character has been accepted. vHCHAR Only accepts alphabetic characters. Displays a . when a character has been accepted. vUHCHAR Only accepts alphabetic characters. Displays a . and maps the character to upper case when a character has been accepted. vLHCHAR Only accepts alphabetic characters. Displays a . and maps the 24 April 1997 3 cdk_entry(3) cdk_entry(3) character to lower case when a character has been accepted. vINT Only accepts numeric characters. vHINT Only accepts numeric characters. Displays a . when a character has been accepted. vMIXED Accepts any character types. vLMIXED Accepts any character types. Maps the character to lower case when an alphabetic character has been accepted. vUMIXED Accepts any character types. Maps the character to upper case when an alphabetic character has been accepted. vHMIXED Accepts any character types. Displays a . when a character has been accepted. vLHMIXED Accepts any character types. Displays a . and maps the character to lower case when a character has been accepted. vUHMIXED Accepts any character types. Displays a . and maps the character to upper case when a character has been accepted. vVIEWONLY Uneditable field. The fieldWidth parameter states how wide the field will be. If a value of zero is provided, the field will be made as wide as possible on the screen. If a negative value is given, then the field width will be the maximum width minus the value provided. The parameter minimumLength states how many characters have to be entered before the user can exit the entry field. The maximumLength parameter sets the maximum number of characters that can be entered. The box parameter states whether the widget will be drawn with a box around it or not. The shadow param- eter 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. char *activateCDKEntry (CDKENTRY *entry, chtype *actions); This function activates the entry widget and lets the user interact with the widget. The parameter entry is a pointer to a non-NULL entry 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 interac- tively 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 24 April 1997 4 cdk_entry(3) cdk_entry(3) the information typed into the widget and the struc- ture member exitType will be set to vNORMAL. If the character entered was ESCAPE then the function will returns NULL pointer and the structure member exit- Type is set to vESCAPE_HIT. char *injectCDKEntry (CDKENTRY *entry, chtype charac- ter); This function injects a single character into the widget. The parameter entry is a pointer to a non- NULL entry. The parameter character is the character to inject into the widget. If the character injected into this widget was RETURN or TAB then this func- tion will return a char * representing the informa- tion 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 exit- Type to vEARLY_EXIT and the function will return a NULL pointer. void setCDKEntry (CDKENTRY *entry, char *value, int minimumLength, int maximumLength, boolean box); This function lets the programmer modify certain elements of an already defined entry widget. The value parameter sets the value of the contents of the entry field. The other parameter names corre- spond to the same parameter names listed in the newCDKEntry function. void setCDKEntryValue (CDKENTRY *entry, char *value); This sets the current value of the widget. char *getCDKEntryValue (CDKENTRY *entry); This returns the current value of the widget. void setCDKEntryMax (CDKENTRY *entry, int maximum); This sets the maximum length of the string that the widget will allow. int getCDKEntryMax (CDKENTRY *entry); This returns the maximum length of a string the wid- get will allow. void setCDKEntryMin (CDKENTRY *entry, int maximum); This sets the minimum length of the string that the widget will allow. int getCDKEntryMin (CDKENTRY *entry); This returns the minimum length of a string the wid- get will allow. 24 April 1997 5 cdk_entry(3) cdk_entry(3) void setCDKEntryFillerChar (CDKENTRY *entry, chtype filler); This sets the character to use when drawing unused space in the field. chtype getCDKEntryFillerChar (CDKENTRY *entry); This returns the character being used to draw unused space in the widget. void setCDKEntryHiddenChar (CDKENTRY *entry, chtype character); This sets the character to use when using a hidden character type. chtype getCDKEntryHiddenChar (CDKENTRY *entry); This returns the character being used to draw the hidden character type. void setCDKEntryBox (CDKENTRY *entry, boolean boxWid- get); This sets whether or not the widget will be draw with a box around it. boolean getCDKEntryBox (CDKENTRY *entry); This returns whether or not the widget will be drawn with a box around it. void setCDKEntryULChar (CDKENTRY *entry, chtype charac- ter); This function sets the upper left hand corner of the widgets box to the given character. void setCDKEntryURChar (CDKENTRY *entry, chtype charac- ter); This function sets the upper right hand corner of the widgets box to the given character. void setCDKEntryLLChar (CDKENTRY *entry, chtype charac- ter); This function sets the lower left hand corner of the widgets box to the given character. void setCDKEntryLRChar (CDKENTRY *entry, chtype charac- ter); This function sets the lower right hand corner of the widgets box to the given character. void setCDKEntryVerticalChar (CDKENTRY *entry, chtype character); This function sets the vertical drawing character for the box to the given character. void setCDKEntryHorizontalChar (CDKENTRY *entry, chtype character); 24 April 1997 6 cdk_entry(3) cdk_entry(3) This function sets the horizontal drawing character for the box to the given character. void setCDKEntryBoxAttribute (CDKENTRY *entry, chtype attribute); This function sets the attribute of the box. void setCDKEntryBackgroundColor (CDKENTRY *entry, 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_display manual page. void setCDKEntryCB (CDKENTRY *entry, ENTRYCB callback- Function); This function allows the programmer to set a differ- ent widget input handler. The parameter callback- Function is of type ENTRYCB. The current default function is CDKEntryCallBack. void moveCDKEntry (CDKENTRY *entry, int xpos, int ypos, boolean relative, boolean refresh); This function moves the given widget to the given position. 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 positionCDKEntry (CDKENTRY *entry); 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 wid- get 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 24 April 1997 7 cdk_entry(3) cdk_entry(3) 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 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 drawCDKEntry (CDKENTRY *entry, boolean box); This function draws the entry widget on the screen. The box option draws the widget with or without a box. void eraseCDKEntry (CDKENTRY *entry); This function removes the widget from the screen. This does NOT destroy the widget. void cleanCDKEntry (CDKENTRY *entry); This function clears the information from the field. void destroyCDKEntry (CDKENTRY *entry); This function removes the widget from the screen and frees up any memory the object may be using. void setCDKEntryPreProcess (CDKENTRY *entry, PRO- CESSFN function, void *data); This function allows the user to have the wid- get call a function after a key is hit and 24 April 1997 8 cdk_entry(3) cdk_entry(3) before the key is applied to the widget. The parameter function if of type PROCESSFN. The parameter data is a pointer to void. To learn more about pre-processing read the cdk_process manual page. void setCDKEntryPostProcess (CDKENTRY *entry, PROCESSFN function, void *data); This function allows the user to have the wid- get 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-pro- cessing read the cdk_process manual page. void bindCDKObject (EObjectType widgetType, void *object, chtype key, BINDFN function, void *data); This function allows the user to create spe- cial key bindings. The widgetType parameter is a defined type which states what Cdk object type is being used. To learn more about the type EObjectType 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 parameter data is a pointer to any data that needs to get passed to the call- back 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 Left Arrow Moves the cursor the the left. CTRL-B Moves the cursor the the left. Right Arrow Moves the cursor the the right. CTRL-F Moves the cursor the the right. Delete Deletes the character to the left of the cursor. Backspace Deletes the character to the left of the cursor. CTRL-H Deletes the character to the left of the cursor. CTRL-V Pastes whatever is in the paste buffer, into the widget. CTRL-X Cuts the contents from the widget and saves a copy in the paste buffer. CTRL-Y Copies the contents of the widget into the paste buffer. CTRL-U Erases the contents of the widget. CTRL-A Moves the cursor to the begining of the entry field. CTRL-E Moves the cursor to the end of the entry field. 24 April 1997 9 cdk_entry(3) cdk_entry(3) CTRL-T Transposes the characer under the cursor with the character to the right. 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_process(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>. If you have Ncurses installed on your machine add -DNCURSES to the compile line to include the Ncurses header files instead. 24 April 1997 10

Powered by man-cgi (2024-08-26). Maintained for NetBSD by Kimmo Suominen. Based on man-cgi by Panagiotis Christias.