So I attempting to get lists to work in power vision 2.8 as i noticed that it looks like you can save lists to survive power cycles and updates so it look like a useful way to keep a record of users that have logged into the screen recently. Anyways I have been attempting to populate the list but so far i am unable to read(or maybe I haven't successfully written to the list) string values, but i can read ints fine. I have attached my code, it is based on sample code, that worked in 2.7 so I'm not sure if I am just missing something or if there are differences between 1.7 to 1.8 which Im not taking into account. If anyone could have a look over this code and let me know if they can see any issues? I run the CreateEntries method first and then run SetupUserLoginPage method after. I have also attached how I have set up the list.
Code: Select all
int Position;
int MaxItems = 4;
string [] itemStrings =
{
"Oil Pressure",
"RPMS",
"Engine Temp",
"Batt Volts",
};
void CreateEntries(){
CustomListData data;
smWrite(VariableIDs.testPhaseFlag, 1);
// Only do this one time.
if (ListManagerGetCount(ListDataType.RecentUsersList) < 1)
{
for (int index = 0; index < MaxItems; index++)
{
data.WriteInt32(CustomListColumn.RecentUsersList_UserIDs, index);
data.WriteString(CustomListColumn.RecentUsersList_UserNames, itemStrings[index]);
if (ListManagerAddItem(ListDataType.RecentUsersList, data) < 0)
{
// This should let the user know or developer know...
smWrite(VariableIDs.testPhaseFlag, 3);
break;
}else{
smWrite(VariableIDs.testPhaseFlag, 2);
}
ListManagerNext(ListDataType.RecentUsersList, false);
}
Position = 0;
ListManagerSetPosition(ListDataType.RecentUsersList, Position);
}
}
void SetupUserLoginPage(){
smWrite(VariableIDs.WhichPassword, USER_LOGIN);
CustomListData userLists;
string userID = 'empty';
int tempInt;
ListManagerSetPosition(ListDataType.RecentUsersList, 0);
ListManagerGetItem(ListDataType.RecentUsersList, 0, userLists);
userLists.ReadString(CustomListColumn.RecentUsersList_UserNames, userID);
Print("Name: " + userID);
cultureSetString(StringIDs.UserOne, userID, true);
setTextWidgetText(ScreenObjectIDs.lblUserNameOne, userID);
tempInt = userLists.ReadInt32(CustomListColumn.RecentUsersList_UserIDs);
userID = tempInt + "";
setTextWidgetText(ScreenObjectIDs.lblUserIDOne, userID);
cultureSetString(StringIDs.UserIDOne, userID, true);
Print("ID: " + userID);
ListManagerGetItem(ListDataType.RecentUsersList, 1, userLists);
userLists.ReadString(CustomListColumn.RecentUsersList_UserNames, userID);
setTextWidgetText(ScreenObjectIDs.lblUserNameTwo, userID);
Print("Name2: " + userID);
tempInt = userLists.ReadInt32(CustomListColumn.RecentUsersList_UserIDs);
userID = tempInt + "";
setTextWidgetText(ScreenObjectIDs.lblUserIDTwo, userID);
Print("ID2: " + userID);
ListManagerGetItem(ListDataType.RecentUsersList, 2, userLists);
userLists.ReadString(CustomListColumn.RecentUsersList_UserNames, userID);
setTextWidgetText(ScreenObjectIDs.lblUserNameThree, userID);
Print("Name3: " + userID);
tempInt = userLists.ReadInt32(CustomListColumn.RecentUsersList_UserIDs);
userID = tempInt + "";
setTextWidgetText(ScreenObjectIDs.lblUserIDThree, userID);
Print("ID3: " + userID);
processScreenApi();
}
PowerVision: 2.8.10365
Screen: PV450
OS: 2.8.10014
App: 2.8.10441
Loader: 2.3.20006
Windows: 7 Professional SP1.