wcSelectList( )

Syntax . . Returns . . Tips . . Program Example . . Related Topics . . A-Z Index . . Home

Creates an HTML list box.

Example

wcSelectList(cntrlHandle, "select last_name from customers",
              "last", "SIZE=30 MULTIPLE", "Smith", &buf);

Syntax

int wcSelectList(void *controlHandle,
                   char *select,
                   char *name,
                   char *attributes,
                   char *defaultSelection,
                   char **buffer)
controlHandleThe handle to the control structure.
selectThe 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>
nameA value to be used in the NAME attribute of the HTML <SELECT> tag that is generated by wcSelectList( ).
attributesSettings 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.
defaultSelectionThe 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.
bufferA 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.

Returns

0Success.
Error codeFailure or exception. For a list of possible error codes, see Error Messages.

Tips

Program Example

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>

Related Topics

wcCheckboxList( )
wcRadioList( )


Top of Page . . Syntax . . Returns . . Tips . . Program Example . . A-Z Index . . Home