LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

active x

Hi. I am recently doing a project with Labview which requires to set a
certain Control Name to a certain Control Value and then the control value
is indicated in the table along with the control name. However, I am having
trouble to accomplish this task using Set Variant Attribute.

ConfusedInLabview
0 Kudos
Message 1 of 5
(3,006 Views)
In LabVIEW, Variant Attributes are an associative array of named Variants that are "attached" to Variant Data. Set Variant Attribute and Get Variant Attribute each provide access to these attributes. However, Variant Attributes really have nothing to do with ActiveX. But, ActiveX does make extensive use of the Variant data type, so this might be where you got off-track.

I think that what you are trying to do is traverse the ActiveX Control's object hierarchy and set an attribute of one of those objects. This requires the use of property and/or invoke nodes to open references to these sub-objects and then, ultimately, set the attribute of one of those objects.

I recommend taking a look at some of the ActiveX examples that are provided with LabVIEW or ar
e found in the Developer Zone website. Specifically the LabVIEW example found at "/Examples/comm/ExcelExamples.llb/Excel Macro Example.vi". This shows how to open a "Cell Range" reference from a "Workbook" reference from a "Worksheet" reference from a "Workbook" reference from an Excel "Application" reference. Maybe this could be used as an analog to what you are trying to accomplish.

Best of luck,

-Jim
0 Kudos
Message 2 of 5
(3,005 Views)
Thank you! Sorry but I have one more question about Labview. How does the
user get a reference programmatically from the control name? Is there some
sort of VI that can do the job?

LessConfusedInLabview

"Jim Kring" wrote in message
news:506500000005000000C20F0100-1042324653000@exchange.ni.com...
> In LabVIEW, Variant Attributes are an associative array of named
> Variants that are "attached" to Variant Data. Set Variant Attribute
> and Get Variant Attribute each provide access to these attributes.
> However, Variant Attributes really have nothing to do with ActiveX.
> But, ActiveX does make extensive use of the Variant data type, so this
> might be where you got off-track.
>
> I think that what you are trying to do is traverse the ActiveX
>
Control's object hierarchy and set an attribute of one of those
> objects. This requires the use of property and/or invoke nodes to
> open references to these sub-objects and then, ultimately, set the
> attribute of one of those objects.
>
> I recommend taking a look at some of the ActiveX examples that are
> provided with LabVIEW or are found in the Developer Zone website.
> Specifically the LabVIEW example found at
> "/Examples/comm/ExcelExamples.llb/Excel Macro Example.vi".
> This shows how to open a "Cell Range" reference from a "Workbook"
> reference from a "Worksheet" reference from a "Workbook" reference
> from an Excel "Application" reference. Maybe this could be used as an
> analog to what you are trying to accomplish.
>
> Best of luck,
>
> -Jim
0 Kudos
Message 3 of 5
(3,005 Views)
The Excel example that I mentioned earlier shows how to interface with an application's ActiveX Server. However, for interfacing with ActiveX Controls, you will need to use an ActiveX Container. This may be found in the Controls Palette at Controls >> ActiveX >> Container. Right-click on it and choose Insert ActiveX Object. This will open the Select ActiveX Object Dialog. If the control is registered correctly with the OS, you may find it in the listbox under the Create Control option of the pull-down menu. If you are linking to an .ocx file directly you can choose Create Object from File from the pull-down menu, and then Browse to the ActiveX Control (*.ocx) file.

Once you have inserted an Act
iveX Control into the Container, the block-diagram terminal of the Container will output a valid refnum to the object. You do not need to explicitly open a reference with the Automation Open function as you did with the Excel (ActiveX Server) example. Wire this reference to property and invoke nodes and you are ready to go.

-Jim
0 Kudos
Message 4 of 5
(3,005 Views)
Thanks!

"Jim Kring" wrote in message
news:50650000000500000032100100-1042324653000@exchange.ni.com...
> The Excel example that I mentioned earlier shows how to interface with
> an application's ActiveX Server. However, for interfacing with
> ActiveX Controls, you will need to use an ActiveX Container. This may
> be found in the Controls Palette at Controls >> ActiveX >>
> Container
. Right-click on it and choose Insert ActiveX
> Object
. This will open the Select ActiveX Object Dialog.
> If the control is registered correctly with the OS, you may find it in
> the listbox under the Create Control option of the pull-down
> menu. If you are linking to an .ocx file directly you can choose
> Crea
te Object from File
from the pull-down menu, and then
> Browse to the ActiveX Control (*.ocx) file.
>
> Once you have inserted an ActiveX Control into the Container, the
> block-diagram terminal of the Container will output a valid refnum to
> the object. You do not need to explicitly open a reference with the
> Automation Open function as you did with the Excel (ActiveX Server)
> example. Wire this reference to property and invoke nodes and you are
> ready to go.
>
> -Jim
0 Kudos
Message 5 of 5
(3,005 Views)