Reputation: 465
I have a [PREREQUISITES_MISSING] property set in a custom action (C#). Its value is a string containing a list of prerequisites that were deemed to be missing through various Powershell/Registry checks.
I display a dialog before the default 'Welcome' dialog in the UISequence, on the condition that at least one prerequisite is missing.
My issue:
The list of pre-requisites may be long or short. If it is long, it gets cut off. If I set the dialog size to be very large, it may be mostly blank space in many cases. Is it possible to do either of the following:
<Dialog Id="PrereqsMissingDlg" Width="260" Height="85" Title="!(loc.InstallDirDlg_Title)" NoMinimize="yes">
<!--Other controls removed for brevity-->
<Control Id="PrereqsMissingTxt" Type="Text" X="48" Y="15" Width="200" Height="30" TabSkip="no" Text="[PREREQUISITES_MISSING]" />
</Dialog>
Upvotes: 0
Views: 740
Reputation: 465
Following up on Christopher's answer, here is the code required to answer my question:
Custom Action (C#)
[CustomAction]
public static ActionResult VerifyPrerequisites(Session Session)
{
//(prereq checking code removed for brevity)
//Retrieve and remove the dialog record
Database db = Session.Database;
View view = db.OpenView("SELECT * FROM Control WHERE Dialog_='PrereqsMissingDlg' AND Control='PrereqsMissingText'");
view.Execute();
Record record = view.Fetch();
view.Delete(record);
//Convert the error messages to RTF
System.Windows.Forms.RichTextBox rtb = new System.Windows.Forms.RichTextBox();
rtb.Text = errorMsg;
//Update the record with the missing prereqs text
record.SetString("Text", rtb.Rtf);
//Insert the new record
string sqlInsertSring = db.Tables["Control"].SqlInsertString + " TEMPORARY";
view = db.OpenView(sqlInsertSring);
view.Execute(record);
view.Close();
return ActionResult.Success;
}
Revised Dialog
<Dialog Id="PrereqsMissingDlg" Width="260" Height="85" Title="!(loc.InstallDirDlg_Title)" NoMinimize="yes">
<!--Other controls removed for brevity-->
<Control Id="PrereqsMissingText" Type="ScrollableText" X="48" Y="15" Width="200" Height="30" Sunken="yes">
<Text></Text>
</Control>
</Dialog
Upvotes: 1
Reputation: 55600
Neither of those two solutions are possible. However a ScrollableText (RTF) should do what your looking for. Note you can't used formatted types such as [PREREREQS_MISSING] but you can use dyamic UI as described on my blog here:
http://blog.iswix.com/2008/07/dynamic-windows-installer-ui.html
Just adapt the SQL to update the database row that contains the stock RTF for the control you define in WiX. You can figure this out by looking at the built MSI using ORCA.
Upvotes: 1