azmanar
12-29-2005, 12:05 PM
Hi,
I need to automatically SELECT a ComboBox to the same data that was retrieved from SQLite in a compiled AM6 Project. After scores of tries it wont work and I am lost.
Scenario.
Step 1: After opening an interface, a ComboBox is populated with 3 choices.
Step 2: After selecting 1 choice, I click submit to save it to SQLite.
Step 3: When I retrieve the interface again, the ComboBox has already selected my previous choice.
Step 4. I can reselect another choice from the same ComboBox and save again.
Here is the code:
-- Clear the combobox object
ComboBox.ResetContent("CB_MemberStatus");
--Populate Contents of Membership Status Box
--Table of items to be added to the combobox object (text and data)
tCB_Member_Status = {}
tCB_Member_Status[1] = {sText = "NOT SET", sData = "Not Set Yet"};
tCB_Member_Status[2] = {sText = "RENEWED", sData = "Renewed"};
tCB_Member_Status[3] = {sText = "NOT RENEWED", sData = "Not Renewed Yet"};
-- Step through each item in the table
for nIndex, tItemInfo in tCB_Member_Status do
ComboBox.AddItem("CB_MemberStatus", tItemInfo.sText, tItemInfo.sData);
if tItemInfo.sData == sMemberStatus then
ComboBox.SetSelected("CB_MemberStatus", nIndex);
end
sMemberStatus is basically a variable containing a data retrieved from SQLite statement, which was earlier saved. I am pretty sure that the data retrieved is similar to the combobox data.
Can anyone help?
Thanks
I need to automatically SELECT a ComboBox to the same data that was retrieved from SQLite in a compiled AM6 Project. After scores of tries it wont work and I am lost.
Scenario.
Step 1: After opening an interface, a ComboBox is populated with 3 choices.
Step 2: After selecting 1 choice, I click submit to save it to SQLite.
Step 3: When I retrieve the interface again, the ComboBox has already selected my previous choice.
Step 4. I can reselect another choice from the same ComboBox and save again.
Here is the code:
-- Clear the combobox object
ComboBox.ResetContent("CB_MemberStatus");
--Populate Contents of Membership Status Box
--Table of items to be added to the combobox object (text and data)
tCB_Member_Status = {}
tCB_Member_Status[1] = {sText = "NOT SET", sData = "Not Set Yet"};
tCB_Member_Status[2] = {sText = "RENEWED", sData = "Renewed"};
tCB_Member_Status[3] = {sText = "NOT RENEWED", sData = "Not Renewed Yet"};
-- Step through each item in the table
for nIndex, tItemInfo in tCB_Member_Status do
ComboBox.AddItem("CB_MemberStatus", tItemInfo.sText, tItemInfo.sData);
if tItemInfo.sData == sMemberStatus then
ComboBox.SetSelected("CB_MemberStatus", nIndex);
end
sMemberStatus is basically a variable containing a data retrieved from SQLite statement, which was earlier saved. I am pretty sure that the data retrieved is similar to the combobox data.
Can anyone help?
Thanks