LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

prob with CANVAS and ATTR_CTRL_MODE

Hallo everybody,

by pressing a TOGGLEBUTTON the CANVAS shouldn't be able to do its CVICALLBACK till the TOGGLEBUTTON is set back

my idea:

 ... CVICALLBACK TOGGLEBUTTON ...
{
...
if (togglebutton is set)
SetCtrlAttribute (panel, PANEL_CANVAS, ATTR_CTRL_MODE, VAL_INDICATOR);

else
SetCtrlAttribute (panel, PANEL_CANVAS, ATTR_CTRL_MODE, VAL_HOT);
...
}


... CVICALLBACK CANVAS ...
{
...
case EVENT_LEFT_CLICK:
...
}

But the Canvas is still be executable by the operator. Why?

0 Kudos
Message 1 of 3
(2,913 Views)

Florian,

 

Mouse events are low-level events that are not affected by the control mode attribute. Making the control an indicator usually means that you cannot operate the control interactively, nor can you tab to that control. So, for example, an indicator control would never send a commit event, since its value could not be changed interactively. However, canvas controls already don't hold values, in the traditional sense of the word, so setting it to an indicator does not make a big difference.

What you will have to do is to put some logic in the canvas callback to not do anything as a result of a left-click event if the control is an indicator, for example.

 

Luis

NI

0 Kudos
Message 2 of 3
(2,908 Views)
Ok thanks for this long explanation.

Florian
0 Kudos
Message 3 of 3
(2,899 Views)