Module_WindowStyles

Type: Module Parent Module: N/A

Module Module_WindowStyles
Version / Date 2.2 - 7 May 2003
Author (Organisation) Kevin Gale (Newcastle Computer Services Plc)
e-mail keving@ncs-plc.co.uk

This module converts the all window objects to use required default styles and sets the window's theme. The module can also perform the following tasks by setting the relevant flags in the module $construct method prior to running the converter:

  1. Resize the objects if their height is smaller than a minimum height value defined for each type of field.
  2. Reposition the objects if objects heigher up on the window have been resized.
  3. Capitalize text labels.
  4. Capitalize object text (checkboxes, radio buttons, push buttons.)
  5. Convert Popup List objects to DropDown List objects.
  6. Convert List objects to Headed List objects.
  7. Set the drop height for dropdown / combo fields to the maximum possible size that remains within the window.
  8. Set BackgroundTheme of all fields to kBGThemeParent.

Functionality

Copy the default styles from styles library:

  1. Attempt to open library O$Styles.lbs (this must be located in the same folder as the library being converted)
  2. If the O$Styles.lbs was not found then an error is sent to the log and no further processing is performed by this module.
  3. For each style defined in O$Styles.lbs, the old style is removed and new definition added.

The styles defined in the O$Styles.lbs must be named exactly as below but the properties and platforms defined for the styles are at the discretion of the developer and can be changed following completion of the conversion process.

Field Type

Style Used

Min Height

Capitalize Labels

Notes

kCheckbox

CtrlCheckBox

18

cCapitalizeObjects

 

kCombo

CtrlComboBox

19

No

Maximize drop down height if cMaximizeDropDownHeight = kTrue

kComplexGrid

CtrlEditText

N/A

No

 

kDroplist

CtrlDropdownList

19

No

Set $forecolor to kWhite and maximize drop down height if cMaximizeDropDownHeight = kTrue

kEntry

CtrlEditText

19

No

Only if object $effect <> kBorderNone or cNoBorderAsLabel = kFalse (i.e. no border entry fields are not to be treated as text labels)

 

CtrlLabel

13

cCapitalizeLabels

Only if object $effect = kBorderNone and cNoBorderAsLabel = kTrue (i.e. no border entry fields are to be treated as text labels)

kLabel

CtrlLabel

13

cCapitalizeLabels

 

kListBox

CtrlListBox

N/A

No

If cConvertListToHeadedList = kFalse

 

CtrlHeadedListBox

N/A

No

If cConvertListToHeadedList = kTrue then the original list box is removed and replaced by a new headed list box

kMaskedEntry

CtrlEditText

19

No

 

kMultilineEntry

CtrlEditText

19

No

 

kPictureobj

CtrlPicture

N/A

No

 

kPoplist

CtrlPopupList

19

No

If cConvertPopupListToDropDownList = kFalse

 

CtrlDropdownList

19

No

If cConvertPopupListToDropDownList = kTrue then the original popup list is removed and replaced by a new dropdown list box (also set $forecolor to kWhite)

kPopmenu

CtrlPopupMenu

19

No

 

kPushbutton

CtrlPushButton

23

cCapitalizeObjects

 

kRadio

CtrlRadioButton

18

cCapitalizeObjects

 

kText

CtrlLabel

13

cCapitalizeLabels

 

The various styles defined in O$Styles.lbs only control the font name and font size. If you wish to control other properties of fields using styles then you will need to modify the #STYLES table setting the required properties for "All platforms", either in the O$Styles.lbs before running the O$Converter, or in your own library after running the converter.

NB. Where columns in the table above contain cCapitalizeObjects, cCapitalizeLabels, cNoBorderAsLabel, cConvertListToHeadedList or cConvertPopupListToDropDownList then these are switches that control this processing. The developer must set the values of these class variables by editing the code in the $constuct method of the module. If a variable is calculated as kTrue then the style changes controlled by that variable are switched on and if calculated to kFalse they are switched off.

Only window classes are processed. For each window class all field and background objects on the window are processed.

Processing of Field Objects

Process each field and background object on the window class (nb. in the following items in italics represent the switches you set in the $construct method of the module.) For each object:

  1. If the object is a popup list and Convert Popup List to Dropdown List (cConvertPopupListToDropDownList) is kTrue, then create a new drop down list with the same properties and methods as the original object and then remove the original object.
  2. If the original object is a Listbox and Convert List to Headed List (cConvertListToHeadedList) is kTrue, then create a new headed list with the same properties and methods as the original object and then remove the original object and convert the list calculation into a headed list calculation, and build the object's $construct method containing code to tidy the list's appearance.
  3. If Resize Objects (cResizeObjects) is kTrue and the object height is less than the minimum height for that type of object in the table above then set the height to the minimum height. A running total of the amount of adjustment is maintained for use if Reposition Objects (cRepositionObjects) is kTrue.
  4. If Reposition Objects (cRepositionObjects) is kTrue then push objects down the window by the total amount of adjustment of the vertical size of objects above them. Also adjust the window height to take into account resized and repositioned fields. The usefulness of this will depends on the window's layout.
  5. If Background Theme as Parent (cBackThemeParent) is kTrue then set the object $effect to kBorderDefault and the $backgroundtheme to kBGThemeParent.
  6. If Maximize Drop Down Height (cDropDownMinimumHeight) is kTrue and the object is a dropdown list or combo box then set the $listheight to a maximum drop such that the dropped down area still remains within the window.
  7. If the object is a checkbox, radio button or pushbutton and Capitalize Labels (cCapitalizeObjects) is kTrue then capitalize the $text property of the object (i.e. change "CUST NO" or "Cust no" or "cust no" to "Cust No".) Note that is not done if the text is "OK".
  8. If the object is a label and Capitalize Labels (cCapitalizeObjects) is kTrue, then capitalize the contents of the $text property.
  9. If the object is a single line entry field with no border and the $text property contains a quoted string (either '...' or "...") and Treat No Border Fields As Labels (cNoBorderAsLabel) is kTrue and Capitalize Labels (cCapitalizeObjects) is kTrue, then capitalize the contents of the $text property.
  10. Apply the required field style to the object as indicated in the table above.

Set the window class $backgroundtheme to kBGThemeWindow.

Assumptions

  1. None.

User Setup Required for this Module

  1. Set up the flags in the $construct method of the module for Resize Objects, Reposition Objects, Capitalize Text Labels, Capitalize Object Text (checkboxes, radio buttons, push buttons), Convert Popup List objects to DropDown List objects, Convert List objects to Headed List objects, Maximize Drop Down Height, Treat Entry Fields Without Border as Text Labels and Set Background Theme of Entry Fields to Theme Parent. These flags enable you to switch on or off as required, specific kinds of conversion processing that will be applied to window field objects.
  2. If Resize Objects (cResizeObjects) is Calculated as kTrue in the $construct method, then you should check the value of lMinHeight for each type of field that is set in the $updateobject method of the module, to ensure that it suits your requirements.