LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

RecallPanelState Error

What the below code do is take the values of some controls from a panel then put them in a table in another panel. I save the panel state using SavePanelState(). After SavePanelState is performed, the save state file is generated for the first time. When the below code run again, I received error at RecallPanelState() stating the "control cannot be loaded as panel has changed". However, i never do any changes on the panel after SavePanelState(). I would like to know where are my mistakes?
SITEDBPL = LoadPanel(0,"main.uir",SITEDB);

     if(FileExists("d:\\Project\\GI Netcom\\NOSMOC\\SiteDB.db",0)==1)
      RecallPanelState(SITEDBPL,"d:\\Project\\GI Netcom\\NOSMOC\\SiteDB.db",0);
     
     GetCtrlVal(SITEDBPL,SITEDB_ROW,&row);
     StrSiteName = malloc (row*sizeof(char*));
         
     GetCtrlVal(SITECONFIGPL,SITECONFIG_MODE,StrConfig);
     strcpy (StrTbl[1], StrConfig);
     
     GetCtrlVal(SITECONFIGPL,SITECONFIG_POLL,StrConfig);
     strcpy (StrTbl[2], StrConfig);
     InsertIntoList(SITECONFIGPL,SITECONFIG_POLLLIST,StrConfig);
     
     GetCtrlVal(SITECONFIGPL,SITECONFIG_FILE,StrConfig);
     strcpy (StrTbl[3], StrConfig);
     InsertIntoList(SITECONFIGPL,SITECONFIG_FILELIST,StrConfig);
     
     GetCtrlVal(SITECONFIGPL,SITECONFIG_SIM,StrConfig);
     strcpy (StrTbl[4], StrConfig);
     InsertIntoList(SITECONFIGPL,SITECONFIG_SIMLIST,StrConfig);
     
     InsertTableRows (SITEDBPL, SITEDB_SITEDBTBL, y, 1, VAL_USE_MASTER_CELL_TYPE);
     SetTableCellRangeVals (SITEDBPL, SITEDB_SITEDBTBL, MakeRect(y,1,1,5), StrTbl, VAL_ROW_MAJOR);
     
     GetCtrlVal(SITECONFIGPL,SITECONFIG_DFFOLDER,StrConfig);
     strcpy (StrF, StrConfig);
     SetTableCellVal (SITEDBPL, SITEDB_SITEDBTBL, MakePoint(6,y), StrF);
     
     GetCtrlVal(SITECONFIGPL,SITECONFIG_EXECUTEDT,StrConfig);
     strcpy (StrF, StrConfig);
     SetTableCellVal (SITEDBPL, SITEDB_SITEDBTBL, MakePoint(7,y), StrF); 
     
     SavePanelState(SITEDBPL,"d:\\Project\\GI Netcom\\NOSMOC\\SiteDB.db",0);
     DiscardPanel(SITEDBPL);
   
Thank you
0 Kudos
Message 1 of 5
(3,862 Views)

At the time your panel is saved, one of the controls has been modified by your line:

     InsertTableRows (SITEDBPL, SITEDB_SITEDBTBL, y, 1, VAL_USE_MASTER_CELL_TYPE);

so the panel being recalled is technically different to the one just loaded by LoadPanel(), hence the error.

JR

0 Kudos
Message 2 of 5
(3,856 Views)
Do you  have any suggestion on how to recall the panel with the inserted row? Probably the SavePanelState and RecallPanelState sequence?
 
 
0 Kudos
Message 3 of 5
(3,854 Views)
It depends on the intention behind your application. I suspect that you planned to use it to indefinitely add lines to your table in order to maintain some form of database, so I think you should use an alternative scheme. In the past I had a similar problem with Save/Recall, that I partially solved by putting the troublesome control on a small child panel located within the main panel - to the operator all the controls appeared to belong to a single panel, but to the system the offending control was on a different panel and was therefore excluded from the Save/Recall process, which of course works on one panel at a time. Maybe the ArrayToFile() familiy of functions would be more suitable in your case?
 
JR
0 Kudos
Message 4 of 5
(3,851 Views)
Yes, I wanted to form a database. Thanks for the advice.
0 Kudos
Message 5 of 5
(3,849 Views)