LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Table Control

Solved!
Go to solution

Hello,

I have task to make program to set up machine parameters. It will be around 256 parameters. Parameters are numeric and beside each must be textual name. Parameters need to be saved to the file and loaded from there but must be displayed for user

and changeable on screen by user.

What is best way to do it in CVI?  It drop on my mind Table control but could be something else?

Any suggestion and example code is greatly appriciated!

0 Kudos
Message 1 of 6
(3,322 Views)

Hello,

 

CVI comes with the example colview that demonstrates some features of tables you might find useful.

 

For reading and saving the parameters to/from disk I would recommend having a look at the inifile instrument driver, which can be found in the directory toolslib\toolbox.

0 Kudos
Message 2 of 6
(3,319 Views)

Thanks Wolfgang,

Do you know of top of your head which function panel from "inifile instrument driver" would be the most suitable to read data file from disk into Table and write to the file from Table?

0 Kudos
Message 3 of 6
(3,308 Views)
Solution
Accepted by topic author Miki2006

Hi Miki,

 

the exact INI function depends on your data type - you might want to look at Ini_PutString (, "", "", ""); Ini_PutDouble (, "", "", ); Ini_GetDouble (, "", "", ); etc.

You will use these functions in a loop, one for each of your table cells.

 

At the beginning and at the end of your loop you will need to open/create and close the inifile, look at Ini_New (1), Ini_Dispose (); Ini_ReadFromFile (, ""); Ini_WriteToFile (, "");

 

This approach reads and writes individual values from/to file.

 

There is another possibility, using SavePanelState (, "", 0); which saves the current values of all controls on your panel, including your table, but also including other controls - hence RecallPanelState (, "", 0); will not only populate your table, but other controls too (which might not be intended).

 



 

Message 4 of 6
(3,301 Views)

I tried to save the Tab Panels using SavePanelState and restore using RecallPanelState, it worked but the table (in one of theTab-Panels) was not getting populated, meanwhile i found in forums discussions that Tables are not treated well  by this API

 

https://forums.ni.com/t5/LabWindows-CVI/RecallPanelState-Error/m-p/731234/highlight/true#M36412

 

i'm still looking at some solution as to how to save Panels containing Tables

(these tables are populated runtime using InsertTableRows)

 

 

 

 

0 Kudos
Message 5 of 6
(3,083 Views)

To add a bit more

 

One of teh Tabs has a Table and other tab has some simple fields (numerics)

If i save (SavePanelState) into a file (during which there was NO table-row-entries) and close application, restart and this time load (RecallpanelState)

using previous file, It populates the Tab containing Numerics and table is empty on other tab....works fine

 

If i fill table with few rows this time, save into different file, -Close app - relanuch App - and load the file, the app crashes

Stating "control cannot be loaded as panel has changed"  -ErrorCode -79

 

this is what is discussed in the link refered in my previous post

 

This topic might have been discussed already, So

If anyone has any idea please, drop a quick few hints or point me to the right link of discussion.

 

Thanks in advance

 

 

 

0 Kudos
Message 6 of 6
(3,076 Views)