ObjectListView, OListView, OLView

ObjectListView(name~aliasName, flags, x, y, w, h)

Parameter
Parameter   Description
name * identifier or CLASS::expr
aliasName   an additional identifier
flags   flags
x * position X (in minicells)
y * position Y (in minicells)
w * width (in minicells)
h * height (in minicells)
* - mandatory parameter

The tuple (class, Access Path) defines a mapping on model data (see FillWindow, DrainWindow). With this object box - just like with every other ObjektBox - it is possible to map object relations and edit them interactively.

In terms of functionality and appearance, an ObjectListView is similar to the ObjectList. While this is the elemental way of displaying a list (ListBox) as it is common for every Windows version (and other platforms), the ObjectListView uses the more modern and variable ListView box which has been introduced with Windows 95 in the file explorer.

Attention!
In case a list has only one line, and this line is smaller than a default character in the selected font, the line height will be decreased down to 2 pixels, which makes the entry barely readable.

Example (please pay attention to the height at the very end of the line):
Brings no visible FillWindow entry, since the list is not high enough:

 ObjectListView(CX_TRANSACTION::monitors, NO_COLUMNHEADER, AUTO_POSITION, NO_DRAIN, BITMAP_SIZE, ENTIRE, 350, 33, 230, 9)

So passt dann die Schriftart in die Liste und die Zeile wird angezeigt:

 ObjectListView(CX_TRANSACTION::monitors, NO_COLUMNHEADER, AUTO_POSITION, NO_DRAIN, BITMAP_SIZE, ENTIRE, 350, 33, 230, 10)

 

There are typical patterns how data is formatted in a ListView.

Header:
This also provides an integrated display of column headers, which can also be accessed with the InstantView® interface via (pseudo-) widget header.
To use them, the ObjectListView identifier will be passed to the header widget as a parameter (see help text header). Prompts and buttons as dependent header widgets are copied  into the integrated ObjectListView header (the originals should be hidden via HIDDEN flag). Here, buttons always represent column headers which need to be clicked on to sort the column.
Clicking the buttons multiple times reverses sorting / undoes sorting. When applying a column header while pushing the <Ctrl> key, the equivalent key will be added to the current sorting and provides multi-sorting.
The sorting will be indicated via arrows. Second, third etc. sorting criteria are marked with two, three etc. arrows. A sorting type which has been defined with SetSort will be indicated in the exact same manner. Defining a sorting (with SetSort) without activation (not calling Sort), it will be represented by deactivated(gray) arrows. Such a sorting can be activated by clicking on the equivalent column header, while keeping the <Ctrl> key pushed. Under certain circumstances (already activated sorting will be reset (identically) with SetSort, list contains not more than one element), the ObjectListView notices, that the sorting is activates, although sort has not been explicitly called. Independent from the sorting, the SELECT sections of the corresponding widgets will be accessed in the (InstantView®-) header, when applying the column header. In case an ObjectListView had been adapted from an ObjectList, it needs to be considered, that eventual sorting mechanisms have to be commented out in these SELECT reactions. If the Cancel is executed in the SELECT implementation (at the end), this automatic sorting will stop. A SELECT at a header button with only the statement cancel is an implementation of an integrated column header, which has not been sorted. Columns can be resorted via drag and drop in the column headers. (This drag and drop must not be mistaken for an InstantView® Drag and Drop. There are options supported for any intervention). With this, each column keeps its original format list number. Ein SetSort with this number always sorts the same column, no matter if the columns had been resorted. 

In case the cursor reaches the area in between two column headers (column), it turns into a vertical bar with two horizontal arrows. When this happens, it is possible to change the column header width left from the cursor, by moving the cursor left or right while keeping the left mouse-button pushed down. Double-clicking in this position, the left column will be adjusted to the exact same size without AUTO_POSITION (see below). All column elements will be perfectly fitted - as big as the biggest column element. The automatic column width calculation will be switched on or off with this double-click or by pulling the column width with AUTO_POSITION.

 

