|
Listview control help
Function help:
Real API_Listview_Create (Real Parent Handle, Real X, Real Y, Real Width, Real Height, Real Style Flags, Real Extended Style Flags);
This function creates a new list view control.
Argument list:
(0) Parent Handle: Identifies the window handle of the window to create this control on.
(1) X: The horizontal position of the control in pixels, relative to the parent window.
(2) Y: The vertical position of the control in pixels, relative to the parent window.
(3) Width: The horizontal size of the control in pixels.
(4) Height: The vertical size of the control in pixels.
(5) Style Flags: The style flags, supports the Global Control Styles and the following styles:
LVS_ALIGNLEFT
Items are left-aligned in icon and small icon view.
LVS_ALIGNMASK
The control's current alignment.
LVS_ICON
This style specifies icon view.
LVS_LIST
This style specifies list view.
LVS_NOCOLUMNHEADER
Column headers are not displayed in report view. By default, columns have headers in report view.
LVS_NOLABELWRAP
Item text is displayed on a single line in icon view. By default, item text may wrap in icon view.
LVS_NOSCROLL
Scrolling is disabled. All items must be within the client area. This style is not compatible with the LVS_LIST or LVS_REPORT styles.
LVS_NOSORTHEADER
Column headers do not work like buttons. This style can be used if clicking a column header in report view does not carry out an action, such as sorting.
LVS_REPORT
This style specifies report view. When using the LVS_REPORT style with a list-view control, the first column is always left-aligned.
LVS_SHOWSELALWAYS
The selection, if any, is always shown, even if the control does not have the focus.
LVS_SHAREIMAGELISTS
The image list will not be deleted when the control is destroyed. This style enables the use of the same image lists with multiple list-view controls.
LVS_SINGLESEL
Only one item at a time can be selected. By default, multiple items may be selected.
LVS_SMALLICON
This style specifies small icon view.
The LVS_REPORT style creates the standard type list view.
Style flags can be separated by a bitwise or '|' operator.
(6) Extended Style Flags: This can be any combination of the Global Extended Control Styles.
Return value:
If this function succeeds, it returns the Control ID of the control, otherwise it returns 0.
Real API_Listview_InsertColumnText ( Real Control ID, Real Zero Based Index, Real Width, String text)
This function adds a new header column to the list view.
Return value:
If this function succeeds, it returns the zero based index ( 0 = the first item) of the column, otherwise, it returns -1.
Real API_Listview_SetImageList ( Real Control ID, Real Image List Handle, Real Type )
This function assigns an image list to a list view.
You need an image list if you want to have images inside your items.
Argument0: Control ID: The Control ID, returned by API_Listview_Create.
Argument1: Image list handle: The image list handle, make one using API_ImageList_Create
Argument2: Kind of image:
0: Normal images.
1: Small images, use this for LVS_REPORT style items and LVS_SMALLICON icons.
2: State images.
Return value:
Returns the previous image list.
Real API_Listview_SetColumnAlign ( Real Control ID, Real Zero Based Column Index, Real Align type)
This function changes the align of the text inside the header and of the items in a column.
Align type values:
0 - Align left
1 - Align centered
2 - Align right
Return value:
If this function succeeds, it returns true (1), otherwise it returns false (0).
Real API_Listview_InsertItemText ( Real Control ID, Real Zero Based Column Index, Real Zero Based Item Index, String Text )
This function inserts a new item, containing text, into the list view control.
Return value:
If this function succeeds, it returns the zero based index ( 0 = the first item) of the item, otherwise, it returns -1.
Real API_Listview_InsertItemImage ( Real Control ID, Real Zero Based Column Index, Real Zero Based Item Index, Real Image List Image Index)
This function inserts a new item, containing an image, into the list view control.
Return value:
If this function succeeds, it returns the zero based index ( 0 = the first item) of the item, otherwise, it returns -1.
Real API_Listview_SetColumnText ( Real Control ID , Real Zero Based Column Index, String Text)
This function changes the text of a list view column.
Return value:
If this function succeeds, it returns true (1), otherwise it returns false (0).
Real API_Listview_SetColumnWidth ( Real Control ID , Real Zero Based Column Index,Real Width)
This function changes the width of a list view column.
Return value:
If this function succeeds, it returns true (1), otherwise it returns false (0).
Real API_Listview_SetItemText ( Real Control ID , Real Zero Based Column Index,Real Zero Based Item Index, String Text)
This function changes the text of a list view item.
Return value:
If this function succeeds, it returns true (1), otherwise it returns false (0).
Real API_Listview_SetItemImage ( Real Control ID , Real Zero Based Column Index,Real Zero Based Item Index, Real Image List Image Number)
This function changes the image of a list view item.
Return value:
If this function succeeds, it returns true (1), otherwise it returns false (0).
Real API_Listview_DeleteColumn ( Real Control ID , Real Zero Based Column Index)
This function deletes a list view column.
Return value:
If this function succeeds, it returns true (1), otherwise it returns false (0).
Real API_Listview_DeleteItem ( Real Control ID , Real Zero Based Item Index)
This function deletes a list view item.
Return value:
If this function succeeds, it returns true (1), otherwise it returns false (0).
Real API_Listview_GetSel ( Real Control ID)
This function returns the selection in a single selection (LVS_SINGLESEL) list view.
Return value:
If this function succeeds, it returns the zero based index of the item or -1 otherwise.
Real API_Listview_SetSel ( Real Control ID, Real Zero Based Item Index)
This function changes the selection in a single selection (LVS_SINGLESEL) list view.
Return value:
If this function succeeds, it returns the zero based index of the previously selected item or -1 otherwise.
Real API_Listview_SetExtendedStyle ( Real Control ID, Real Style Flags)
This function changes the extended listview styles ( do not confuse this with the extended control styles in argument6 of API_Listview_Create ).
You can use the following styles:
LVS_EX_AUTOCHECKSELECT
Windows Vista. Automatically select check boxes on single click.
LVS_EX_BORDERSELECT
Changes border color whan an item is selected, instead of highlighting the item.
LVS_EX_CHECKBOXES
Adds checkboxes to the firt column of the list view.
This enables the use of API_Listview_SetCheckState and API_Listview_GetCheckState.
LVS_EX_FULLROWSELECT
When an item is selected, the item and all its subitems are highlighted. This style is available only in conjunction with the LVS_REPORT style.
This makes the list view look nicer.
LVS_EX_GRIDLINES
Displays gridlines around items and subitems. This style is available only in conjunction with the LVS_REPORT style.
Return value:
Always returns zero (0).
Real API_Listview_GetSelected ( Real Control ID, Real Zero Based Item Index,)
This function returns wether a list view item is selected.
Return value:
If the item is selected, it returns true (1), otherwise it returns false (0).
Real API_Listview_SetSelected ( Real Control ID, Real Zero Based Item Index,Real Is Selected)
This function changes the selection state of a list view item.
To select the item, set argument2 to true (1), and to unselect the item, set argument2 to false (0).
Return value:
No return value.
Real API_Listview_GetCheckState ( Real Control ID, Real Zero Based Item Index,)
This function returns wether a list view item checkbox is checked.
Return value:
If the item is checked, it returns true (1), otherwise it returns false (0).
Real API_Listview_SetCheckState ( Real Control ID, Real Zero Based Item Index,Real Is Selected)
This function changes the checkbox state of a list view item.
To check the item, set argument2 to true (1), and to uncheck the item, set argument2 to false (0).
Return value:
No return value.
Real API_Listview_SetBkColor ( Real Control ID, Real Color)
This function changes the background color of a list view.
Return value:
If this function succeeds, it returns true (1), otherwise it returns false (0).
Real API_Listview_SetTextBkColor ( Real Control ID, Real Color)
This function changes the color of the background of the text inside a list view.
Return value:
If this function succeeds, it returns true (1), otherwise it returns false (0).
Real API_Listview_SetTextBkColor ( Real Control ID, Real Color)
This function changes the color of the background of the text inside a list view.
Return value:
If this function succeeds, it returns true (1), otherwise it returns false (0).
Real API_Listview_SetBkImage ( Real Control ID, Real Bitmap Resource Handle, Real Use Watermark)
This function tiles a bitmap on the background of a list view.
To load a bitmap from a file use API_Resource_LoadBitmap.
Return value:
If this function succeeds, it returns true (1), otherwise it returns false (0).
Secondary check commands for list views:
LVN_ITEMCHANGED - An item inside the list view changed
NM_CLICK - An item is clicked with the left mouse button.
NM_DBLCLK- An item is double-clicked with the left mouse button.
NM_KILLFOCUS- The list view loosed the keyboard focus.
NM_SETFOCUS - The list view gained the keyboard focus.
NM_RCLICK - An item is clicked with the right mouse button.
NM_RDBLCLK - An item is double-clicked with the right mouse button.
Example:
Command = API_Check_Command (1);
if ( Command == Listview1 )
{
Second = API_Check_SecondaryCommand (1);
if ( Second == NM_CLICK)
{
Sel =API_Listview_GetSel( Listview1 );
show_message ("The selection of Listview1 changed to "+string (Sel));
}
} |
Example code:
Listview1 = API_Listview_Create (Win,315,300,200,200,LVS_REPORT,WS_EX_CLIENTEDGE);
API_Listview_SetExtendedStyle (Listview1,LVS_EX_FULLROWSELECT);
Column1 = API_Listview_InsertColumnText (Listview1,0,25," ");
Column2 = API_Listview_InsertColumnText (Listview1,0,175,"Text");
ImageList = API_ImageList_Create (16,16,0,10);
Bitmap = API_Resource_LoadBitmap ("Bitmap.bmp");
Image1 = API_ImageList_AddBitmap (ImageList,Bitmap);
API_Listview_SetImageList (Listview1,ImageList,1);
API_Listview_InsertItemImage (Listview1,Column1,0,Image1);
|
is
Return to help index
|
|