Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Filling a ListBox


5 replies to this topic

burked144

burked144
  • Members
  • 4 posts

Posted 04 April 2001 - 13:28

I'm trying to fill a ListBox dynamically at runtime.  I've followed the ComboBox example from IS KB, substituting SELECT * FROM ComboBox with SELECT * FROM ListBox.  Inserting records into the ListBox table does not appear to be working.  I always get an empty ListBox.  

1 When should I be calling the "FillTheListBox" CA?
2 The call to MsiViewModify( hView, MSIMODIFY_INSERT_TEMPORARY, hRec ); is returning error #1627... What does this mean is happening?
3 What can I do to debug this?

Any ideas would be appreciated.

thanks,


Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 04 April 2001 - 15:28

You must add the table rows for the listbox entries before the dialog with the list box is displayed.

Irina

Irina
  • Members
  • 227 posts

Posted 05 April 2001 - 22:40

Hello,
I had the same problem.
You can try to do so.

1. Write function on install script like this:

NUMBER hDatabase, hView, hRec;
STRING sQuery;

//open msi database
hDatabase = MsiGetActiveDatabase(hMSI);

//query ListBox to add items in it
sQuery = "SELECT * FROM ListBox WHERE Property='[YOURSPROPERTY]''";

MsiDatabaseOpenView(hDatabase, sQuery, hView);

//create one record
hRec=MsiCreateRecord(4);    

// add new item to ListBox
MsiRecordSetString(hRec, 1, "[YOURSPROPERTY]");
MsiRecordSetInteger(hRec, 2, [Number);    
MsiRecordSetString(hRec, 3, [YouItem]);
MsiRecordSetString(hRec, 4, [YouItem]);

// to save view
MsiViewModify(hView, MSIMODIFY_INSERT_TEMPORARY, hRec);
           
//close view
MsiViewClose(hView);

+++++++++++++++++
where [YOURSPROPERTY]  is Value ofProperty of you ListBox (see you dialog and Property of control),
[Number] is record number such as 1, 2,....
[YouItem] is item in you list.

This code add only one record to ListBox. You can do loop to add anymore.

2. Create dialog with ListBox and set its Property as  YOURSPROPERTY, items are empty.

3. Create Custom Action to call this function (type Run InstallScript code).

4. Insert this Custom Action before your dialog in UI sequence,

It should be work.

Good luck,




burked144

burked144
  • Members
  • 4 posts

Posted 13 April 2001 - 12:30

thanks for your feedback.
I'll give it a try.

abc

abc
  • Members
  • 9 posts

Posted 06 June 2001 - 19:47


(Edited by abc at 6:25 pm on Aug. 20, 2001)