Loading
Values not getting populated
Hi Folks,

 

I have wriiten a InstallScript Function which is been called from the doAction of Next Button. When the Next Button is clicked it Opens the new screen which has a combo box and it needs to be populated from the text file(Test.txt).

 

EnviComboBox 1234

 

I have set the combo box property value in Property Manger option.

 

But still i am not able to see any values in the combo box.

 

But the list is populated as i have MesageBox to check and validate.

 

Please let me know where i have went wrong

 

 

function MyFunction(hMSI)

 

// To Do: Declare local variables.

 

define EnviComboBox 1234

 

LIST lServerList,oNodeList1 ;

 

number a,b,nResult,nCounter;

 

string svListString,szTmp;

 

HWND hDB, hView, hRecord;

 

BOOL bDone;

 

OBJECT oDoc, oNode, oNodeList;

 

NUMBER i, nSize,nCheck,nReturn,nControl;

 

STRING Item,root,svDrive;

 

STRING strNamedItem;

 

STRING strValue,strFileName;

 

LIST listID;

 

begin

 

///////////////////////////////////////////////////////////////////////////

 

//MessageBox("XML file exists",0);

 

strFileName = "C:\\InstallShield 2009 Projects\\CBW\\PROJECT_ASSISTANT\\SINGLE_EXE_IMAGE\\DiskImages\\DISK1\\program files\\Infosys\\CBW\\Release 6.52.112\\Deploy\\Test.txt";

 

if Is(FILE_EXISTS, strFileName) = TRUE then

 

MessageBox("File exists",0);

 

else

 

MessageBox("File is missing",0);

 

endif;

 

listID = ListCreate(STRINGLIST);

 

if (ListReadFromFile(listID, strFileName) < 0) then // read list from file

 

MessageBox("ListReadFromFile failed.", 0);

 

return 0;

 

endif;

 

MessageBox("ListReadFromFile Passed", 0);

 

//MessageBox(listID , 0);

 

if (listID = LIST_NULL) then

 

MessageBox ("Unable to create list.", SEVERE);

 

abort;

 

endif;

 

nSize = ListCount (listID);

 

for i = 0 to (nSize-1)

 

ListSetIndex (listID, i);

 

ListCurrentString (listID, szTmp);

 

MessageBox (szTmp, INFORMATION);

 

nCheck = ListSetIndex (listID, LISTNEXT);

 

endfor;

 

nReturn = EzDefineDialog("EnvironmentList", ISUSER, "EnvironmentList", 0);

 

//CtrlSetList("EnvironmentList", EnviComboBox, listID);

 

nControl = WaitOnDialog("EnvironmentList");

 

MessageBox ("Check is before Control",0);

 

MessageBox("Value of ncontrol is : ",nControl);

 

switch (nControl)

 

case DLG_INIT:

 

MessageBox ("Check is After Control",0);

 

// associate the list with the combo box

 

CtrlSetList("EnvironmentList", EnviComboBox, listID);

 

MessageBox("Value of ncontrol12121 is : ",nControl);

 

// get the first drive letter from the list...

 

ListGetFirstString(listID, svDrive);

 

// ...and make it the current selection

 

CtrlSetCurSel("EnvironmentList", EnviComboBox, svDrive);

 

end;

  • Community Manager (Flexera Software)

    As a rule, mixing MSI dialog boxes and InstallScript dialog boxes in the same project is a bad idea; if you stick with an MSI dialog box, perhaps see the "Windows Installer API Functions Example" help topic for information about populating a list-box control at run time.
  • Hi Robert,

     

    Thanks for your help i tried using API functions , it worked out fine.

     

    Folks here is code for reading from a text file and updating it in the Combo box dynamically during runtime.

     

    function MyFunction(hMSI)

     

    // To Do: Declare local variables.

     

    define EnviComboBox 1234

     

    STRING strFileName;

     

    LIST listID;

     

    NUMBER nSize;

     

    STRING szTmp;

     

    STRING svDrive;

     

    NUMBER nCheck;

     

    NUMBER nCounter;

     

    NUMBER nResult;

     

    NUMBER i;

     

    HWND hDB, hView, hRecord;

     

     

    begin

     

    strFileName = "C:\\InstallShield 2009 Projects\\CBW\\PROJECT_ASSISTANT\\SINGLE_EXE_IMAGE\\DiskImages\\DISK1\\program files\\Infosys\\CBW\\Release 6.52.112\\Deploy\\Balaji.txt";

     

    if Is(FILE_EXISTS, strFileName) = TRUE then

     

    MessageBox("File exists",0);

     

    else

     

    MessageBox("File is missing",0);

     

    endif;

     

    listID = ListCreate(STRINGLIST);

     

    if (ListReadFromFile(listID, strFileName) < 0) then // read list from file

     

    MessageBox("ListReadFromFile failed.", 0);

     

    return 0;

     

    endif;

     

     

    if (listID = LIST_NULL) then

     

    MessageBox ("Unable to create list.", SEVERE);

     

    abort;

     

    endif;

     

    nSize = ListCount (listID);

     

    for i = 0 to (nSize-1)

     

    ListSetIndex (listID, i);

     

    ListCurrentString (listID, szTmp);

     

    MessageBox (szTmp, INFORMATION);

     

    nCheck = ListSetIndex (listID, LISTNEXT);

     

    endfor;

     

    nCounter=1;

     

    hDB = MsiGetActiveDatabase(hMSI);

     

    MsiDatabaseOpenView(hDB,"SELECT * FROM ComboBox", hView);

     

     

    nResult = ListGetFirstString (listID, svDrive);

     

    while (nResult != END_OF_LIST)

     

    MessageBox ("Inside While",0);

     

    hRecord = MsiCreateRecord(4);

     

    NumToStr(szTmp,nCounter);

     

    MsiRecordSetString(hRecord, 1, "EnviComboBox");// Column 1 PROPERTY

     

    MsiRecordSetInteger(hRecord, 2, nCounter); // Column2: Display order of the item

     

    MsiRecordSetString(hRecord, 3, svDrive); // Column3: Value to set property to

     

    MsiRecordSetString(hRecord, 4, svDrive); // Column4: Display text for item

     

    MsiViewModify(hView, MSIMODIFY_INSERT_TEMPORARY, hRecord);

     

    nCounter=nCounter+1;

     

    nResult = ListGetNextString (listID, svDrive);

     

    endwhile;

     

    ListDestroy (listID);

     

    MsiViewClose(hView);

     

    MsiCloseHandle(hView);

     

    MsiCloseHandle(hDB);

     

    end;
    Expand Post
  • Community Manager (Flexera Software)

    One last comment is that you'll want to use a public property (ENVICOMBOBOX and not EnviComboBox) if you want to use the value the user selected in the UI sequence somewhere in the Execute sequence.
  • Hi Robert,

     

    For making ENVICOMBOBOX as a Public Property. I have added the entry in the Property Manager and set the value as 12345.

     

    And used the same in the code as

     

    define ENVICOMBOBOX 12345

     

    Is that right?
    Expand Post

Loading
Values not getting populated