LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

dimm NIDAQmx_NewPhysChanAICtrl

In Labwindows it is possible to create in the user interface a string for input of I/O channels for NIDAQmx. There is is special function that adds a drop-down to this string so that you can click/browse/filter the I/O channels instead of typing. This is done with NIDAQmx_NewPhysChanAICtrl.
 
During acquisition I want to dimm this control so that nobody "thinks" that he/she is allowed to change the input channels during acquisition.
I can dimm the string-control, but I cannot dimm the drop-down add-on.
 
Is it possible to change parameters for this drop-down input ?
Or is is possible to retrieve a control-ID for this drop-down input ?
 
Jos
 
0 Kudos
Message 1 of 7
(4,073 Views)
Jos,

There isn't really a good way to get the id for the ring. Here's the best workaround I can get:

1. Enumerate all the controls in the panel, using ATTR_FIRST_CTRL and ATTR_NEXT_CTRL.
2. Look for a control that matches the characteristics of this one. For example: 1. get the ATTR_CTRL_STYLE attribute and see if its CTRL_POPUP_MENU_RING or CTRL_POPUP_MENU_RING_LS. 2. make sure ATTR_CONSTANT_NAME is blank. 3. or you can do it based on the position of the control.

Luis

0 Kudos
Message 2 of 7
(4,063 Views)

Hello Luis,

 

Your suggestions works fine. Although I am lazy and used a variation on option 2: CONSTANT NAME LENGTH

But for you and others: I am still looking. Because after finding the control, I tried to dimm it - together with other acuisition-parameter-controls - when I start the actual NI-DAXmx task. Where all the other parameter-controls are dimmed, this NewPhysChannelAICtrl is not dimmed and is active.

 

Thanks Jos

 

0 Kudos
Message 3 of 7
(4,045 Views)
Hello Jos,

The ring control is not the only additional control created in NewPhysChannelAICtrl. There are other controls created, for cosmetic purposes, so if you are dimming only the first control that you find that has an empty constant name, then there's a good chance that you are never dimming the ring control. You have to either continue iterating through all controls looking for additional controls to dim, or if you prefer, you can dim only the ring control by checking the ATTR_CTRL_STYLE attribute.

Luis
Message 4 of 7
(4,031 Views)
Jos,

I have a better answer than Luis.  Smiley Happy

Starting with DAQmx 8.1, there is a new attribute that allows you to dim the DAQmx I/O control.  You can call NIDAQmx_SetPhysChanCtrlAttribute with IOCtrl_Dimmed.  Unfortunately, in DAQmx 8.3 and later, there is a bug that causes this function to return an error when running in Debug mode, but it should work fine in Release mode.  This bug will hopefully be fixed in an upcoming release.

If you want, you can rate Luis' reply with 1 star and my reply with 5 stars.  Smiley Wink  (Just kidding, I know Luis and I'm giving him a hard time...)

-Jeff

0 Kudos
Message 5 of 7
(4,012 Views)

Sorry Jeff,

I have changed my source code as suggested by Luis and this works. And as I just installed DAQmx 8.5, yous suggestion won't work. So Luis does get the top grade.

For both and all others, I have a portable at home with only virtual devices. I have a desktop at work with some virtual devices, sometimes a PCI-6110 but always its virtual version, and sometimes an USB device. And when I port an application to a laboratory, I only have the real hardware. So the use of 'Dev#' becomes very confusing. I advise developers to make for themselves a drop-down that gives a choice from all available interfaces by product type (i.e. PCI-6110 and PCI-6111 and PCI-6032E). And from the choice for one interface, you can add a second for selection of input or output channels. I just made a start and found already 'DAQmxGetSystemInfoAttribute' for a getting a string with 'Dev' identifiers, and 'DAQmxGetDeviceAttribute (DAQmx_Dev_ProductType)' for conversion of each 'Dev' to a 'readable' identifier.

 

Thanks all, Jos

0 Kudos
Message 6 of 7
(3,999 Views)

Anyone who is using DAQmx version 16.1, the following code worked for me:

NIDAQmx_SetPhysChanCtrlAttribute(panelHandle,controlName, NIDAQmx_IOCtrl_Dimmed, 1); // dims the control

0 Kudos
Message 7 of 7
(2,699 Views)