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

Custom Dialog Listbox


4 replies to this topic

Gadlakha

Gadlakha
  • Members
  • 18 posts

Posted 09 March 2005 - 08:00

Hi.
I have a custom dialog with three controls on it. An EditBox, a ADD button and a ListBox. What I want is to add the text present in the EditBox to the ListBox on the ADD button event. But the problem is that I don't know how to add text to the list box.
I tried searching on the net but all I could find was the reference to the page http://www.installshield.com/news/newsletter/0302-articles/msiaccess.asp which uses VBScript to do the same taske.
If I make use of the VBScript I should make sure that the Script engine exists on the target machine, which I want to avoid.
Is there any other way of doing this????
With thanks & regards.
Gautam Adlakha.

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 09 March 2005 - 15:26

Help topic "How Do I Populate a List Box at Run Time?" describes how to use ListAddString and CtrlSetList.

jrcoldinmn

jrcoldinmn
  • Members
  • 16 posts

Posted 09 March 2005 - 16:15

I used this construct:

Dlg_SdStartCopy:
szTitle = "";
szMsg = "";
listStartCopy = ListCreate( STRINGLIST );
// If an error occurred, report it; then terminate.
if (listStartCopy = LIST_NULL) then
MessageBox ("Unable to create list.", SEVERE);
abort;
endif;
//The following is an example of how to add a string(svName) to a list(listStartCopy).
ListAddString(listStartCopy,"Installed by:",AFTER);
ListAddString(listStartCopy," " + svName,AFTER);
ListAddString(listStartCopy,"Destination Path:",AFTER);
ListAddString(listStartCopy," " + INSTALLDIR,AFTER);
ListAddString(listStartCopy,"Features To Be Installed:",AFTER);
ListAddString(listStartCopy," ",AFTER);
FeatureListItems(MEDIA,"",listStartCopy);
nResult = SdStartCopy( szTitle, szMsg, listStartCopy );
ListDestroy(listStartCopy);



Good luck,
JR

Gadlakha

Gadlakha
  • Members
  • 18 posts

Posted 10 March 2005 - 04:34

I could not find the Help topic "How Do I Populate a List Box at Run Time?"
Could you please give the link to the topic.

In the example posted by jrcoldinmn, I have a doubt.
I have a list box control that I had defined as:
#define SD_LISTBOX_LICENSEKEY 1205
Now how do I associate this list listStartCopy created in the example with SD_LISTBOX_LICENSEKEY.



Gadlakha

Gadlakha
  • Members
  • 18 posts

Posted 10 March 2005 - 04:47

I found a solution.
We can create the list using ListCreate.
Then populate it with the ListAddString and finally link it with the listbox control using the function:
CtrlSetList (szDialogName, nControlID, listID);

Edited by Gadlakha, 10 March 2005 - 04:48.