PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
  • Aligning a text between two shapes (a circle and a rectangle)
  • Vertically centered
  • Checking the display
  • Background color
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Builds a sequence of characters containing an aligned text or an aligned image.
WINDEVUniversal Windows 10 App In a window, this sequence of characters is used to align a text or an image:
  • in an element found in a List Box or Combo Box control.
  • in the title bar and/or status bar of a window.
  • in a Static control.
Remark: gAlignment only operates on the display of images (gImage) and on the display of text.
Example
WINDEV
// Align the 20 first elements found in "LIST_CustomerList" to the right
FOR Subscript = 1 TO 20
ListAdd(LIST_CustomerList, gAlignment("D", Name[Subscript]))
END
WINDEVUniversal Windows 10 App
// Horizontal and vertical alignment in a Static control
STC_Caption1 = gAlignment("GV", "BOB")
STC_Caption1 = gAlignment("GB", "BOB")
Syntax
<Result> = gAlignment(<Type of alignment> , <String to align> [, <X1> [, <X2>]])
<Result>: Character string
Sequence of characters defining the alignment of a text or image.
WINDEVUniversal Windows 10 App This sequence of characters can be:
WEBDEV - Server code This sequence of characters is not interpreted by the controls in WEBDEV. This function can be used to format the string returned by a WEBDEV Webservice consumed by a WINDEV or WINDEV Mobile application.
<Type of alignment>: Character
Type of alignment for the elements to align. The vertical alignment must necessarily be specified after the horizontal alignment.
"B"Vertical alignment at the bottom.
"C"Centered.
"D"Right-aligned.
"G"Left-aligned.
"H"Vertical alignment at the top.
"V"Vertical alignment in the middle.
"X"Same horizontal alignment as the previous element.
"Y"Same vertical alignment as the previous element.
<String to align>: Character string
Elements to align. This parameter can contain functions for graphic formatting (starting with the letter "g") used to:
  • add drawings to the text,
  • modify the text formatting (background color, text color, etc.).
<X1>: Optional real
Horizontal position of the left corner for the reference rectangle of the alignment area. If this parameter is not specified, the vertical position will be set to 0 (see the Notes).
<X2>: Optional real
Horizontal position of the right corner for the reference rectangle of the alignment area. If this parameter is not specified, the vertical position will be equal to the right border of the element where the string will be displayed (see the Notes).
Remarks

Aligning a text between two shapes (a circle and a rectangle)

To perform this operation, all you have to do is specify <x1> and <x2>. For example:
WINDEV Example for a List Box control:
ListInsert(LIST_CityList, gCircle(0, 0, 15, 15, LightBlue) + ...
gCoord(15, 0) + gAlignment("C", "Avignon", 15, 80) + ...
gRectangle(80, 0, 115, 15, LightRed))
 
ListInsert(LIST_CityList, gCircle(0, 0, 15, 15, LightBlue) + ...
gCoord(15, 0) + gAlignment("C", "Lyon", 15, 80) + ...
gRectangle(80, 0, 115, 15, LightRed))
 
ListInsert(LIST_CityList, gCircle(0, 0, 15, 15, LightBlue) + ...
gCoord(15, 0) + gAlignment("C", "Montpellier", 15, 80) + ...
gRectangle(80, 0, 115, 15, LightRed))

Vertically centered

The elements displayed in the reference rectangle of the alignment area are vertically centered in relation to the height of the element that displays the sequence of characters (in relation to the height of the row found in the List Box or Combo Box control for example).
WINDEV Reminder: For a List Box or Combo Box control, the height of the control row is defined in the "Details" window of control.

Checking the display

gAlignment controls how elements are displayed in the specified area. Any image or text that is displayed outside the alignment area will be truncated.

Background color

The reference rectangle where the alignment is performed is filled with the current background color.
Component: wd270mdl.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment