Since the application UI mechanism is very complicated, it is very important to understand what the UI Theme can achieve and cannot achieve before you decide to apply the theme.
Once a theme is applied, the UI settings of window and user object can be set by the theme JSON file.
The theme settings for user object contain a "default-style" property to determine whether "border-color" is effective. When "default-style" is true, "border-color" has no effect.
Dynamically setting the Resizable property at runtime in the script will not take effect.
What can be set by the theme
-
Background color, title bar, border, and system buttons (such as maximize, minimize and restore buttons) of window and user object
-
Menu, toolbar, and status bar of window and user object
-
Scroll bar on the OLE control, user object, and window
-
Font color of the window title
What cannot be set by the theme
-
Windows system dialog (such as Save As dialog, Open dialog) and the PowerBuilder built-in dialog (such as Filter dialog, Sort dialog)
-
Menu which calls a third-party DLL (which may cause the application crash)
-
Floating FrameBar and toolbar
-
Font related properties (except font color)
-
Dockable window (obsolete)
-
Window or message box created via the MessageBox function (workaround)
Once a theme is applied, the UI settings (mainly font color and background color) of controls in the theme file have the highest priority; and the border (whether and what color to display) varies from different controls.
What can be set by the theme
Background color and font color:
-
The background color and the text font color of controls in the theme file have the highest priority.
-
The background of the following control is set to transparent by default in the theme file: GroupBox, StaticText, and StaticHyperLink. If you want to set the background color of them, you should first set "background-transparent" to false in the theme file.
Border:
-
If the control has a border, then the border style is always StyleBox!, no matter if you have set to StyleBox!, StyleLowered!, StyleRaised!, or StyleShadowBox in the painter.
-
If the control has a border, then the border color in the theme file has the highest priority.
-
The following control always has a border regardless whether Border is selected in the painter: DatePicker, DropDownListBox, and DropDownPictureListBox. And you can set their border color in the theme file.
-
The following control always has a border although there is no Border property in the painter or the theme file: CommandButton, PictureButton, and GroupBox. And you can set their border color in the theme file.
-
Whether the following control has a border is determined by the Border setting in the painter: WebBrowser, InkEdit, InkPicture, SingleLineEdit, EditMask, MultiLineEdit, RichTextEdit, ListBox, PictureListBox, ListView, TreeView, Graph, and MonthCalendar. Dynamically setting the border property at runtime in the script has no effect.
-
The following control has no border by default ("border"=0 in the theme file): StaticText and StaticHyperLink. If you set "border"=1 in the theme file, then the border settings in the painter determine whether and what color to display the border.
RibbonBar:
-
The background color, border color, font color of the RibbonBar control and ribbon item controls can be set in the theme file.
What cannot be set by the theme
-
The theme is not effective to Line, Oval, Rectangle, RoundRectangle, Picture, PictureHyperLink, and Animation.
-
The theme is not effective to the OLE control or ActiveX control.
-
RichTextEdit control is a third-party ActiveX control, so only the border of this control is configurable in the theme file.
-
The background color for the following controls is transparent: CheckBox and RadioButton; it cannot be changed in the painter or the theme file. But when they are placed on top of an unsupported control (such as Picture), their background color will not be transparent and can be set in the painter.
-
The lines that connect the tree items in the TreeView control will not display, even though the HasLines property is enabled.
-
The font related properties (except font color) cannot be set by the theme file.
-
The ListView Header cannot be set by the theme file.
Workarounds
Take StaticText as an example. If a theme is applied, the font color and background color of StaticText can only be set in the theme file, and cannot be dynamically changed by the expression or the Modify method. If you want to set different font color or background color for multiple StaticText controls, you will have to disable the UI Theme for this control first. To disable the UI Theme for the StaticText control, change the value of "drawing" to false under "statictext" in the theme file.
The UI settings of DataWindow set by the expression or the Modify method have higher priorities than the theme file; except for the border and resizable properties whose settings in the painter have higher priorities than the theme file.
What can be set by the theme
Background color and font color:
-
When "background-color-enabled" is true in the theme file, the background color in the theme file takes effect; when "background-color-enabled" is false in the theme file, the background color in the painter takes effect.
-
For the background color and font color of Column, Text, Computed Field, and GroupBox controls, the settings in the expression or the Modify method have higher priorities than the theme file. The settings in the painter have no effect.
-
The background color of the DataWindow bands such as Header, Footer, Detail, Summary etc. can be set by the theme file.
-
For the Header band of DataWindows, the background of the Text control is transparent and the background color of the Header band is determined by the theme file.
Border:
-
For the DataWindow border property, the settings in the painter have higher priorities than the theme file. Dynamically setting the border property at runtime in the script will not take effect.
-
When the TitleBar property is disabled and the Border property is enabled in the painter, border is rendered using the settings in the theme file; when both the TitleBar property and the Border property are disabled in the painter, no border is rendered (the theme file has no effect to the DataWindow title bar as well as its border).
-
For controls in the DataWindow object, when "border"=0 in the theme file, the visibility of the border is determined by the Border setting in the painter; if the Border setting is selected in the painter, the border is displayed (with the style of StyleBox!) and the border color can be set in the theme file; when "border"=1 in the theme file, controls in the DataWindow object will have StyleBox! border, regardless of the border settings in the painter; when "border"=2 in the theme file, controls in the DataWindow object will not have border, regardless of the border settings in the painter.
-
The border color of DropDownDataWindow can be set by the theme file.
Resizable:
-
For the Resizable property, the settings in the painter have higher priorities than the theme file: when enabled in the painter, DataWindow is not flattened; when disabled in the painter, DataWindow is flattened. Dynamically setting the Resizable property at runtime in the script will not take effect.
Presentation styles:
-
The controls in the DataWindow are configured respectively in the theme file, except for the Column, Text and Computed Field controls in the Grid and Crosstab DataWindow which are configured under the "grid-style" and "cross-style" in the theme file.
-
The DataWindow selected row is determined by the theme file, which are configured under the "cross-style" for the Crosstab DataWindow, or configured under the "grid-style" for DataWindows of other presentation styles.
What cannot be set by the theme
-
The theme is not effective to the DataWindow with the following presentation style: Label, Composite, OLE 2.0, and RichText.
-
The theme is not effective to the DataWindow title bar.
-
The theme is not effective to the DataWindow Button control if the button displays a picture (system picture or custom picture).
-
If a DataWindow control is dynamically created, it will be first rendered by the theme file (rather than the definition in the Create statement), or changed later by the property expression in the painter or the Modify method in the script.
-
The font color of the DataWindow bands including Header, Footer, Detail, Summary (except the Header and Detail bands of Grid and Crosstab DataWindows) cannot be set by the theme file.
-
When printing or saving the DataWindow as PDF file, the theme will not take effect, except for the Graph DataWindow.
-
The border style is always StyleBox!. The following border styles are unsupported: StyleLowered!, StyleRaised!, and StyleShadowBox.
-
The CheckBox and RadioButton control on a DataWindow Column will have no border.
-
The font related properties (except font color) cannot be set by the theme file.
-
If DataWindow HSplitScroll is set to true, the height of HScrollBar groove and the width of VScrollBar groove cannot be set by the theme file; they will have no effect and will use the default values.
Workarounds
The following workaround takes the Text control for DataWindow as an example. If a theme is applied, the font color, background color, and border of Text is set in the theme file. If you want to set different font color for the Text controls in the header band and the detail band, you can set it in the expression or the Modify method.
In the expression:
string ls_create,ls_error dw_1.dataobject = "d_test2" ls_create = 'create text(band=detail alignment="2" text="create" border="2" color=" 65280~t 65280" x="100" y="200" height="116" width="485" html.valueishtml="0" name=t_1 visible="1" font.face="MS Sans Serif" font.height="-16" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color=" 255~tif(1<>1,rgb(0,0,255),rgb(255,0,0))" )' ls_error = dw_1.modify(ls_create)
In the Modify method:
ls_error =dw_1.modify("t_1.color=' 65280'")

