Difference between revisions of "The LCL in various platforms"

From Lazarus wiki
Jump to navigationJump to search
 
(26 intermediate revisions by 8 users not shown)
Line 1: Line 1:
 
==Introduction==
 
==Introduction==
  
Many LCL properties, methods and other functionality represent a concept, which is then mapped to a specific native behavior in each platform. This sections aims at clarifying LCL behavior which changes across platforms by clarifying what is to be expected in each platform so that more reliable software can be built.
+
Many [[LCL]] properties, methods and other functionality represent a concept, which is then mapped to a specific native behavior in each platform in order to provide the user with a [[Introduction to platform-sensitive development|platform-sensitive environment]]. This sections aims at clarifying LCL behavior which changes across platforms by clarifying what is to be expected in each platform so that more reliable software can be built.
 +
 
 +
==Linker options==
 +
 
 +
The LCL passes various linker options depending on platform. Here is the conditionals script from the LCL:
 +
<syntaxhighlight lang="pascal">
 +
// linker options
 +
if TargetOS='darwin' then begin
 +
  if LCLWidgetType='gtk' then
 +
    UsageLibraryPath := '/usr/X11R6/lib;/sw/lib'
 +
  else if LCLWidgetType='gtk2' then
 +
    UsageLibraryPath := '/usr/X11R6/lib;/sw/lib;/sw/lib/pango-ft219/lib'
 +
  else if LCLWidgetType='carbon' then begin
 +
    UsageLinkerOptions := '-framework Carbon'
 +
      +' -framework OpenGL'
 +
      +' ''-dylib_file'' ''/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib''';
 +
  end else if LCLWidgetType='cocoa' then
 +
    UsageLinkerOptions := '-framework Cocoa';
 +
end else if TargetOS='solaris' then begin
 +
  UsageLibraryPath:='/usr/X11R6/lib';
 +
end;
 +
</syntaxhighlight>
  
 
== TForm.BorderStyle ==
 
== TForm.BorderStyle ==
  
The BorderStyle of a Form represents a kind of form, and different platforms have different standards about how should the border of each kind of form be, and the LCL respects that. For example, message dialogs are usually not resizable under Windows, but resizable under X11-based Unixes. By using bsDialog it is possible to create a form which will have the adequate dialog appearance in every platform. Bellow is a full list of expected behaviors:
+
The BorderStyle of a Form represents a kind of form, and different platforms have different standards about how should the border of each kind of form be, and the LCL respects that. For example, message dialogs are usually not resizable under Windows, but resizable under X11-based Unixes. By using bsDialog it is possible to create a form which will have the adequate dialog appearance in every platform. Below is a full list of expected behaviors:
  
 
'''Windows'''
 
'''Windows'''
  
{| BORDER="1" CELLSPACING="0"
+
{| class="wikitable"
!COLSPAN="1" STYLE="background:#ffdead;"|'''BorderStyle'''
+
! BorderStyle !! Has Border? !! Resizable? !! Decoration
!COLSPAN="1" STYLE="background:#ffdead;"|'''Has Border?'''
+
|-
!COLSPAN="1" STYLE="background:#ffdead;"|'''Resizable?'''
 
!COLSPAN="1" STYLE="background:#ffdead;"|'''Decoration'''
 
|----
 
 
|bsNone||No||No||None
 
|bsNone||No||No||None
|----
+
|-
 
|bsDialog||Yes||No||Only X (Close)
 
|bsDialog||Yes||No||Only X (Close)
|----
+
|-
 
|bsSingle||Yes||No||All
 
|bsSingle||Yes||No||All
|----
+
|-
 
|bsSizable||Yes||Yes||All
 
|bsSizable||Yes||Yes||All
|----
+
|-
 
|bsSizeToolWin||Yes||Yes||Only X and small title
 
|bsSizeToolWin||Yes||Yes||Only X and small title
|----
+
|-
 
|bsToolWin||Yes||No||Only X and small title
 
|bsToolWin||Yes||No||Only X and small title
 
|}
 
|}
Line 30: Line 48:
 
'''Windows CE'''
 
'''Windows CE'''
  
