The following sections describe the individual methods.
+-------------------+ V | >>-aListControl~ReplaceStyle(--oldStyle--,--"----+-ICON----------+-+--"--)->< +-SMALLICON-----+ +-LIST----------+ +-REPORT--------+ +-ALIGNLEFT-----+ +-ALIGNTOP------+ +-AUTOARRANGE---+ +-ASCENDING-----+ +-DESCENDING----+ +-EDIT----------+ +-HSCROLL-------+ +-VSCROLL-------+ +-NOSCROLL------+ +-NOHEADER------+ +-NOSORTHEADER--+ +-NOWRAP--------+ +-SINGLESEL-----+ +-SHOWSELALWAYS-+ +-SHAREIMAGES---+ +-GROUP---------+ +-HIDDEN--------+ +-NOTAB---------+ +-NOBORDER------+
The ReplaceStyle method removes a window style of a list view control and sets new styles.
The arguments are:
The window style to be removed.
The new window styles to be set, which is one or more of the styles listed in the syntax diagram, separated by blanks. For an explanation of the different styles, refer to AddListControl.
0 if this method fails.
The following example replaces a small-icon list with an icon list and connects the new bitmap file:
::method Icon curList = self~GetListControl(104) curList~SetImages("ilist.bmp",16,12) curList~ReplaceStyle("SMALLICON","ICON")
+-------------------+ V | >>-aListControl~AddStyle(--"----+-ICON----------+-+--"--)------>< +-SMALLICON-----+ +-LIST----------+ +-REPORT--------+ +-ALIGNLEFT-----+ +-ALIGNTOP------+ +-AUTOARRANGE---+ +-ASCENDING-----+ +-DESCENDING----+ +-EDIT----------+ +-HSCROLL-------+ +-VSCROLL-------+ +-NOSCROLL------+ +-NOHEADER------+ +-NOSORTHEADER--+ +-NOWRAP--------+ +-SINGLESEL-----+ +-SHOWSELALWAYS-+ +-SHAREIMAGES---+ +-GROUP---------+ +-HIDDEN--------+ +-NOTAB---------+ +-NOBORDER------+
The AddStyle method adds new window styles to a list view control.
The only argument is:
The window styles to be added, which is one or more of the styles listed in the syntax diagram, separated by blanks. For an explanation of the different styles, refer to AddListControl.
0 if this method fails.
+-------------------+ V | >>-aListControl~RemoveStyle(--"----+-ICON----------+-+--"--)--->< +-SMALLICON-----+ +-LIST----------+ +-REPORT--------+ +-ALIGNLEFT-----+ +-ALIGNTOP------+ +-AUTOARRANGE---+ +-ASCENDING-----+ +-DESCENDING----+ +-EDIT----------+ +-HSCROLL-------+ +-VSCROLL-------+ +-NOSCROLL------+ +-NOHEADER------+ +-NOSORTHEADER--+ +-NOWRAP--------+ +-SINGLESEL-----+ +-SHOWSELALWAYS-+ +-SHAREIMAGES---+ +-GROUP---------+ +-HIDDEN--------+ +-NOTAB---------+ +-NOBORDER------+
The RemoveStyle method removes one or more window styles of a list view control.
The only argument is:
The window styles to be removed, which is one or more of the styles listed in the syntax diagram, separated by blanks. For an explanation of the different styles, refer to AddListControl.
0 if this method fails.
+--------------------+ V | >>-aListControl~AddExtendedStyle(--"---+-BORDERSELECT-----+--"--)------------>< +-CHECKBOXES-------+ +-DOUBLEBUFFER-----+ +-FLATSB-----------+ +-FULLROWSELECT----+ +-GRIDLINES--------+ +-HEADERDRAGDROP---+ +-INFOTIP----------+ +-LABELTIP---------+ +-MULTIWORKAREAS---+ +-ONECLICKACTIVATE-+ +-REGIONAL---------+ +-SIMPLESELECT-----+ +-SUBITEMIMAGES----+ +-TRACKSELECT------+ +-TWOCLICKACTIVATE-+ +-UNDERLINECOLD----+ +-UNDERLINEHOT-----+
The AddExtendedStyle method adds one or more of the extended List-View styles to a ListControl. These styles can not be added until the underlying Windows List-View control has been created. They can be added in the InitDialog method or any time thereafter.
The only argument is:
The extended styles to be added. This argument is a list containing one or more of the following style keywords, separated by blanks. Invalid words in the list are ignored. If there are no valid keywords at all in the list, then an error is returned.
When an item is selected the border color of the item changes rather than the item being highlighted.
Check boxes are visible and functional in all list view modes except tile mode.
Windows XP or later only. The list-view control is painted using double buffering. This reduces flicker.
Enables flat scroll bars.
Report view only. When a row is selected, the whole row is highlighted rather than just the first column.
Report view only. Gridlines are drawn around all items and sub-items. This gives a spreadsheet-like appearance to the list view control.
Report view only. The user can drag and drop the headers to rearrange the columns.
With this style a notification is sent to the parent window before displaying an item's tooltip. (The current version of ooDialog can not take advantage of this style. It is planned for a future enhancement.)
Windows XP or later only. In any list view mode, if an item's label is only partially visible, the complete label will be displayed in a fashion similar to a tool tip.
The current version of ooDialog can not take advantage of this style. It is planned for a future enhancement.
Enables the list-view control to send an item activate notification when the user clicks one time on an item. It also enables hot tracking in the list-view control. Both the underline cold and the underline hot styles need either one click activate or two click activate styles to be enabled.
Icon view only. Sets the window region to only include an item's icon and text.
Windows XP and later only. Icon view only. Moves the state image to the top right of the icon image. If the user changes the state using the space bar, all the selected items cycle, not just the item with the focus.
Report view only. Allows images to be displayed for subitems.
Enables hot track selection. The user can select an item by leaving the mouse over an item for a certain period of time, the "hover" time. This period of time can be changed from the default by using the SetHoverTime method.
Enables the list-view control to send an item activate notification when the user clicks on an item after it has been selected. When the user clicks on an item it will be selected. At that point, if the user clicks on the item a second time, the item will be activated. Note that this is different from double-clicking to activate. Any amount of time can pass between the click that selects the item and the click that activates the item. (Provided the item remains selected of course.)
It also works with track select. If track select is enabled, the user can select an item by pausing the mouse over the item. At that point, if the user then clicks on the item it will be activated.
Underlining gives the user a visual clue that a single click on an item will activate it. Underlining requires either ONECLICKACTIVATE or TWOCLICKACTIVE to also be enabled. An item becomes hot when the mouse is over it. Underline cold underlines all the cold items when a single click will activate them. When one click activate is enabled, this would then be all items. When two click activate is enabled this would then be only those items that were selected.
The underline hot style is similar to the underline cold style. See that style above for the explanation of some of the terms. With underline hot, the item is underlined when the mouse is over it, if one click will activate the item.
The return values are:
Success.
An (internal) problem with the control's window handle.
The style argument did not contain any of the extended style keywords.
The following example shows how to initially add the extended styles to a list view control. This is done in the InitDialog method, which executes after the underlying Windows dialog has been created, but before it is displayed on the screen. This is the earliest point in time that the extended style methods can be used. The list view is in the report view and will have check boxes and grid lines. The user will be able to use drag and drop to rearrange the columns. When a row is selected, the full row will be highlighted rather than just the first column.
::method initDialog expose listView ... listView = self~getListControl(IDC_LIST) if listView == .nil then return listView~addExtendedStyle("CHECKBOXES GRIDLINES FULLROWSELECT HEADERDRAGDROP") ...
+--------------------+ V | >>-aListControl~RemoveExtendedStyle(--"----+-BORDERSELECT-----+--"--)------->< +-CHECKBOXES-------+ +-DOUBLEBUFFER-----+ +-FLATSB-----------+ +-FULLROWSELECT----+ +-GRIDLINES--------+ +-HEADERDRAGDROP---+ +-INFOTIP----------+ +-LABELTIP---------+ +-MULTIWORKAREAS---+ +-ONECLICKACTIVATE-+ +-REGIONAL---------+ +-SIMPLESELECT-----+ +-SUBITEMIMAGES----+ +-TRACKSELECT------+ +-TWOCLICKACTIVATE-+ +-UNDERLINECOLD----+ +-UNDERLINEHOT-----+
The RemoveExtendedStyle method removes one or more extended styles of a List-View control.
The only argument is:
The extended style(s) to be removed. This is one or more of the styles listed in the syntax diagram, separated by blanks. For an explanation of the different styles, refer to the AddExtendedStyle method.
The return values are:
Success.
An (internal) problem with the control's window handle.
The style argument did not contain any of the extended style keywords.
The following example removes the check box style from the list view.
listView = self~getListControl(IDC_LIST) if listView == .nil then return listView~removeExtendedStyle("CHECKBOXES")
+--------------------+ V | >>-aListControl~ReplaceExtendedStyle(-oldStyle--,--"---+-BORDERSELECT-----+--"-)->< +-CHECKBOXES-------+ +-DOUBLEBUFFER-----+ +-FLATSB-----------+ +-FULLROWSELECT----+ +-GRIDLINES--------+ +-HEADERDRAGDROP---+ +-INFOTIP----------+ +-LABELTIP---------+ +-MULTIWORKAREAS---+ +-ONECLICKACTIVATE-+ +-REGIONAL---------+ +-SIMPLESELECT-----+ +-SUBITEMIMAGES----+ +-TRACKSELECT------+ +-TWOCLICKACTIVATE-+ +-UNDERLINECOLD----+ +-UNDERLINEHOT-----+
The ReplaceExtendedStyle method removes some of the List-View control's extended styles and adds new extended styles. This is the equivalent of first using the RemoveExtendeStyle method and then using the AddExtendedStyle method.
The arguments are:
The extended style(s) to be removed. This is one or more of the styles listed in the syntax diagram, separated by blanks. For an explanation of the different styles, refer to the AddExtendedStyle method.
The extended style(s) to be added. Again, this is one or more of the styles listed in the syntax diagram, separated by blanks. See the AddExtendedStyle method for the style descriptions.
The return values are:
Success.
An (internal) problem with the control's window handle.
One, or both, of the style arguments had none of the extended style keywords.
The following example removes the cold and hot underlining and adds check boxes to the list view.
listView = self~getListControl(IDC_LIST) if listView == .nil then return removeStyle = "UNDERLINECOLD UNDERLINEHOT" addStyle = "CHECKBOXES" listView~replaceExtendedStyle(removeStyle, addStyle)
>>-aListControl~GetExtendedStyle---------------------------------------------><
The GetExtendedStyle method returns the extended styles of a ListControl. The styles are returned as a string of blank delimited style keywords. These are the same keywords as those used to set the styles.
This method takes no arguments.
The returned string can contain one or more of the following style keywords. See the AddExtendedStyle method for the style descriptions:
BORDERSELECT
CHECKBOXES
DOUBLEBUFFER
FLATSB
FULLROWSELECT
GRIDLINES
HEADERDRAGDROP
INFOTIP
LABELTIP
MULTIWORKAREAS
ONECLICKACTIVATE
REGIONAL
SIMPLESELECT
SUBITEMIMAGES
TRACKSELECT
TWOCLICKACTIVATE
UNDERLINECOLD
UNDERLINEHOT
The following example comes from a fictious application where the user can elect to use the track select style, or not. With this style, an item can be selected by pausing the mouse over it for a period of time specified by the hover time. The application also allows the user to increase or decrease the hover time. In this example when the methods to increment or decrement the hover time are invoked, the application first checks to see if the list view control has the track select style. Then the change is only made if the list view control does have the style.
::method initDialog expose listView ... listView = self~getListControl(IDC_LIST) if listView == .nil then return listView~addExtendedStyle("CHECKBOXES FULLROWSELECT TRACKSELECT") ... ::method onCheckboxClick expose listView chkBox = self~getCheckControl(IDC_CHECK_USETRACKSELECT) if chkBox~isChecked == "CHECKED" then listView~addExtendedStyle("TRACKSELECT") else listView~removeExtendedStyle("TRACKSELECT") ::method onDecrement expose listView styles = listView~getExtendedStyle if styles~wordpos("TRACKSELECT") == 0 then return time = listView~getHoverTime - 100 if time > 0 then listView~setHoverTime(time) ::method onIncrement expose listView styles = listView~getExtendedStyle if styles~wordpos("TRACKSELECT") == 0 then return -- Let the user increase the hover time to any length they want. listView~setHoverTime(list~getHoverTime + 100)
>>-aListControl~GetExtendedStyleRaw------------------------------------------><
The GetExtendedStyleRaw method returns the extended styles of a ListControl as the numeric value of the extended style flags. This method is provided for programmers familiar with the Windows API who may wish to know, or to work with, the actual value of the flags.
This method takes no arguments.
The returned value is the numeric value of the extended style flags currently in effect for the list-view control.
The following example is the same example as the GetExtendedStyle example. It simply replaces the GetExtendedStyle invocation with a GetExtendedStyleRaw invocation.
::method initDialog expose listView ... listView = self~getListControl(IDC_LIST) if listView == .nil then return listView~addExtendedStyle("CHECKBOXES FULLROWSELECT TRACKSELECT") ... ::method onCheckboxClick expose listView chkBox = self~getCheckControl(IDC_CHECK_USETRACKSELECT) if chkBox~isChecked == "CHECKED" then listView~addExtendedStyle("TRACKSELECT") else listView~removeExtendedStyle("TRACKSELECT") ::method onDecrement expose listView if binaryAnd(listView~getExtendedStyleRaw, "0x00000008") <> 0 then return time = listView~getHoverTime - 100 if time > 0 then listView~setHoverTime(time) ::method onIncrement expose listView if binaryAnd(listView~getExtendedStyleRaw, "0x00000008") <> 0 then return -- Let the user increase the hover time to any length they want. listView~setHoverTime(list~getHoverTime + 100)
>>-aListControl~GetHoverTime-----------------------------------><
This method retrieves the current hover time. The hover time is expressed as milliseconds. The hover time only affects list view controls that have the track select, one click activate, or two click activate extended list view styles. See the AddExtendedStyle for a description of these styles.
This method takes no arguments
The hover time. A value of -1 indicates the hover time is the system default hover time.
The following example comes from a program where the one click activate and track select styles are enabled. Orignally the hover time is set to .4 seconds. However the application allows the users to increase or decrease this time to match their preference. A menu item (or a button could be used) is connected to the onIncrement and onDecrement methods. When either of the methods is invoked, the current hover time is examined and then either incremented or decremented by .1 of a second.
::method initDilaog expose list ... list = self~getListControl(IDC_LIST) list~addExtendedStyle("ONECLICKACTIVATE TRACKSELECT FULLROWSELECT") list~setHoverTime(400) ... ::method onDecrement expose list time = list~getHoverTime - 100 if time > 0 then list~setHoverTime(time) ::method onIncrement expose list -- Let the user increase the hover time to any length they want. list~setHoverTime(list~getHoverTime + 100)
>>-aListControl~SetHoverTime(--+------+--)--------------------->< +-time-+
This method is used to change the hover time. The hover time only affects list view controls that have the track select, one click activate, or two click activate extended list view styles. See the AddExtendedStyle for a description of these styles.
The only optional argument is:
Specify the hover time in milliseconds. If this argument is omitted, the hover time is set to the system default. A negative number will also set the hover time back to the system defualt.
The previous hover time. A value of -1 indicates the previous hover time was the system default.
The following example adds the one click activate, the track select, and the full row select extended list view styles to a ListControl. The hover time is set to .4 seconds. If the user pauses his mouse over a row in the list view for .4 of a second the row is automatically selectd.
::method initDilaog ... list = self~getListControl(IDC_LIST) list~addExtendedStyle("ONECLICKACTIVATE FULLROWSELECT TRACKSELECT") oldTime = list~setHoverTime(400) ...
>>-aListControl~Check(--index--)--------------------------------------------><
The Check method sets the check mark for a list view item. This method is only valid for list view controls that have the check boxes extended style. (See the AddExtendedStyle method for a description of the check boxes extended style.)
The only argument is:
The index of the item for which to set the check mark.
The return values are:
Success.
An (internal) problem with the control's window handle.
The list view control does not have the check boxes extended style.
The index is invalid.
The following example is from a mailing list application. The user selects which entries to include in any mailing. All items in a list view that have their check boxes checked are included in the mailing. The application has a feature that allows the user to automatically select all items with a specified zip code.
::method onUseZip text = self~getEditControl(IDC_EDIT_ZIPCODE)~getText if self~validateZip(text) then do list = self~getListControl(IDC_LIST) do i = 0 to addresses~items - 1 infoTable = address[i + 1] if infoTable['zip'] == text then list~check(i) end end
>>-aListControl~Uncheck(--index--)------------------------------------------><
The Uncheck method removes the check mark for a list view item. This method is only valid for list view controls that have the check boxes extended style. (See the AddExtendedStyle method for a description of the check boxes extended style.)
The only argument is:
The index of the item where the check box check is to be removed.
The return values are:
Success.
An (internal) problem with the control's window handle.
The list view control does not have the check boxes extended style.
The index is invalid.
The following example is from a doctor's office custom accounting application. A list box is filled with information for every patient. One button in the application checks every patient with an outstanding balance, they will be mailed a statement for that balance. The doctor does not believe in sending billing statements to patients that have a very low balance. However what a "low" balance is depends on how he is feeling at statement time. Therefore the application allows the office manager to dynamically remove some patients from the statement list.
::method onDeferBilling expose billingList text = self~getEditControl(IDC_EDIT_MINAMOUNT)~getText minimun = self~decimalNumber(text) if minimum > 0 then do i = 0 to billingList~items if billingList~isChecked(i) then do -- Column 6 in the list is the patient's current balance. owes = billingList~itemText(i, 6) if self~decimalNumber(owes) <= minimum then billingList~uncheck(i) end end
>>-aListControl~CheckAll----------------------------------------------------><
The CheckAll method sets the check mark for every list view item. This method is only valid for list view controls that have the check boxes extended style. (See the AddExtendedStyle method for a description of the check boxes extended style.)
This method takes no arguments.
The return values are:
Success.
An (internal) problem with the control's window handle.
The list view control does not have the check boxes extended style.
The following example is from a program that has a push button that allows the user to check all the check boxes:
::method onCheckAll list = self~getListControl(IDC_LIST_REPUBLICANS) list~checkAll
>>-aListControl~UncheckAll--------------------------------------------------><
The UncheckAll method clears the check mark for every list view item. This method is only valid for list view controls that have the check boxes extended style. (See the AddExtendedStyle method for a description of the check boxes extended style.)
This method takes no arguments.
The return values are:
Success.
An (internal) problem with the control's window handle.
The list view control does not have the check boxes extended style.
The following example is from a program that has a push button that allows the user to remove the check mark from all the check boxes:
::method onUncheckAll list = self~getListControl(IDC_LIST_REPUBLICANS) list~uncheckAll
>>-aListControl~GetCheck(--index--)-----------------------------------------><
The GetCheck method determines if the item at the specified list index has a checked check box. This method will return a code indicating that the list view control does not have the check boxes extended style, if appropriate. (See the AddExtendedStyle method for a description of the check boxes extended style.)
The only argument is:
The index of the item to query.
The return values are:
The item has a check box that is checked.
The item has a check box, and it is not checked.
An (internal) problem with the control's window handle.
The list view control does not have the check boxes extended style.
The index is invalid.
The following example could be used as a shortcut method to determine if a list view control currently has the check box extended style.
... list = self~getListControl(IDC_LV_DOCTORS) if list~getCheck(0) == -2 then return -- The list view does not currently have the check box style in effect do i = 0 to list~items - 1 ... end
>>-aListControl~IsChecked(--index--)----------------------------------------><
The IsChecked method determines if a check box for a list view item is checked or not. This method will always return true or false. It can be used if the list view control has or does not have the check boxes extended style. (See theAddExtendedStyle method for a description of the check boxes extended style.)
The only argument is:
The index of the item to query.
The return values are:
The list view item has a check box and it is checked.
There is no check mark for the list view item. Either the list view has check boxes and the check box is not checked, the index is out of range or not valid, or the list view does not have the check box extended style.
The following example is from a doctor's office custom accounting application. A list box is filled with information for every patient. After the office mananger has finished working with the accounts a mail merge is done to produce statements for all patients that are to receive statements for the month. For every patient item in the list view, if the item has a check mark, then that patient is mailed a statement.
::method onCreateMailMerge expose patientList do i = 0 to patientList~items if billingList~isChecked(i) then do self~addToMailMerge(billingList, i) end end
+-0------+ >>-aListControl~InsertColumn(--+--------+--,--text--,--> +-column-+ >--,--width--+---------------------+--)--------------->< | +-LEFT---+ | +-,--"--+-CENTER-+--"-+ +-RIGHT--+
The InsertColumn method sets the attributes of a report list view column.
The arguments are:
The number of the column. 0 is the first column and the default.
The text of the column heading.
The width of the column, in pixels.
The alignment of the column heading and the subitem text within the column. It can be one of the following values:
The text is centered.
The text is left-aligned, which is the default.
The text is right-aligned.
The number of the new column, or 0 if this method fails.
The following example adds three columns to a report list:
::method InitReport curList = self~GetListControl(102) if curList \= .Nil then do curList~InsertColumn(0,"First Name",50) curList~InsertColumn(1,"Last Name",50) curList~InsertColumn(2,"Age",50) end
>>-aListControl~DeleteColumn(--column--)-----------------------><
The DeleteColumn method removes a column from a list view control.
The only argument is:
The number of the column to be deleted. The first column must be deleted last.
The column was deleted.
You did not specify column.
For all other cases.
>>-aListControl~ModifyColumn(--column--,--+------+--,--width----> +-text-+ >--+---------------------+--)---------------------------------->< | +-LEFT---. | +-,--"--+-CENTER-+--"-+ +-RIGHT--+
The ModifyColumn method sets new attributes for a column of a list view control.
The arguments are:
The number of the column. 0 is the first column.
The text of the column heading. If you omit this argument, the heading is not changed.
The width of the column, in pixels.
The alignment of the column heading and the subitem text within the column. It can be one of the following values:
The text is centered.
The text is left-aligned, which is the default.
The text is right-aligned.
The column was modified.
You did not specify column.
For all other cases.
The following example changes the title, size, and alignment of the first column in a report list:
::method ChangeColumn curList = self~GetListControl(102) curList~ModifyColumn(0,"New Title",100,"RIGHT")
>>-aListControl~ColumnInfo(--column--)-------------------------><
The ColumnInfo method retrieves the attributes of a column of a list view control.
The only argument is:
The number of the column of which the attributes are to be retrieved. 0 is the first column.
A compound variable that stores the attributes of the item. If attributes for a column are not available or an error occurs, then the RetStem.!WIDTH variable will be set to 0.
The heading of the column.
The column number.
The width of the column.
The alignment of the column: "LEFT", "RIGHT", or "CENTER".
The following example displays the column attributes in an information box when the column is clicked on:
::method OnColumnClick use arg id, column curList = self~GetListControl(102) info. = curList~ColumnInfo(column) call InfoDialog("Column Title : " info.!Text"d"x, "Column Number: " info.!Column"d"x, "Column Width : " info.!Width"d"x, "Alignment : " info.!Align)
>>-aListControl~ColumnWidth(--column--)------------------------><
The ColumnWidth method retrieves the width of a column in a report or list view.
The only argument is:
The number of the column of which the width is to be retrieved. 0 is the first column.
The column width, or -1 if you did not specify column, or 0 in all other cases.
The following example displays the column width in an information box when the column is clicked on:
::method OnColumnClick use arg id, column curList = self~GetListControl(102) call InfoDialog(curList~ColumnWidth(column))
>>-aListControl~SetColumnWidth(--column--+----------+--)------->< +-,--width-+
The SetColumnWidth method sets the width of a column in a report or list view.
The arguments are:
The number of the column of which the width is to be set. 0 is the first column.
The width of the column, in pixels. If you omit this argument, the column is sized automatically.
The column width was set.
You did not specify column.
For all other cases.
The following example enlarges the selected column by 10:
::method OnColumnClick use arg id, column curList = self~GetListControl(102) curList~SetColumnWidth(column,curList~ColumnWidth(column)+10)
>>-aListControl~StringWidth(--text--)--------------------------><
The StringWidth method determines the width of a specified string using the current font of the list view control.
The only argument is:
The text string of which the width is to be determined.
The string width, or -1 if you did not specify a text, or 0 in all other cases.
+-0------+ +-0----+ >>-aListControl~Insert(--+------+--,--+--------+--,--text--,--+------+--)->< +-item-+ +-column-+ +-icon-+
The Insert method inserts a new item in a list view control.
The arguments are:
The number of the item. If you omit this argument, the number of the last item is increased by 1.
The number of the column. If you omit this argument, 0 is assumed. This argument only applies to report views.
The text of the item.
The index of the icon of the list view item within the bitmap file, set with the SetImages or SetSmallImages method (see page SetSmallImages). The SetImages method must be used for the icon view and the SetSmallImages for the list, report, and small-icon views.
In a report view, this argument can only be used for the first column.
If you omit this argument, 0 is assumed.
The index of the new item, or -1 in all other cases.
The following example inserts items in a list:
::method InitReport curList = self~GetListControl(102) if curList \= .Nil then do curList~Insert(, ,"First") curList~Insert(, ,"Second") curList~Insert(, ,"Third") end
+-0------+ >>-aListControl~Modify(--+------+--,--+--------+--,--text---------> +-item-+ +-column-+ +-0----+ >--,--+------+--)------------------------------------------------>< +-icon-+
The Modify method sets some or all attributes of a list view item.
The arguments are:
The number of the item. If you omit this argument, the selected item is used.
The number of the column. If you omit this argument, 0 is assumed. This argument only applies to report views.
The new text for the item.
The new index for the icon of the list view item within the bitmap file, set with the SetImages or SetSmallImages method (see page SetSmallImages). The SetImages method must be used for the icon view and the SetSmallImages method for the list, report, and small-icon views.
In a report view, this argument can only be used for the first column.
If you omit this argument, 0 is assumed.
The modification was successful.
For all other cases.
The following example modifies the icon of the item that is double-clicked:
::method OnActivate curList = self~GetListControl(102) if curList \= .Nil then do si = curlist~Focused curList~Modify(si, , ,2) end
+-0------+ >>-aListControl~SetItemText(--item--,--+--------+--,--text--)-->< +-column-+
The SetItemText method changes the text of a list view item or a column.
The arguments are:
The number of the item.
The number of the column. If you omit this argument, 0 is assumed. This argument only applies to report views.
The text of the item or a column.
The change was successful.
You did not specify column.
For all other cases.
>>-aListControl~SetItemState(--item--+------------------------------+--)->< | +-----------------+ | | V | | +-,--"----+-CUT---------+-+--"-+ +-NOTCUT------+ +-DROP--------+ +-NOTDROP-----+ +-FOCUSED-----+ +-NOTFOCUSED--+ +-SELECTED----+ +-NOTSELECTED-+
The SetItemState method sets the state of a list view item.
The arguments are:
The number of the item.
The state of the item, which can be one or more of the following values, separated by blanks:
The item is marked for a cut-and-paste operation.
The item cannot be used for a cut-and-paste operation.
The item is highlighted as a drag-and-drop target.
The item is not highlighted as a drag-and-drop target.
The item has the focus and is therefore surrounded by the standard focus rectangle. Only one item can have the focus.
The item does not have the focus.
The item is selected. Its appearance depends on whether it has the focus and on the system colors used for a selection.
The item is not selected.
The state was set successfully.
You did not specify item.
For all other cases.
+-------+ V | +-0----+ >>-aListControl~Add(----+---+-+--,--text--,--+------+--)------->< +-,-+ +-icon-+
The Add method adds a new item to the report view. It can be used to fill a list view or report view sequentially.
The arguments are:
The number of commas specifies in which column the text of the item is to be placed. For example, one comma specifies that the text of the item is to be placed in the first column.
The text for the item.
The index of the icon of the list view item within the bitmap file, set with the SetImages or SetSmallImages method (see page SetSmallImages). The SetImages method must be used for the icon view and the SetSmallImages method for the list, report, and small-icon views.
In a report view, this argument can only be used for the first column.
If you omit this argument, 0 is assumed.
The following example adds three columns and two items to a report list control. To get the following result:
you must specify the following:
::method InitDialog InitDlgRet = self~InitDialog:super curList = self~GetListControl("IDC_LIST_REP") if curList \= .Nil then do curList~SetSmallImages("E:\oodlist\oodlist.BMP",16,12) curList~InsertColumn(0,"First Name",50) curList~InsertColumn(1,"Last Name",50) curList~InsertColumn(2,"Age",50) curList~Add("Mike") curList~Add(,"Miller") curList~Add(, ,"30") curList~~Add("Sue")~~Add(,"Thaxton")~~Add(, ,"29") end return InitDlgRet
+-,----+ V | >>-aListControl~AddRow(--+------+--,--icon--,----text-+--)----->< +-item-+
The AddRow method adds a new item to a list.
The arguments are:
The number of the item. If you omit this argument, the number of the last item is increased by 1.
The index of the icon of the list view item within the bitmap file, set with the SetImages or SetSmallImages method (see page SetSmallImages). The SetImages method must be used for the icon view and the SetSmallImages method for the list, report, and small icon views.
In a report view, this argument can only be used for the first column.
Any number of text strings. The first is used for the first column, the second for the second column, and so on. If you specify more text entries than there are columns, the extra entries are ignored.
The index of the new item, or -1 in all other cases.
The following example adds three items to a report list with two columns:
::method InitList curList = self~GetListControl(101) curList~AddRow(, ,"Mike","Miller") curList~AddRow(, ,"Sue","Muller") curList~AddRow(, ,"Chris","Watson")
>>-aListControl~Delete(--item--)-------------------------------><
The Delete method removes an item from a list view control.
The only argument is:
The number of the item.
The item was deleted.
You did not specify item.
For all other cases.
The following example deletes the selected item in a list control:
::method DeleteSelectedItem curList = self~GetListControl(102) curList~Delete(curList~Selected)
>>-aListControl~DeleteAll--------------------------------------><
The DeleteAll method removes all items from a list view control.
The items were deleted.
No item was available.
For all other cases.
>>-aListControl~Items------------------------------------------><
The Items method retrieves the number of items in a list view control.
The number of items.
>>-aListControl~Last-------------------------------------------><
The Last method retrieves the number of the last item in a list view control.
The number of the last item.
>>-aListControl~Prepare4nItems(--items--)----------------------><
The Prepare4nItems method prepares a list view control for adding a large number of items.
The only argument is:
The number of the items to be added later.
The list view control was prepared.
You did not specify items.
>>-aListControl~SelectedItems----------------------------------><
The SelectedItems method determines the number of selected items in a list view control.
The number of selected items.
+-0------+ >>-aListControl~ItemInfo(--item--,--+--------+--)-------------->< +-column-+
The ItemInfo method retrieves the attributes of a list view item.
The arguments are:
The number of the item.
The number of the column. If you omit this argument, 0 is assumed.
A compound variable that stores the attributes of the item, or -1 in all other cases. The compound variable can be:
The item text.
The index of the icon of the list view item within the bitmap file, set with the SetImages or SetSmallImages method (see page SetSmallImages). The SetImages method must be used for the icon view and the SetSmallImages method for the list, report, and small icon views.
In a report view, this argument can only be used for the first column.
One or more of the following values:
The item is marked for a cut-and-paste operation.
The item is highlighted as a drag-and-drop target.
The item has the focus and is therefore surrounded by the standard focus rectangle. Only one item can have the focus.
The item is selected. Its appearance depends on whether it has the focus and on the system colors used for a selection.
The following example displays the item text, icon index, and the item state in a message box:
::method DisplayItemInfo curList = self~GetListControl(104) itemInfo. = curList~ItemInfo(curList~Selected) call InfoDialog("Item Text : " itemInfo.!Text"d"x, "Image Index : " itemInfo.!Image"d"x, "Item State : " itemInfo.!State)
+-0------+ >>-aListControl~ItemText(--item--,--+--------+--)-------------->< +-column-+
The ItemText method retrieves the text of a list view item or a column.
The arguments are:
The number of the item.
The number of the column. If you omit this argument, 0 is assumed.
The item or column text, or -1 if you did not specify item.
>>-aListControl~ItemState(--item--)----------------------------><
The ItemState method retrieves the state of a list view item.
The only argument is:
The number of the item.
The state of the item, which can be one or more of the following values:
The item can be used in a cut-and-paste operation.
The item is highlighted as a drag-and-drop target.
The item has the focus and is therefore surrounded by the standard focus rectangle. Only one item can have the focus.
The item is selected. Its appearance depends on whether it has the focus and on the system colors used for a selection.
>>-aListControl~Select(--item--)-------------------------------><
The Select method selects an item.
The only argument is:
The number of the item.
The item was selected.
You did not specify item.
For all other cases.
>>-aListControl~Deselect(--item--)-----------------------------><
The Deselect method deselects an item.
The only argument is:
The number of the item.
The item was selected.
You did not specify item.
For all other cases.
>>-aListControl~Selected---------------------------------------><
The Selected method returns the number of the selected item.
The number of the item selected last, or -1 in all other cases.
>>-aListControl~LastSelected-----------------------------------><
The LastSelected method returns the number of the item selected last.
The number of the item selected last, or -1 in all other cases.
>>-aListControl~Focused----------------------------------------><
The Focused method retrieves the number of the item that has currently the focus.
The number of the item with the focus, or -1 in all other cases.
>>-aListControl~Focus(--item--)--------------------------------><
The Focus method assigns the focus to the specified item, which is then surrounded by the standard focus rectangle. Although more than one item can be selected, only one item can have the focus.
The only argument is:
The number of the item to receive the focus.
The specified item received the focus.
You did not specify item.
For all other cases.
>>-aListControl~DropHighlighted--------------------------------><
The DropHighlighted method retrieves the item that is highlighted as a drag-and-drop target.
The number of the selected item, or -1 in all other cases.
>>-aListControl~FirstVisible-----------------------------------><
The FirstVisible method retrieves the number of the first item visible in a list or report view.
The number of the first item visible, or 0 if the list view control is in icon or small-icon view.
>>-aListControl~NextSelected(--item--)-------------------------><
The NextSelected method retrieves the selected item that follows, or is to the right of, item.
The only argument is:
The number of the item at which the search is to start. The specified item itself is excluded from the search.
The number of the selected item, or -1 in all other cases.
>>-aListControl~PreviousSelected(--item--)---------------------><
The PreviousSelected method retrieves the selected item that precedes, or is to the left of, item.
The only argument is:
The number of the item at which the search is to start. The specified item itself is excluded from the search.
The number of the selected item, or -1 in all other cases.
>>-aListControl~Next(--item--)---------------------------------><
The Next method retrieves the item that follows, or is to the right of, item.
The only argument is:
The number of the item at which the search is to start.
The number of the following item, or -1 in all other cases.
>>-aListControl~Previous(--item--)-----------------------------><
The Previous method retrieves the item that precedes, or is to the left of, item.
The only argument is:
The number of the item at which the search is to start.
The number of the previous item, or -1 in all other cases.
>>-aListControl~NextLeft(--item--)-----------------------------><
The NextLeft method retrieves the item left to item.
The only argument is:
The number of the item at which the search is to start. The specified item itself is excluded from the search.
The number of the next item to the left, or -1 in all other cases.
>>-aListControl~NextRight(--item--)----------------------------><
The NextRight method retrieves the item right to item.
The only argument is:
The number of the item at which the search is to start. The specified item itself is excluded from the search.
The number of the next item to the right, or -1 in all other cases.
>>-aListControl~SmallSpacing-----------------------------------><
The SmallSpacing method determines the spacing between items in a small-icon list view control.
The amount of spacing between the items.
>>-aListControl~Spacing----------------------------------------><
The Spacing method determines the spacing between items in an icon list view control.
The amount of spacing between the items.
>>-aListControl~RedrawItems--+--------------------------+------>< +-(--first--+---------+--)-+ +-,--last-+
The RedrawItems method forces a list view control to redraw a range of items.
The arguments are:
The number of the first item to be redrawn. The default is 0.
The number of the last item to be redrawn. The default is 0.
The specified range of items was redrawn.
For all other cases.
>>-aListControl~UpdateItem(--item--)---------------------------><
The UpdateItem method updates a list view item.
The only argument is:
The number of the item to be updated.
The item was updated.
You did not specify item.
For all other cases.
>>-aListControl~Update-----------------------------------------><
The Update method updates a list view control.
0.
+-0-+ >>-aListControl~EnsureVisible(--item--,--+---+--)-------------->< +-1-+
The EnsureVisible method ensures that a list view item is entirely or partially visible by scrolling the list view control, if necessary.
The arguments are:
The number of the item visible.
Specifies whether the item must be entirely visible:
The list view control is not scrolled if the item is at least partially visible.
The list view control is scrolled if the item is only partially visible. This is the default.
The item is visible.
You did not specify item.
For all other cases.
>>-aListControl~SetSmallImages(--bitmap--+-----------------------------+--)->< +-,--+-------+--+-----------+-+ +-width-+ +-,--height-+
The SetSmallImages method assigns an image list to a small-icon list view control.
The arguments are:
The name of, or handle to, a bitmap file that has already been loaded using the LoadBitmap method.
The width of each image, in pixels. If you do not specify this argument or specify 0, the width of the image in the image file is used.
The height of each image, in pixels. If you do not specify this argument or specify 0, the height of the image in the image file is used.
The handle to the image list, or -1 if you did not specify bitmap, or 0 in all other cases.
The following example connects a bitmap file with a small-icon list:
::method InitSmallIconList curList = self~GetListControl(104) curList~SetSmallImages("oodlist.BMP",16,12)
>>-aListControl~SetImages(--bitmap--+-----------------------------+--)->< +-,--+-------+--+-----------+-+ +-width-+ +-,--height-+
The SetImages method assigns an image list to an icon list view control.
The arguments are:
The name of, or handle to, a bitmap file that has already been loaded using the LoadBitmap method.
The width of each image, in pixels. If you do not specify this argument or specify 0, the width of the image in the image file is used.
The height of each image, in pixels. If you do not specify this argument or specify 0, the height of the image in the image file is used.
The handle to the image list, or -1 if you did not specify bitmap, or 0 in all other cases.
The following example connects a bitmap file with an icon list:
::method InitIconList curList = self~GetListControl(104) curList~SetImages("oodlist.BMP",16,12)
>>-aListControl~RemoveSmallImages------------------------------><
The RemoveSmallImages method erases an image list of a small-icon list view control.
The image list was erased.
For all other cases.
>>-aListControl~RemoveImages-----------------------------------><
The RemoveImages method erases an image list of an icon list view control.
The image list was erased.
For all other cases.
+- -1--+ +-0-+ >>-aListControl~Find(--text--,--+------+--,--+---+--)---------->< +-item-+ +-1-+
The Find method searches for a list view item containing text. The text of this item must exactly match text.
The arguments are:
The text of the item to be searched for.
Specify the number of the item at which the search is to be started. Specify -1 or omit this argument to start the search at the beginning.
Specify 1 if the search is to be continued at the beginning if no match is found. Specify 0 or omit this argument if the search is to stop at the end of the list.
The number of the item, or -1 in all other cases.
+- -1--+ +-0-+ >>-aListControl~FindPartial(--text--,--+------+--,--+---+--)--->< +-item-+ +-1-+
The FindPartial method searches for a list view item containing text. An item matches if its text begins with text.
The arguments are:
The text of the item to be searched for.
Specify the number of the item at which the search is to be started. Specify -1 or omit this argument to start the search at the beginning.
Specify 1 if the search is to be continued at the beginning if no match is found. Specify 0 or omit this argument if the search is to stop at the end of the list.
The number of the item, or -1 in all other cases.
>>-aListControl~FindNearestXY(--x--,--y--+--------------------+--)->< | +-DOWN--+ | +-,--"--+-UP----+--"-+ +-LEFT--+ +-RIGHT-+
The FindNearestXY method searches, in the specified direction, for the item nearest to the specified position.
The arguments are:
The x-coordinate of the position at which the search is to be started.
The y-coordinate of the position at which the search is to be started.
The direction in which the search should proceed.
The index of the item, or -1 in all other cases.
>>-aListControl~Arrange----------------------------------------><
The Arrange method aligns items according to the current alignment style of the list view control.
The items were aligned.
For all other cases.
>>-aListControl~SnapToGrid-------------------------------------><
The SnapToGrid method snaps all icons to the nearest grid position.
The items were snapped.
For all other cases.
>>-aListControl~AlignLeft--------------------------------------><
The AlignLeft method aligns items along the left window border.
The items were aligned.
For all other cases.
>>-aListControl~AlignTop---------------------------------------><
The AlignTop method aligns items along the upper window border.
The items were aligned.
For all other cases.
>>-aListControl~ItemPos(--item--)------------------------------><
The ItemPos method retrieves the position of the upper left corner of the item.
The only argument is:
The number of the item.
The x- and y-coordinates of the upper left corner of the item, or -1 if you did not specify item, or 0 in all other cases.
Note: Use DefListDragHandler to support default dragging:
self~ConnectListNotify(104,"BEGINDRAG","DefListDragHandler")
+-0-+ +-0-+ >>-aListControl~SetItemPos(--item--,--+---+--,--+---+--)------->< +-x-+ +-y-+
The SetItemPos method moves an item to a specified position in a list view control, which must be in icon or small-icon view.
The arguments are:
The number of the item.
The x-coordinate of the new position of the upper left corner of the item, in view coordinates. The default is 0.
The y-coordinate of the new position of the upper left corner of the item, in view coordinates. The default is 0.
The item was moved.
You did not specify item.
For all other cases.
Note: Use DefListDragHandler to support default dragging:
self~ConnectListNotify(104,"BEGINDRAG","DefListDragHandler")
>>-aListControl~Edit(--item--)---------------------------------><
The Edit method begins editing of the text of the specified list view item.
The only argument is:
The number of the item.
The handle of the edit control used to edit the item text, or 0 in all other cases.
>>-aListControl~EndEdit----------------------------------------><
The EndEdit method cancels editing of the list view item that is being edited.
>>-aListControl~SubclassEdit-----------------------------------><
The SubclassEdit method is used by the DefListEditHandler to correct an operating system problem if the Esc or Enter key was pressed in an active edit control.
>>-aListControl~RestoreEditClass-------------------------------><
The RestoreEditClass method is used by the DefListEditHandler to correct an operating system problem if the Esc or Enter key was pressed in an active edit item.
>>-aListControl~ItemsPerPage-----------------------------------><
The ItemsPerPage method calculates the number of items that vertically fit the visible area of a list view control that is in list or report view. Only fully visible items are counted.
The number of fully visible items. If the current view is an icon or small-icon view, the return value is the total number of items in the list view control.
+-0-+ +-0-+ >>-aListControl~Scroll(--+---+--,--+---+--)-------------------->< +-x-+ +-y-+
The Scroll method scrolls the content of a list view control.
The arguments are:
An integer value specifying the amount of horizontal scrolling. If the control is in icon, small-icon, or report view, this value specifies the number of pixels to be scrolled. If it is in list view, this value specifies the number of columns to be scrolled. The default value is 0.
An integer value specifying the amount of vertical scrolling. If the control is in icon, small-icon, or report view, this value specifies the number of pixels to be scrolled. If it is in list view, this value specifies the number of lines to be scrolled. The default value is 0.
Scrolling was successful.
Scrolling failed.
>>-aListControl~BkColor----------------------------------------><
The BkColor method retrieves the background color for a list view control.
The color-palette index specifier (0 to 18). For more information on color palettes, refer to Definition of Terms.
>>-aListControl~BkColor=(--color--)----------------------------><
The BkColor= method sets the background color of a list view control.
The only argument is:
The new background color. Specify the color-palette index specifier (0 to 18). For more information on color palettes, refer to Definition of Terms.
The following example sets the background color of a list control to yellow:
::method Yellow curList = self~GetListControl(104) curList~BkColor = 15 curList~Update
>>-aListControl~TextColor--------------------------------------><
The TextColor method retrieves the text color of a list view control.
The color-palette index specifier (0 to 18). For more information on color palettes, refer to Definition of Terms.
>>-aListControl~TextColor=(--color--)--------------------------><
The TextColor= method sets the text color of a list view control.
The only argument is:
The new text color. Specify the color-palette index specifier (0 to 18). For more information on color palettes, refer to Definition of Terms.
The following example sets the text color of a list control to light blue:
::method LightBlue curList = self~GetListControl(104) curList~BkColor = 9 curList~Update
>>-aListControl~TextBkColor------------------------------------><
The TextBkColor method retrieves the background color of the text in a list view control.
The color-palette index specifier (0 to 18). For more information on color palettes, refer to Definition of Terms.
>>-aListControl~TextBkColor=(--color--)------------------------><
The TextBkColor= method sets the background color for the text in a list view control.
The only argument is:
The new background color for text. Specify the color-palette index specifier (0 to 18). For more information on color palettes, refer to Definition of Terms.