Formatting, Display and Interaction:
While ObjectList column elements with the same column number (set in SetFormat via COLUMN flag) are simply displayed on top of each other, all these column elements are merged in the ObjectListView. With this, the contained bitmaps will be filtered at first and the first one (according to format list) will be displayed at the left column cell edge. All following bitmaps will be ignored. Text entries join in their order into a string (separated via ''(<space>)), which will be displayed on the right. The first format decides about left- and right-alignment. A pure basic window object, the basic ListView box follows the general window interface attributes. Due to this, especially element marking via click is different to marking in the ObjectList: it is possible to select entire areas with <Shift>- and  <Ctrl> key. Clicking on an element without any key first undoes any active selection and then selects the element under the cursor.

In case the object list is (actively) sorted, it is possible to navigate inside the first sorting criterion column via alphabetic key. Characters that have been entered quickly one after the other, are considered as a (sub-)string and the column will be searched for it. Here, column elements are internally also turned into strings. Ein Versuch ein Element durch teilweise Eingabe dieses Textes schlägt fehl, wenn die Spalte zwar sortiert ist, ein Einträge in den Spalten-Elementen jedoch als String aufgefasst nicht sortiert sind.
An example is a column with data fields: the data "3.8.99","12.9.99" is sorted in this order, based on date. As pure (not interpreted) strings, '1' would have to be in front of '3'. Therefore, they would not be sorted. If an alphabetic navigation fails, an element will be accessed, which has eventually nothing to do with the entered text. No problem report appears. Right-alignment will be considered and doesn't cause - even when mixed with left-alignment - wrong behavior.

Bitmaps, that should be displayed in an ObjectListView, can contain up to 256 colors and have to have a palette. This can be realized with the Graphic Formats .PNG, .BMP, .GIF and .TIF.

 

virtual list:
The ObjectListView differs from pure display in how it imports and edits data. This makes it possible to make large amounts of data visible and accessible in a relatively short time period. For this, it uses a ListView box feature called Virtual List:
While the list box at first imports all data into the ObjectList (after initialize) and completely turns it into visual representation and saves it there, the ObjectListView tries to keep the effort as small as possible. For this at first only references to the affected objects are saved from the source (such as access path to a collection) in an internal table. Only when list areas defined by the interface are called for display, visual representations are generated for the affected objects and reported back to the interface. With this, the visual representations during runtime are certainly not available (for all) objects / are just generated in a non-predictable order, independent from the input order of object references. (Generated visual instances are buffered to save time and will only be regenerated under certain circumstances.) This has multiple implications for using the ObjectListView:

 

DrainWindow:
While FillWindow only refers to windows that are displayed on the screen, DrainWindow refers to all objects. For many objects, this might take a while: DrainWindow should not be used for ListViews, which can hold many objects (because this is required or allowed by the application case). ListViews which display only a few objects can be exported via DrainWindow.

The object box is programmed with the following statements (identical to ObjectList statements):

The command Widget brings an ObjectListView into the stack, so it is possible to access widget methods and attributes.

The following methods are provided by the ObjectListView:

 

