WireLess Studio Widgets Developer's Guide
WSWDG ContentsWStWidget class reference

SetRowIcon

Sets the icon displayed by a row on a WS_LIST_CTRL widget.

Ole declaration

VARIANT_BOOL SetRowIconByName(LPCTSTR sObjectName, SHORT usRowIndex, SHORT usIconId);

VARIANT_BOOL SetRowIconById(SHORT usObjectId, SHORT usRowIndex, SHORT usIconId);

Parameters
sObjectName
The name of the target widget.
usObjectId
The id of the target widget.
usRowIndex
The index of a row previously added with AddRow or loaded from a file using ReadRowsFromFile.
usIconId
Specifies the id of an icon previously loaded with WStFactory::LoadExternalIcon.
Return Value

On success, SetRowIcon returns TRUE, FALSE otherwise. To get extended information, call WStError::GetLastErrorCode.

Remarks

If the icon id specified is zero, no icon it's displayed on the target row, otherwise the 16 x 16 version of the icon will be loaded.

Example
C#
using WirelessStudioOleWidgets;
WStWidget oWidget = new WStWidget();
short sListCtrlId= 4;
oFactory.CreateWidgetById((short)WSTFactoryConstants.WS_LIST_CTRL, sListCtrlId, "", 0,0, 50, 50, "");
oFactory.LoadExternalIcon(sIconId, WS_EXIT, @"\IconLib.dll");
oWidget.AddColumById(sListCtrlId, 40, "Product Id");
oWidget.AddRowById(sListCtrlId, 0);
oWidget.SetRowIconById(sListCtrlId, 0, 4);
Visual Basic 6 (Full Example: ListCtrlDemoModule.bas)
Public wsWidget As New WStWidget
...
Case "newRowIconComboBox"
	'Changes the icon of a previously selected row
	iIconId = wsForm.GetLastEventIntValue()
	If wsWidget.GetSelectedItemByName("myListCtrl") <> -1 Then
		wsWidget.SetRowIconByName "myListCtrl", wsWidget.GetSelectedItemByName("myListCtrl"), _
                        iIconId
	End If
...
See also

SetRowText | DeleteRow | AddRow | ClearRows | AddColumn | ClearColumns | GetSelectedItem | ReadRowsFromFile | SetLoadMode

WStWiget class reference | WStForm class reference | WStFactory class reference | WStError class reference