キャンセル
次の結果を表示 
次の代わりに検索 
もしかして: 

String reference

Q.PNG

Why is an array of strings classified as an "Array" class in the top method, while in the bottom method it is classified as a "String" class?

0 件の賞賛
メッセージ1/13
1,626件の閲覧回数

Hi Max,

 

do you even look at the very same FP objects?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 件の賞賛
メッセージ2/13
1,623件の閲覧回数

In the top method, you search only the "top-level" controls.

In the bottom method, the search covers all controls, that is, arrays AND the elements they contain.

 

Think of this as a cluster.

In the top method, you will have only one element: the cluster, the parent.

In the bottom method, you will have the cluster and all the controls it contains, the children.

0 件の賞賛
メッセージ3/13
1,621件の閲覧回数

I understand. Is there a way to retrieve only the "top-level" controls in the top method? Additionally, is there a way to determine the order of the references returned by these two methods?

0 件の賞賛
メッセージ4/13
1,584件の閲覧回数

Hi Max,

 


@maxnoder1995 wrote:

I understand. Is there a way to retrieve only the "top-level" controls in the top method?


The "top method" returns just the "top level" controls.

(I guess you didn't understand yet.)

 


@maxnoder1995 wrote:

Additionally, is there a way to determine the order of the references returned by these two methods?


Why do you need the "order" of those references?

You can determine/compare the order by comparing the labels of the referenced fp elements or any other unique property…

 

(You know you should use unique labels for all fp elements?)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 件の賞賛
メッセージ5/13
1,578件の閲覧回数

@maxnoder1995 wrote:

Q.PNG

Why is an array of strings classified as an "Array" class in the top method, while in the bottom method it is classified as a "String" class?


The lower one scans specifically for string objects, the top one shows the top objects, and clearly you have an Array (of strings) as your first object.

The order is typically the Tab order.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 件の賞賛
メッセージ6/13
1,568件の閲覧回数

@maxnoder1995 wrote:

Is there a way to retrieve only the "top-level" controls in the top method?


I guess you meant to ask for the bottom method (with "Traverse for GObjects")?

 

No because this method goes recursively into data containers such as Clusters and Arrays.

You would have to filter Control references yourself by checking whether their Owner is another Control or not:

 

raphschru_0-1742562944376.png

 

 


@maxnoder1995 wrote:

is there a way to determine the order of the references returned by these two methods?


Panel property "All Objects[]" gives the refnums in the reverse order in which the objects were created.

 

For "Traverse for GObjects", it is much more complicated. Apparently it also gives refnums in the reverse order of creation, except it goes recursively (depth-first) in the data containers (clusters, arrays, ...), where it also lists the children elements in reverse order of creation, etc...
And finally for TabControls, it also goes recursively into the pages, but in the normal order (Page 1, Page 2, ...).

 

Regards,

Raphaël.

メッセージ7/13
1,561件の閲覧回数

Tab order affects the order of Panel.AllObjs[], but it does not influence the order of the output from "Traverse for GObjects.vi".

It’s also frustrating that there’s no Boolean input for "recursive?"—perhaps this function was designed for a different purpose than what I’m trying to achieve.

Thanks anyway, everyone!

0 件の賞賛
メッセージ8/13
1,551件の閲覧回数

@maxnoder1995 wrote:

Tab order affects the order of Panel.AllObjs[], but it does not influence the order of the output from "Traverse for GObjects.vi".


Actually, "Panel.AllObjs[]" is not affected by the Tabbing Order, because it also possibly contains decorations, which don't have the tabbing functionality. So the only relevant order is the order of creation, and reversed for some reason. EDIT: actually "Panel.AllObjs[]" follows the Z-order from frontmost to "backmost".

 

What does match the Tabbing Order is "Panel.Controls[]".

 


@maxnoder1995 wrote:

It’s also frustrating that there’s no Boolean input for "recursive?"


It actually has a flag for that, but it is buried inside the implementation of "Traverse for GObjets". If you look at its diagram, it uses a callback named "TRef FinderCallback.vi", which looks like this:

 

raphschru_0-1742565053584.png

 

You could create your own implementation of "Traverse for GObjects" with a custom callback that skips some object's hierarchies based on some condition. However, I would not recommend it because you could encounter more problems than you are trying to currently solve. See this: https://forums.ni.com/t5/LabVIEW/GObject-properties-broken-when-accessed-within-a-Traverse/m-p/38763...

 

So the post-filtering as I suggested is the best solution to me.

 


@maxnoder1995 wrote:

perhaps this function [Traverse for GObjects] was designed for a different purpose than what I’m trying to achieve.


I think it is mainly intended for VI Scripting, but can also serve for gathering FP references like it seems you want to do.

 

Regards,

Raphaël.

0 件の賞賛
メッセージ9/13
1,534件の閲覧回数

maxnoder1995_0-1742566881801.png

I’ve written a program that positions each Boolean control directly below a String control on the front panel.

Is this the best approach to do it?

0 件の賞賛
メッセージ10/13
1,527件の閲覧回数