NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use TS_LayoutPersister functions

Hi all,

 

I am working on modifying an existing customized TestStand execution window, implemented in LabWindows/CVI 2009 with TestStand Engine Version 4.2.1.

 

And, when I look at how the main execution panel is initialized and loaded, I saw the code is calling "TS_LayoutPersister" functions.  I want to ask how do I know where is the configuration file that stores the panel size information, and how does the Application Manager specifies the location of the configuration file?

 

 

Secondly, as I am looking at make the initial startup panel size to fix size, I am thinking to use "SetPanelAttribute" with ATTR_WIDTH and ATTR_HEIGHT but I don't know how I should arrange the code so that the controls would arrange properly.  Or should I eliminate the TS_LayoutPersister complete and manually use "SetPanelAttribute" to rearrange the LISTBAR, SEQUENCES, CALLSTACK, SEQUENCE_STEPS, EXECUTION_STEPS, REPORTVIEW pane (is that doable)?   

 

The following code snips is what I was thinking to do.

 

------------------------------------------------------------

// Remember window and control positions from last time
errChk( TS_LayoutPersister_LoadSizes(gMainWindow.applicationMgr, &errorInfo, NULL, 0, 6,
gMainWindow.panel, MAINPANEL_LISTBAR,
gMainWindow.panel, MAINPANEL_SEQUENCES,
gMainWindow.panel, MAINPANEL_CALLSTACK,
gMainWindow.panel, MAINPANEL_SEQUENCE_STEPS,
gMainWindow.panel, MAINPANEL_EXECUTION_STEPS,
gMainWindow.panel, MAINPANEL_REPORTVIEW));
errChk( TS_LayoutPersister_LoadBounds(gMainWindow.applicationMgr, &errorInfo, NULL, TRUE, 0, 1,
gMainWindow.panel, 0));

 

SetPanelAttribute (gMainWindow.panel, ATTR_WIDTH, 1197);
SetPanelAttribute (gMainWindow.panel, ATTR_HEIGHT, 859);

 

// Realign the other controls based on previous size

errChk( ArrangeControls(FALSE));

------------------------------------------------------------

 

Thanks.

 

Peggy

 

 

 

0 Kudos
Message 1 of 5
(3,704 Views)

1) See the help for ApplicationMgr.ConfigFile.

 

Note, if you select Instrument>>Edit...,   Select NI TestStand 20xx Utility Functions, and click Attach and Edit Source, it will open and compile the source code for functions like TS_LayoutPersister_LoadSizes and you will be able to step into the source code in CVI.

 

2) Your initial guess is the same as mine. Did it work?

0 Kudos
Message 2 of 5
(3,677 Views)

 

It seems working but I would get some flash if the window was existed when maximum.

 

I am searching for the file that contains the Panel layout.  I used the function 'TSUI_ApplicationMgrGetConfigFilePath' to retreive the configuration path.  But, what is really puzzling me is that the path is returning "%TestStandLocalAppData%\UserInterface.xml".  From Window's System Properties > Environment Variables, I only see "%TestStandAppData%".  I also did a search on the "UserInterface.xml" file on my c drive, I couldn't find anything.

 

Is that the correct way to define the configuration file?

 

How do I find where those Layout information is saved?

 

Thanks.

 

Peggy

0 Kudos
Message 3 of 5
(3,641 Views)

Hi PeggyC,

 

If you're looking to modify the user interface for your program, your best choice is to look into the "TestStand Public" >> "UserInterfaces" directory and modify your panels from there.  A lot of the functionality is already there and is accessible through these front-panels.  Perhaps a custom configuration file would be the best for your application:

http://zone.ni.com/reference/en-XX/help/370052K-01/tsdeploysystem/infotopics/configurationfiles/  

 

The UserInterface.xml document you mentioned exists and can be found at C:\Users\<User Name>\AppData\Local\National Instruments\TestStand <Version>, but it's just a raw XML file that I wouldn't recommend modifying.  

Matt | NI Systems Engineering
0 Kudos
Message 4 of 5
(3,615 Views)

That help link mentions that is it ok to add custom data to that file:

 

"UserInterface.xml—Configuration options for the user interfaces, such as window and panel sizes, font settings, and sequences to load. You can customize the data stored in this file."

 

 

You can do that by adding data under new sub-properties using PropertyObject methods, much like TS_LayoutPersister_SaveSizesOrBounds() does.

 

You can find out what %TestStandLocalAppData% resolves to on a particular machine with: Engine.GetTestStandPath(TestStandPath_LocalAppData)

0 Kudos
Message 5 of 5
(3,609 Views)