There are several ways to do it apparent, but this is what works for
me...
Set up your control up like this...
<Control Id="CmbSQLServerInstance" Property="SQLSERVERINSTANCE"
Type="ComboBox" Height="15" Width="140" X="14" Y="93" Text="Ppphhh"
ComboList="yes" ToolTip="The instance of SQL Server you would like to
attach to.">
<ComboBox Property="SQLSERVERINSTANCE">
<ListItem Value="MSSQLSERVER"/>
</ComboBox>
</Control>
There must be at least 1 dummy ListItem, otherwise the appropriate table
will not be created.
As you can see mine is MSSQLSERVER. In VBscript here is the abridged
version of what I do...
Dim oView
' open and execute a view to the ComboBox table
Set oView = Session.Database.OpenView("SELECT * FROM `ComboBox`")
oView.Execute
' Delete the dummy record
DeleteItemFromComboBox oView
You can add a "where property =..." if you have more than one Combobox
within your project.
Create a stringlist of sorts, then....
intI = 0
For Each sSQLInstance In sSQLInstances
AddItemToComboBox oView, Session.Property("ComputerName") &
"\" & sSQLInstance, intI
intI = intI + 1
Next
And here are the functions I use...
Function DeleteItemFromComboBox( oComboBox )
Set oListItem = oComboBox.Fetch()
LogSessionInfo "GetSQLServerInstancesAction - Deleting item"
oComboBox.Modify msiViewModifyDelete, oListItem
oComboBox = Nothing
End Function
Function AddItemToComboBox( oComboBox, oItem, iItemNo )
' ComboBox record fields are Property, Order, Value, Text
LogSessionInfo "GetSQLServerInstancesAction - Adding " & oItem &
" to ComboBox."
Set oReccombo = Session.Installer.CreateRecord(4)
oReccombo.StringData(1) = "SQLSERVERINSTANCE"
oReccombo.IntegerData(2) = iItemNo
oReccombo.StringData(3) = oItem
oReccombo.StringData(4) = oItem
oComboBox.Modify msiViewModifyInsertTemporary, oReccombo
End Function
Function LogSessionInfo(msg)
Const MESSAGE_TYPE_INFO = &H04000000
Dim rec
Set rec = Session.Installer.CreateRecord(1)
rec.StringData(0) = msg
LogSessionInfo = Session.Message(MESSAGE_TYPE_INFO, rec)
End Function
There are probably better ways, if so hopefully someone on here will
point out my mistakes.
I hope this helps. I'm hoping to do something similar for ListViews.
Dominique
-----Original Message-----
From: Uma Harano [mailto:[email protected]]
Sent: 12 October 2009 23:59
To: [email protected]
Subject: [WiX-users] How to populate a list box in a msi dialog
duringruntime
Hi,
I need to populate a ListBox control in a MSI dialog at runtime. What is
the best way to do this?
Thanks!
Uma-
AMX
AMX UK
Auster Road
Clifton Moor
York, North Yorkshire
United Kingdom
YO30 4GD
+44 (0) 1904 343100 office
+44 (0) 1904 343101 fax
AMX South
6th Floor Salisbury House
London Wall
London
United Kingdom
EC2M 5QQ
+44 (0) 2076 529450 office
+44 (0) 8701 991661 fax
AMX Belgium
Boerenkrijglaan, 96a
B-2260
Westerlo
Belgium
+ 32 (0) 1454 2763 office
+ 32 (0) 1454 2766 fax
######################################################################
Attention:
This e-mail message is privileged and confidential. If you are not the
intended recipient please delete the message and notify the sender.
Any views or opinions presented are solely those of the author.
This email was scanned and cleared by NetIQ MailMarshal.
######################################################################
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wix-users