For Windows CE see here: [[Windows_CE_Development_Notes#Positioning_and_size_of_Dialogs_and_Forms]]
+
For Windows CE see here: [[Windows CE Development Notes#Positioning_and_size_of_Dialogs_and_Forms|Positioning and size of Dialogs and Forms]]
  
 
'''Gtk'''
 
'''Gtk'''
Line 36: Line 54:
 
Under Gtk on X11 the best one can do is ask the window manager to set a certain style, and it may ignore our request, so nothing, except sizable border vs. no border at all is guaranteed. i.e. only bsSizable and bsNone have a guaranteed behavior and the other ones will be either somewhere in between or equal to bsSizable.
 
Under Gtk on X11 the best one can do is ask the window manager to set a certain style, and it may ignore our request, so nothing, except sizable border vs. no border at all is guaranteed. i.e. only bsSizable and bsNone have a guaranteed behavior and the other ones will be either somewhere in between or equal to bsSizable.
  
{| BORDER="1" CELLSPACING="0"
+
{| class="wikitable"
!COLSPAN="1" STYLE="background:#ffdead;"|
+
! !! colspan = 3 | Gtk 1 !! colspan = 3 | Gtk 2'''
!COLSPAN="3" STYLE="background:#ffdead;"|'''Gtk 1'''
+
|-
!COLSPAN="3" STYLE="background:#ffdead;"|'''Gtk 2'''
+
! BorderStyle !! Has Border? !! Resizable? !! Decoration !! Has Border? !! Resizable? !! Decoration
|----
 
!COLSPAN="1" STYLE="background:#ffdead;"|'''BorderStyle'''
 
!COLSPAN="1" STYLE="background:#ffdead;"|'''Has Border?'''
 
!COLSPAN="1" STYLE="background:#ffdead;"|'''Resizable?'''
 
!COLSPAN="1" STYLE="background:#ffdead;"|'''Decoration'''
 
!COLSPAN="1" STYLE="background:#ffdead;"|'''Has Border?'''
 
!COLSPAN="1" STYLE="background:#ffdead;"|'''Resizable?'''
 
!COLSPAN="1" STYLE="background:#ffdead;"|'''Decoration'''
 
 
|----
 
|----
 
|bsNone||No||No||None||No||No||None
 
|bsNone||No||No||None||No||No||None
Line 68: Line 78:
 
Associated bug track items: [http://bugs.freepascal.org/view.php?id=1540]
 
Associated bug track items: [http://bugs.freepascal.org/view.php?id=1540]
  
'''Carbon'''
+
'''macOS'''
 +
 
 +
{| class="wikitable"
 +
! !! colspan = 3 | Carbon !! colspan = 3 | Cocoa<sup>1</sup>'''
 +
|-
 +
! BorderStyle !! Has Border? !! Resizable? !! Decoration !! Has Border? !! Resizable? !! Decoration
 +
|-
 +
|bsNone||No||No||None||Yes||Yes||All
 +
|-
 +
|bsDialog||Yes||No||All||Yes||Yes||All
 +
|-
 +
|bsSingle||Yes||No||All||Yes||Yes||All
 +
|-
 +
|bsSizable||Yes||Yes||All||Yes||Yes||All
 +
|-
 +
|bsSizeToolWin||Yes||Yes||All||Yes||Yes||All
 +
|-
 +
|bsToolWin||Yes||No||All||Yes||Yes||All
 +
|}
 +
 
 +
<sup>1</sup>Note: The Cocoa widgetset is still in development. Details of implementation may change, as well as adherence to GUI guidelines.
 +
 
 +
== Shortcut Keys ==
 +
 
 +
Some Key sequences cannot be used by the Application in some platforms because the Operating System or Windows Manager is already using them. Below is a list for each platform.
 +
 
 +
====macOS====
 +
 
 +
You should refer to Apple [https://developer.apple.com/design/human-interface-guidelines/macos/user-interaction/keyboard/ ''Human Interface Guidelines''] for system reserved shortcuts.
 +
 
 +
{| class="wikitable"
 +
! Key Sequence !! Alternative !! Description
 +
|-
 +
| {{keypress|F8}} / {{keypress|Shift}}+{{keypress|F8}} || ? || F8 activates Spaces
 +
|-
 +
| {{keypress|F9}} / {{keypress|Shift}}+{{keypress|F9}} || ? || F9 shows all windows in Exposé
 +
|-
 +
| {{keypress|F10}} / {{keypress|Shift}}+{{keypress|F10}} || ? || F10 shows all windows of the current program
 +
|-
 +
| {{keypress|F11}} / {{keypress|Shift}}+{{keypress|F11}} || ? || F11 shows the Desktop
 +
|-
 +
| {{keypress|F12}} / {{keypress|Shift}}+{{keypress|F12}} || ? || F12 activates the Dashboard
 +
|}
 +
 
 +
==== Windows ====
 +
 
 +
{| class="wikitable"
 +
! Key Sequence !! Alternative !! Description
 +
|-
 +
| {{keypress|F1}} || ? || F1 invokes the program-specific help system
 +
|}
 +
 
 +
== Popup Menus ==
 +
 
 +
Normally the popup menus are the items in the TPopupMenu assigned to the PopupMenu property.
 +
 
 +
'''GTK''' (1+2)
 +
 
 +
The GTK automatically adds to the TNoteBook and TPageControl headers for each page a menu item to quick jump to the page.
 +
 
 +
'''GTK2'''
 +
 
 +
The GTK2 automatically adds to all edit controls like TEdit and TComboBox unicode and accessibility items.
 +
 
 +
== Command line parameters ==
 +
 
 +
Some widgetsets parse the [[Command line parameters and environment variables|command line parameters]] and react to some parameters.
 +
 
 +
'''GTK'''
 +
 
 +
* --gtk-module
 +
* --g-fatal-warnings
 +
* --gtk-debug
 +
* --gtk-no-debug
 +
* --gdk-debug
 +
* --gdk-no-debug
 +
* --display
 +
* --sync
 +
* --no-xshm
 +
* --name
 +
* --class
 +
 
 +
[[Category:LCL]]
 +
[[Category:Platform-sensitive development]]

Latest revision as of 00:51, 18 June 2020

Introduction

Many LCL properties, methods and other functionality represent a concept, which is then mapped to a specific native behavior in each platform in order to provide the user with a platform-sensitive environment. This sections aims at clarifying LCL behavior which changes across platforms by clarifying what is to be expected in each platform so that more reliable software can be built.

Linker options

The LCL passes various linker options depending on platform. Here is the conditionals script from the LCL:

// linker options
if TargetOS='darwin' then begin
  if LCLWidgetType='gtk' then
    UsageLibraryPath := '/usr/X11R6/lib;/sw/lib'
  else if LCLWidgetType='gtk2' then
    UsageLibraryPath := '/usr/X11R6/lib;/sw/lib;/sw/lib/pango-ft219/lib'
  else if LCLWidgetType='carbon' then begin
    UsageLinkerOptions := '-framework Carbon'
      +' -framework OpenGL'
      +' ''-dylib_file'' ''/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib''';
  end else if LCLWidgetType='cocoa' then
    UsageLinkerOptions := '-framework Cocoa';
end else if TargetOS='solaris' then begin
  UsageLibraryPath:='/usr/X11R6/lib';
end;

TForm.BorderStyle

The BorderStyle of a Form represents a kind of form, and different platforms have different standards about how should the border of each kind of form be, and the LCL respects that. For example, message dialogs are usually not resizable under Windows, but resizable under X11-based Unixes. By using bsDialog it is possible to create a form which will have the adequate dialog appearance in every platform. Below is a full list of expected behaviors:

Windows

BorderStyle Has Border? Resizable? Decoration
bsNone No No None
bsDialog Yes No Only X (Close)
bsSingle Yes No All
bsSizable Yes Yes All
bsSizeToolWin Yes Yes Only X and small title
bsToolWin Yes No Only X and small title

Windows CE

For Windows CE see here: Positioning and size of Dialogs and Forms

Gtk

Under Gtk on X11 the best one can do is ask the window manager to set a certain style, and it may ignore our request, so nothing, except sizable border vs. no border at all is guaranteed. i.e. only bsSizable and bsNone have a guaranteed behavior and the other ones will be either somewhere in between or equal to bsSizable.

Gtk 1 Gtk 2
BorderStyle Has Border? Resizable? Decoration Has Border? Resizable? Decoration
bsNone No No None No No None
bsDialog Yes Yes* All* Yes Yes* All*
bsSingle Yes No (WM) All Yes No (WM) All
bsSizable Yes Yes All Yes Yes All
bsSizeToolWin Yes Yes All* Yes Yes All*
bsToolWin Yes No (WM) All* Yes No (WM) All*

Values with * differ from the Windows Implementation.

Values with (WM) indicate that the feature is Window Manager specific.

Associated bug track items: [1]

macOS

Carbon Cocoa1
BorderStyle Has Border? Resizable? Decoration Has Border? Resizable? Decoration
bsNone No No None Yes Yes All
bsDialog Yes No All Yes Yes All
bsSingle Yes No All Yes Yes All
bsSizable Yes Yes All Yes Yes All
bsSizeToolWin Yes Yes All Yes Yes All
bsToolWin Yes No All Yes Yes All

1Note: The Cocoa widgetset is still in development. Details of implementation may change, as well as adherence to GUI guidelines.

Shortcut Keys

Some Key sequences cannot be used by the Application in some platforms because the Operating System or Windows Manager is already using them. Below is a list for each platform.

macOS

You should refer to Apple Human Interface Guidelines for system reserved shortcuts.

Key Sequence Alternative Description
F8 / Shift+F8 ? F8 activates Spaces
F9 / Shift+F9 ? F9 shows all windows in Exposé
F10 / Shift+F10 ? F10 shows all windows of the current program
F11 / Shift+F11 ? F11 shows the Desktop
F12 / Shift+F12 ? F12 activates the Dashboard

Windows

Key Sequence Alternative Description
F1 ? F1 invokes the program-specific help system

Popup Menus

Normally the popup menus are the items in the TPopupMenu assigned to the PopupMenu property.

GTK (1+2)

The GTK automatically adds to the TNoteBook and TPageControl headers for each page a menu item to quick jump to the page.

GTK2

The GTK2 automatically adds to all edit controls like TEdit and TComboBox unicode and accessibility items.

Command line parameters

Some widgetsets parse the command line parameters and react to some parameters.

GTK

  • --gtk-module
  • --g-fatal-warnings
  • --gtk-debug
  • --gtk-no-debug
  • --gdk-debug
  • --gdk-no-debug
  • --display
  • --sync
  • --no-xshm
  • --name
  • --class