Creates an HTML list box.
wcSelectList(cntrlHandle, "select last_name from customers", "last", "SIZE=30 MULTIPLE", "Smith", &buf);
int wcSelectList(void *controlHandle, char *select, char *name, char *attributes, char *defaultSelection, char **buffer)
controlHandle | The handle to the control structure. |
select | The query that retrieves the items to be displayed in the list box. Use SQL SELECT syntax. One list item is created for each row retrieved by the SELECT. If you retrieve one column, that column provides both the display text and the stored value of each list item. The tags for the select list use the following pattern:
<SELECT NAME=name [attributes]> <OPTION>column ... </SELECT>If you select two columns, the first column is the value of the item and the second column is displayed in the select list. The tags for the select list use the following pattern: <SELECT NAME=name [attributes]> <OPTION VALUE=column1>column2 ... </SELECT> |
name | A value to be used in the NAME attribute of the HTML <SELECT> tag that is generated by wcSelectList( ). |
attributes | Settings for the attributes of the HTML <SELECT> tag that is generated by wcSelectList( ). To set multiple attributes, separate the attribute settings with space characters. For more information about the attributes, refer to your HTML documentation. |
defaultSelection | The list item that is highlighted when the HTML page is displayed, providing the user with a default selection. If this parameter is NULL, no default selection is provided. |
buffer | A storage area where you can keep the HTML output from the wcSelectList( ) function. Use this parameter to store the HTML so you can examine or manipulate it. If this parameter is NULL, the HTML output is returned directly into the output HTML page. |
0 | Success. |
Error code | Failure or exception. For a list of possible error codes, see Error Messages. |
The following code shows how wcSelectList( ) is used in an application.
/* Declare the event handling function */ int nameList(controlHandle) void *controlHandle; { wcSelectList(cntrlHandle, "select last_name from customers", "last" "SIZE=30", "Smith", &buf); } int requestLoop(controlHandle) void *controlHandle; { char *pageText; wcConOpen(controlHandle, 0); /* Associate nameList( ) with the "List" event */ wcSetEventHandler(controlHandle, "List", nameList); /* Load and explode the AppPage */ wcLoad(controlHandle, "page", &pageText); WebExplode(controlHandle, pageText, NULL); wcConClose(controlHandle); }
The nameList( ) function is called when WebExplode( ) encounters the following tag in the AppPage:
<HTML> <BODY> ... <?MIEVENT NAME="List"> ... </HTML> </BODY>
wcCheckboxList( )
wcRadioList( )