SDK:Layout Manager: List Browser

From Vectorworks Developer
Revision as of 15:39, 12 August 2013 by Root (talk | contribs) (1 revision)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

.SDK|SDK ..SDK:Types|SDK Types ..SDK:Using the SDK|Using the SDK ..VCOM:VCOM (Vectorworks Component Object Model)|VCOM Basics ..VCOM:Class Reference|VCOM Class Reference

XXX

When handling events for list browsers, the data parameter in the event handler function contains information about the event. To access the data parameter in the event loop, do the following:

long*	liData	= (long*)data;

Dereferencing liData (i.e. *liData) will give you the data value.

The list browser uses a zero-based index. *liData therefore can range from 0 to the number of rows – 1, or the number of columns – 1. Note the data parameter can represent the column clicked or the row clicked depending on what action was performed.

The user’s action is determined by a combination of the values of itemHit and *liData.

User action Values of itemHit and *liData
Double Click itemHit is negated.
Single Click on a Non- Control Column *liData represents the row clicked (this may be changed to represent the column clicked). For example, left-clicking in a list browser on the item fourth from the top would result in the following: *liData would have a value of 3.
Single Click on a Control Column *liData represents the column clicked. See the following table for a list of column types.


There are several control column types:

*liData Predefined constant Column type
1 kListBrowserControlNone A column containing only non-editable text. Example: Design Layer Name column in Organization Dialog.
2 kListBrowserControlRadio A radio column containing radio icons. Example: Visibility column in Organization Dialog.
3 kListBrowserControlMultiState A column containing an icon, when clicked, changes to another icon. Example: C/BW column in the Batch Print Dialog.
4 kListBrowserControlSingleInstance A column where an icon is only shown in one row. Example: Active Element column in Organization Dialog.
5 kListBrowserControlStaticIcon A column containing a static icon. Example: Section Viewport column in the Organization Dialog.
6 kListBrowserControlNumber A column containing a number that is sortable. Example: Delta Z column in the Organization Dialog.
7 kListBrowserControlMultipleImages A column containing one or more icons. Example: Layer and Class Options column in Organization Dialog.


Left-clicking in a list browser’s control column results in two events:

First event:

  • liData contains the value -2, signifying the start of a data column change

Second event:

  • liData contains a value equal to the column index where the click occurred.


Here is a sample function that processes these two events:

Boolean HandleColumnDataChangeMessage(long liItemHit, long liData)
{
	Boolean		bSuccess 				= true;
	static Boolean	sbReceivingColumnDataChangeMsg	= false;
	const int		kColumnDataChangeMessageStart	= -2;

  	if (liData == kColumnDataChangeMessageStart) {
		sbReceivingColumnDataChangeMsg	= true;
		sbUpdateAllItems			= false;
	}
	else {
		if (sbReceivingColumnDataChangeMsg) {
			if (liData != -1) {
				sbReceivingColumnDataChangeMsg = false;

				switch (liItemHit) {
					case kListBrowser: {
						// Process message
						...

Note that you only get two messages regardless of how many items are selected for performance reasons. If you are dealing with a multi-hundred layer list, you do not want to wait for multi-hundred messages in order to process the click. You can use GS_IsListBrowserItemSelected within a loop to determine which items need to process the click. Since the message is sent after the list browser data has been changed, you can use functions such as GS_GetListBrowserItemInfo to check the new value of the data column.