[wix-users] Modify ScrollableText

Lucian Tirca lucian.tirca at highstage.dk
Fri Oct 9 04:53:33 PDT 2015


Hello guys ! I'm trying to modify the text inside a custom dialog which is a
ScrollableText. After researching, I found out it is not possible unless I
modify the internal table inside the MSI file and set the entry to a RTF
format.  However, no matter what I try, it still does not display anything.
I'm getting the following exception :
"Microsoft.Deployment.WindowsInstaller.BadQuerySyntaxException: SQL query
syntax invalid or unsupported"

 

Here's my custom actions: 

 

[CustomAction]

        public static ActionResult CheckSqlConnection(Session session)

        {

            session.Log("Checking whether the supplied SQL Credentials are
correct");

            var sqlService = new ServerDetector();

            var sqlConnectionStringBuilder = new SqlConnectionStringBuilder

            {

                UserID = session["HS.INSTALLER.SQL.DBUSER.NAME"],

                Password = session["HS.INSTALLER.SQL.DBUSER.PASSWORD"],

                InitialCatalog = "master",

                DataSource = session["HS.INSTALLER.SQL.SERVER"] + @"\" +
session["HS.INSTALLER.SQL.INSTANCE"],

                IntegratedSecurity =
Convert.ToBoolean(session["HS.LOCAL.SQL.AUTH.ISWINDOWS"])

            };

            session["SqlConnectionString"] =
sqlConnectionStringBuilder.ConnectionString;

            var isValid =
sqlService.IsConnectionValid(sqlConnectionStringBuilder);

            if (!isValid)

            {

                session["ConnectionString_IsValid"] = "false";

                session["CustomMessageText"] = "Invalid SQL Credentials.
Re-enter the correct credentials";

                session["CustomMessageDetailsText"] =
RtfConverter.PlainTextToRtf(sqlService.InvalidConnectionException.Message,
"Arial");

                return ActionResult.Failure;

            }

            session["ConnectionString_IsValid"] = "true";

            session["CustomMessageText"] = "Successfully connected to the DB
with the credentials provided";

            return ActionResult.Success;

        }

 

[CustomAction]

        public static ActionResult SetCustomDialogDetailsText(Session
session)

        {

            try

            {

                string query = "UPDATE `Control` SET `Control`.`Text`= \"" +
session["CustomMessageDetailsText"] +

                               "\" WHERE `Control`.`Dialog_`=
'CustomMessageDlg' AND `Control`.`Control`='Details'";

                session.Database.Execute(query);

                return ActionResult.Success;

            }

            catch (Exception e)

            {

                session["CustomMessageTextException"] = e.ToString();

                return ActionResult.Failure;

            }

        }

 

 

The control that spawns it

        <!--The test sql connection button -->

        <Control Id="TestConnectionButton" Type="PushButton" Text="Test
Connection" 

                 Height="17" Width="100" X="20" Y="213">

          <Publish Event="DoAction" Value="ReSet_CustomErrorText" Order="1">

            1

          </Publish>

          <Publish Event="DoAction" Value="CA_Validate_SqlConnection"
Order="2">

            1

          </Publish>

          <Publish Event="DoAction" Value="CA_SetCustomDetailsText"
Order="3">

            1

          </Publish>

          

          <Publish Event="SpawnDialog" Value="CustomMessageDlg" Order="4">

            1

          </Publish>

          

        </Control>

 

And the CustomMessageDialog

 

      <Dialog Id="CustomMessageDlg"

              Width="300" Height="200"

              Title="Message from the system">

        <Control Id="Description" Type="Text"

                 X="30" Y="20" Width="240" Height="30"

                 Text="[CustomMessageText]" />

        <Control Id="IsDetailsVisibleCheckbox" Type="CheckBox"
Property="IsDetailsVisible" CheckBoxValue="yes"

                 Text="Show Details"

                 X="70" Y="51" Height="14" Width="150" >

          <Condition Action="show">

            <![CDATA[CustomMessageDetailsText]]>

          </Condition>

          <Condition Action="hide">

            <![CDATA[NOT CustomMessageDetailsText]]>

          </Condition>

        </Control>

        <Control Id="Details" Type="ScrollableText" Sunken="yes"

                 X="20" Y="70" Width="260" Height="100"

                 Text="[CustomMessageDetailsText]" >

          <Condition Action="show">

            <![CDATA[IsDetailsVisible = "yes"]]>

          </Condition>

          <Condition Action="hide">

            <![CDATA[IsDetailsVisible <> "yes"]]>

          </Condition>

        </Control>

        <Control Id="Close" Type="PushButton" Default="yes" Cancel="yes"

                 X="120" Y="180" Width="60" Height="17"

                 Text="Close">

          <Publish Event="DoAction" Value="ReSet_CustomErrorDetailsText"
Order="1">

            1

          </Publish>

          <Publish Event="EndDialog" Value="Return" Order="2">

            1

          </Publish>

        </Control>

      </Dialog>

 

 

The log file looks like this:

 

Action ended 4:35:46: CA_Validate_SqlConnection. Return value 1.

MSI (c) (84:18) [04:35:46:132]: Doing action: CA_SetCustomDetailsText

Action 4:35:46: CA_SetCustomDetailsText. 

Action start 4:35:46: CA_SetCustomDetailsText.

MSI (c) (84:34) [04:35:46:132]: Invoking remote custom action. DLL:
C:\Users\ADMINI~1\AppData\Local\Temp\2\MSI1D05.tmp, Entrypoint:
SetCustomDialogDetailsText

MSI (c) (84!C0) [04:35:46:194]: Note: 1: 2227 2:  3: Text 4: UPDATE
`Control` SET `Control`.`Text`=
"{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1033{\fonttbl{\f0\fnil
Consolas;}{\f1\fnil\fcharset0 Arial;}}

{\colortbl ;\red0\green0\blue0;\red255\green255\blue255;}

{\*\generator Riched20 10.0.10240}\viewkind4\uc1 

\pard\sa200\sl276\slmult1\cf1\highlight2\f0\fs19\lang9 Login failed for user
''. }" WHERE `Control`.`Dialog_`= 'CustomMessageDlg' AND
`Control`.`Control`='Details' 

MSI (c) (84!C0) [04:35:46:194]: PROPERTY CHANGE: Adding
CustomMessageTextException property. Its value is
'Microsoft.Deployment.WindowsInstaller.BadQuerySyntaxException: SQL query
syntax invalid or unsupported.

   at Microsoft.Deployment.WindowsInstaller.Database.OpenView(String
sqlFormat, Object[] args)

   at Microsoft.Deployment.WindowsInstaller.Database.Execute(String sql,
Record record)

   at Microsoft.Deployment.WindowsInstaller.Database.Execute(String
sqlFormat, Object[] args)

   at
Highstage.Setup.CustomActions.CustomActions.SetCustomDialogDetailsText(Sessi
on session)'.

Action ended 4:35:46: CA_SetCustomDetailsText. Return value 1.

Action 4:35:46: CustomMessageDlg. Dialog created

MSI (c) (84:18) [04:35:47:060]: PROPERTY CHANGE: Adding IsDetailsVisible
property. Its value is 'yes'.

 

 

What am I doing wrong?

 

Any help is much appreciated!



More information about the wix-users mailing list