EVENT_DROP
- Updated2023-02-21
- 2 minute(s) read
EVENT_DROP
Description
Tree and Tab Controls—LabWindows/CVI generates drop events while a user drags a tree item or tab page. This event is sent to the callback function associated with the control when the potential drop location changes. The purpose of the event is to allow or disallow the item to be dropped to the new location.
Splitter Controls—LabWindows/CVI generates and sends drop events during the splitter operation.
This event is swallowable. Return 1 to swallow EVENT_DROP. If you swallow EVENT_DROP for splitter control events, the drag line will not move and attached items will not be sized for that particular incremental movement of the mouse cursor. If you alternate between swallowing and not swallowing this event during an operation, the first time you do not swallow the event negates the previous iterations when you did swallow the event. When EVENT_DROP is swallowed, the cursor changes from the default cursor to the "not allowed" cursor . The "not allowed" cursor remains visible until a subsequent EVENT_DROP is not swallowed or the sizing operation stops.
Applies To
Event Data Parameters
User Interface Object | Event Data Values |
---|---|
Trees | eventData1 = Position and relation. The eventData1 parameter contains both the new potential position and relation of the dragged item. The position and relation values are relative to the tree item at the index contained in eventData2. Position defines whether the item will be inserted before or after the tree item. The low order word contains the relation and will either be VAL_CHILD or VAL_SIBLING. The high order word contains the position and will either be VAL_PREV, VAL_NEXT, or VAL_FIRST. eventData2 = relativeIndex. relativeIndex is the index of the relative of the new potential drop location. |
Tabs | eventData1 = Not used. eventData2 = destinationIndex. destinationIndex is the index of the new drop location. |
Splitters | eventData1 = Vertical coordinates of the current drag line position. eventData2 = Horizontal coordinates of the current drag line position. |
Example Code
int CVICALLBACK TreeCallback (int panel, int control, int event, void *callbackData, int eventData1, int eventData2)
{
int retval = 0;
int relation, position;
switch (event)
{
case EVENT_DROP:
relation = LoWord(eventData1);
position = HiWord(eventData1);
if (VAL_CHILD == relation)
retval = 1; /* disallow dropping as a child */
break;
}
return retval;
}
LabWindows/CVI Compatibility
LabWindows/CVI 7.0 and later