Flags
Flag Description
ACCEPT_DROP Objects can be moved across the screen from one object box to the other via drag and drop. The action list needs to describe what should happen with the objects (see example).
AUTO_POSITION The x positions are automatically calculated, and therefore don't have to be specified explicitly with SetFormat. In contradiction to the ObjectList, there are only visualizations available for the currently visible objects. Therefore for this area, AUTO_POSITION only calculates the column entry with the longest text. (plus bitmap width plus distance bitmap/text, in case a bitmap gets displayed.) This has the adverse effect, that the column width is constantly changing, when scrolling. To avoid this, freeze column width after AUTO_POSITION. 
CONTEXTMENU(identifier) The identifier is an item identifier inside a menu- or ContextMenuList declaration. Right-clicking, automatically displays the sub-menu under this Item. Now, selecting a menu item starts the equivalent action as described in Item, just as if the menu item had been called from the main menu.
Additionally, when executing SELECT, GetCurrentWidget can find out for the according item, from which window object the menu item has been called via ContextMenu. Calling from the main menu, GetCurrentWidget returns ZERO. If a ContextMenu doesn't appear automatically, it can also be called via PopupMenu from InstantView® (according to style guides, this should be caused by a right mouse-click - MOUSE_CLICK_R). In this case, the flag CONTEXTMENU should not be displayed, since this would make the menu appear twice (once automatically and once controlled).
DRAG_COPY Selected objects can be dragged via right mouse button to another object box or to a Window (drag and drop). The objects can only be dropped on a flag with ACCEPT_DROP. The list box entries will persist.
DRAG_MOVE Just like in DRAG_COPY, it is possible to drag selected objects to another object box or to another Window. The according list box entries are deleted when objects are dropped into another list box or Window with the flag ACCEPT_DROP.
HELP(anchor) Help("file#anchor") Connects the window object with the Online Help in HTML format. If no file name has been specified, the HTML file specified in the module applies.
HIDDEN The object box remains invisible, until statement Show makes it appear on the screen.
ITEM(w, h), ITEM(w), ITEM(, h) If width and height of a list box entry differ from defined list box measures, they will be specified in this way. A larger width makes sense in connection with the flag HZ_SCROLL_BAR. Entries with multiple lines require an explicit height specification.
LIST_INVALID (ab 4.2) Normally, an object box only adopts valid objects. This flag though, allows to adopt and display invalid objects, too.
LIST_ORIGIN In case an invalid object is inserted into a ListView and if there is a valid exchange object, this valid exchange object is usually adopted. This is prevented by this flag, so only the valid original object is adopted. The interplay with LIST_INVALID is described in detail further down.  
NO_COLUMNHEADER No column descriptions are displayed.
NO_SORTHEADER Column buttons are not displayed as buttons. This is why the list cannot be sorted on a column head via button. It is possible though to change column width and to move columns.
NULL_ELEMENT The object box automatically generates an entry, which refers to no object. A ZERO-element is necessary if the object box is used to display a pointer or a 1-1- or 1-m-relation with FillWindow and DrainWindow.
OPTIMIZE The optimization refers to the access paths for list columns (compare statement SetFormat): Equal sub-expressions are evaluated only once (further reference... ).
SELECT_MULTIPLE It is possible to select more than one object (only for listbox!).
TOOLTIP(mlString) The specified string is displayed as a TOOLTIP, or, in case an event tooltip has also been defined, passed to this event. Tooltip display is automatically caused after the cursor being on the window object without moving for a specific amount of time. The string can be multilingual. The current language string gets passed to the event. 

Termination

A termination (AbortTXN, Attention(AbortTXN), etc.) empties the ListView - but only, if it has been changed within the transaction. This assures, that the ListView contains no objects which possibly don't exist anymore (such as new persistent objects, that have been deleted due to termination). 

Interaction LIST_INVALID with LIST_ORIGIN

Without flags, only valid objects are adopted. In case of an invalid object, the valid exchange object will be adopted. LIST_INVALID also allows invalid objects to be adopted, LIST_ORIGIN only adopts the original object, not the exchange object:

Flags / Object g ug u
- g g -
LIST_INVALID g g u
LIST_ORIGIN g - -
LIST_INVALID+LIST_ORIGIN g u u

g = valid object,
ug = invalid object with a valid exchange object,
u = invalid object

Attention!
When combining LIST_INVALID with LIST_ORIGIN, the original object will be adopted into the list in any case, even if there is a valid exchange object. This will be put into the stack, for example when double-clicking or due to the command GetObject. This means there might be an invalid object in the stack, which has a matching valid exchange object - this is unusual in ClassiX®! Please add a "this" to work with a valid exchange object, such as "this.uniqueID".