PDA

View Full Version : Suite UI: dynamic text based



DLee65
11-20-2013, 12:03 PM
Is there a way to change text dynamically on a wizard page based on the operating system?
For instance if the operating system is XP, I want string table {IDS_STRING_XPSP3}, if OS = Vista SP1 then {IDS_STRING_VISTASP1}, etc.

On my wizard page I have a single text control. It is in this text control that I want to change the value dynamically. The text is set to a string value [MyCustomText].
I would like this value to be changed dynamically at runtime.

Thanks.

MichaelU
11-20-2013, 12:21 PM
Absolutely. The best approach as of IS2013 is to use the Events view to define one or more Set Property actions. From there, there are two approaches:

One way is fairly direct: create a property OS_MESSAGE with one value (say IDS_STRING_XPSP3) as default, and set OS_MESSAGE to the other (IDS_STRING_VISTA) in the action. Schedule the action early, such as in OnBegin, and specify a condition such as Platform. Use with OS Version values such as 6.0- (to detect Vista or later; leave off the - for detecting Vista exactly). Then use this property in the UI as the text for your label.

Alternately, set a property with actions that reflects the OS version (the mechansim is the same as above, but instead of specifying the string ID, do something that's not translated, such as 0 and 1, or XP and VISTA, or whatever). Create multiple labels (or other controls) in the UI with mutually exclusive visibility conditions that depend on the value of this property.

DLee65
12-02-2013, 12:21 PM
Michael, thank you for your comments.

I have this working, partially, but not quite. I am doing something wrong. I am showing a string value in my property value.

Here is what I have and perhaps I am asking too much out of this with string substitution in a property.
In the string editor I have the following:

IDS_SQLSERVER_VER = Microsoft SQL Server 2012 Express SP1
I have another string table entry
IDS_SUPPORTED_SQL = [SupportedSqlText]

In the property table I have the following default value:
SupportedSqlText = Your AMAZINGCHARTS database instance will be upgraded to [IDS_SQLSERVER_VER] | Formatted Flag = True

So in my wizard label I have the text set to [SupportedSqlText].
However, the text is not updated correctly. What is displayed is 'Your AMAZINGCHARTS database instance will be upgraded to {IDS_SQLSERVER_VER}'
Note that it gives the name of the string table entry and not the value. I am not sure why.

Again, I am sure that I am doing something wrong, and it is probably very simple. :D

MichaelU
12-03-2013, 01:51 PM
Hmm. I may have been oversimplifying in my previous response. One of the subtleties of the suite's string and property references is the order and mechanisms by which they can be resolved. Strings can contain property references; properties cannot contain further string or property references. However SetProperty actions in the wizard can reference strings as the value for the property, letting you get back to the root of the game. I forget whether SetProperty actions in the events view can do this.

You can see this in action on the InstallationWelcome page: the next button's Click event sets the properties ISProgressCaption and ISProgressSummary to IDS_PROGRESS_CAPTION_INSTALLING and IDS_PROGRESS_TITLE_INSTALLING respectively. In turn, IDS_PROGRESS_CAPTION_INSTALLING references the ProductName property (this is resolved as part of the SetProperty action), and the first two properties are used on the InstallationProgress page in different labels.

DLee65
12-03-2013, 02:13 PM
Ok, I think I understand the problem. I can insert a base text as the base property.
I can then modify the property later based on some condition using SetProperty, within this state, I could insert a String value.

My goal ultimately is to alert users if they already have an instance of the database installed on a Full version of SQL Server. If they do then they do not need to upgrade to SQL Server 2012 Express. The message should reflect this state.
If the version is 2005 Express instance then the instance needs to be removed, and SQL Server 2012 Express installed. The message needs to reflect this state.
If SQL Server 2012 Express instance is already installed then nothing needs to happen, the message needs to reflect this state.
If the operating system does not support SQL Server 2012 Express, then the message needs to reflect this state, and the radio button cannot be selected.

Yes, it is a complex matrix of conditions and messages, but I think it can be done.

The wizard page does display in major upgrade scenarios, so the user can choose the option, though unlikely, to convert the target machine from a main SQL Server machine to a client machine and setup the main SQL Server machine on another target machine. Client services has told me that some practices have taken advantage of this option.

Thanks for the information.