NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

how can I access listbar items

I'm working in the testexec program using CVI and need to keep track of the active listbar item.
How can I read this into string(for the title) and int(for the order) formats using CVI?
0 Kudos
Message 1 of 5
(3,639 Views)

What I'm really trying to do is identify which execution is active in a multithread environment. I have the callback

HRESULT CVICALLBACK ExecutionViewMgr_OnExecutionChanged(CAObjHandle caServerObjHandle, void *caCallbackData, TSUIObj_Execution  execution)

which gets called everytime I click on one of the executions. The parameter TSUIObj_Execution  execution is the same regardless of which thread I select.

0 Kudos
Message 2 of 5
(3,632 Views)
Hey Steve,

Could you let us know what method(s) you are using in order to retrieve the name from the currently selected execution? 
Derrick S.
Product Manager
NI DIAdem
National Instruments
0 Kudos
Message 3 of 5
(3,589 Views)
Sorry for not closing this thread sooner. I found the solution:
 
    error = TSUI_ListBarGetPages (gMainWindow.listBar, &errorInfo, &pages);
    error = TSUI_ListBarPagesGetItem(pages, &errorInfo, CA_VariantLong(EXECUTIONS_PAGE_INDEX), &page);
    error = TSUI_ListBarPageGetCursor (page, NULL, &cursor_index);
    error = TSUI_ListBarPageGetItems (page, NULL, &items);
    error = TSUI_ListBarPageItemsGetItem (items, NULL, CA_VariantLong(cursor_index), &item);
    error = TSUI_ListBarPageItemGetCaption (item, NULL, item_name);
The help documentation wasn't geared towards CVI and CVI doesn't have a teststand object browser and this object couldn't be viewed from the sequence editor because it is testexec code. I finally figured it out, but it took a while.
Message 4 of 5
(3,585 Views)
Steve,

Iterating through the process that you posted is a perfectly valid solution, and I'm glad you found a method that works for you!  I pursued this option at first as well, until I realized that the name of the currently selected execution could be more easily retrieved simply as a property of the execution, which is an input (parameter) to the event OnEventChanged callback you discovered.

Navigating the NI TestStand Help document led me to find the displayname property of the execution object, which I was able to use to retrieve the information that you desired via the TS_ExecutionGetDisplayName() command.  Food for thought, I guess.  Best of luck with the rest of your application!
Derrick S.
Product Manager
NI DIAdem
National Instruments
0 Kudos
Message 5 of 5
(3,576 Views)