Difference between revisions of "LMD VCL - Unicode Support"

From LMD
Jump to: navigation, search
(Detailed notes)
(General unicode support notes:)
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 +
{{HEAD-ResOnly}}
 +
 
== General unicode support notes: ==
 
== General unicode support notes: ==
* Use WideString instead of String (if library has ansi version, the use defines (see TLMDString type))
+
* Starting from 2021 release LMD libraries support only Unicode IDE version, so most of our native Unicode support was deprecated.
* One symbol, in general case, isn't equal one byte - <b>it's very important</b>
+
* String type is now used accross the code, since it supports Unicode natively by IDE.
 +
* One symbol, in general case, isn't equal one byte.
 
* Use Unicode API function instead of its Ansi version. These function has W suffix. As example DrawTextW, ExtTextOutW etc.
 
* Use Unicode API function instead of its Ansi version. These function has W suffix. As example DrawTextW, ExtTextOutW etc.
* For any operation on unicode string use routines from LMDStrings.pas (must be in core modules)
+
* For any operation on Unicode string use routines from LMDStrings.pas (must be in core modules).
* For unicode string lists use classes from LMDUnicodeStrings
 
* Win 9x/Me has very poor unicode support and need to check all controls on these OSes.
 
  
 
== Detailed notes (units contains in LMDRTL package) ==
 
== Detailed notes (units contains in LMDRTL package) ==
'''LMDUnicode''' Unit contains Unicode related low level implementation. All implementation is made in terms of WideString and WideChar standard Delphi types. Services provided by this unit assumed to be not depended of LMD_UNICODE compiler switch, because they can be used in some special situations, for example for working with Unicode enabled external COM objects, like script engines, ect.
+
'''LMDUnicode''' Unit contains Unicode related low level implementation. Services provided by this unit can be used in some special situations, for example for working with Unicode enabled external COM objects, like script engines, ect.
  
'''LMDUnicodeStrings''' Unit defines TLMDWideStrings and TLMDWideStringList classes. As in previous unit this types assumed to be independed of LMD_UNICODE compiler switch. However, in .Net Vcl versions TLMDWideStrings and TLMDWideStringList are declared as aliases to Delphi standard TStrings and TStringList classes, since there classes already Unicode enabled in .Net. The later fact does not affect primary notion of TLMDWideStrings and TLMDWideStringList classes – they are still Unicode enabled string lists.
+
The usage of WideString and WideChar types has been replaced with string and Char types correspondingly starting from 2021 release. Function names have been changed from LMDWideXXX to LMDUnicodeXXX.
  
'''LMDTypes''' Unit finally declares string and character types that must be used consistently in controls development and other routines, based on our Unicode support strategy. Only Unicode implementation itself and special cases are assumed to use WideString type directly.
+
'''LMDUnicodeStrings''' Unit is deprecated starting from 2021 release. It still defines TLMDWideStrings and TLMDWideStringList deprecated classes. Standard Delphi string list classes like TStrings and TStringList should be used instead.
Following types are defined: TLMDString, TLMDChar, PLMDChar, TLMDStrings and TLMDStringList. There types are depends of LMD_UNICODE compiler switch.
+
 
 +
'''LMDTypes''' Unit declares TLMDString and TLMDChar (PLMDChar deprecated types, as well, as some other supporting types, which should not be used since 2021 release. Instead, standard Delphi's string a sn Char (PChar) types should be used. TLMDStrings and TLMDStringList types are also deprecated now, and should be replaced with TStrings and TStringList types.
  
 
'''LMDStrings''' Unit contain many string utilities.  
 
'''LMDStrings''' Unit contain many string utilities.  
Line 19: Line 21:
 
LMDAnsiXXX version – uses standard Delphi string type. Please note, that this is actually a version that always consistent with any Vcl version. It actually Unicode for Unicode Vcl (in .Net).
 
LMDAnsiXXX version – uses standard Delphi string type. Please note, that this is actually a version that always consistent with any Vcl version. It actually Unicode for Unicode Vcl (in .Net).
 
LMDWideXXX version – always uses WideString type. Unicode in any Vcl version.
 
LMDWideXXX version – always uses WideString type. Unicode in any Vcl version.
LMDXXX version – uses our TLMDString type. The behavior depends of LMD_UNICODE compiler switch. Just like our string types, this version of utilities should be used consistently in controls development. Specialized versions are provided for old non-Unicode controls and special cases.
+
LMDXXX version – uses standard Delphi's string type since 2021 release (previously, TLMDString type used).
Also two proxy string-list types are defined:
+
 
''TLMDStringsProxy'' – is an adapter that adapts TLMDStrings object to TStrings interface.
+
'''LMDUnicodeControl''' Unit is renamed to LMDHintHooks and no longer relates to Unicode support in our libraries.
''TLMDAnsiStringsProxy'' – is an adapter that adapts TStrings object to TLMDStrings interface.
 
  
'''LMDUnicodeControl''' Unit provide utilities for implementing Unicode enabled GUI controls in Vcl. All utilities in this unit are declared in terms of our string types. The behavior of utilities depends of LMD_UNICODE compiler switch. Just like for our string types, the utilities are designed to be used unconditionally in controls development. The primary goal is to hide LMD_UNICODE compiler switch and Vcl version differences.
+
'''LMDUnicodeCtrls''' Unit is deprecated now and provides references to deprecated control types: TLMDWideButton, TLMDWideCheckBox and TLMDWideRadioButton.
  
Discussing Unicode controls we must denote two different tasks:
+
'''LMDUnicodeDialogs''' Unit contains 2 classes - TLMDOpenDilaog and TLMDSaveDialog, that supports unicode features of Windows NT family OSes. They can be used to open/save files with unicode names, can be customized by unicode strings (unicode Title, Filters etc.). Also they used by TLMDFileOpenDialog/TLMDFileSaveDialog (since LMD Tools 2007.1) as Windows XP replacement of Windows Vista new dialogs.
Unicode enabled control interface;
 
Implementation of the control that allow it to work with Unicode properly.
 

Latest revision as of 13:35, 8 April 2021

<< Back to Main Page or Product Resources page

[edit]

General unicode support notes:

  • Starting from 2021 release LMD libraries support only Unicode IDE version, so most of our native Unicode support was deprecated.
  • String type is now used accross the code, since it supports Unicode natively by IDE.
  • One symbol, in general case, isn't equal one byte.
  • Use Unicode API function instead of its Ansi version. These function has W suffix. As example DrawTextW, ExtTextOutW etc.
  • For any operation on Unicode string use routines from LMDStrings.pas (must be in core modules).

Detailed notes (units contains in LMDRTL package)

LMDUnicode Unit contains Unicode related low level implementation. Services provided by this unit can be used in some special situations, for example for working with Unicode enabled external COM objects, like script engines, ect.

The usage of WideString and WideChar types has been replaced with string and Char types correspondingly starting from 2021 release. Function names have been changed from LMDWideXXX to LMDUnicodeXXX.

LMDUnicodeStrings Unit is deprecated starting from 2021 release. It still defines TLMDWideStrings and TLMDWideStringList deprecated classes. Standard Delphi string list classes like TStrings and TStringList should be used instead.

LMDTypes Unit declares TLMDString and TLMDChar (PLMDChar deprecated types, as well, as some other supporting types, which should not be used since 2021 release. Instead, standard Delphi's string a sn Char (PChar) types should be used. TLMDStrings and TLMDStringList types are also deprecated now, and should be replaced with TStrings and TStringList types.

LMDStrings Unit contain many string utilities. Almost every function is duplicated three times: LMDAnsiXXX version – uses standard Delphi string type. Please note, that this is actually a version that always consistent with any Vcl version. It actually Unicode for Unicode Vcl (in .Net). LMDWideXXX version – always uses WideString type. Unicode in any Vcl version. LMDXXX version – uses standard Delphi's string type since 2021 release (previously, TLMDString type used).

LMDUnicodeControl Unit is renamed to LMDHintHooks and no longer relates to Unicode support in our libraries.

LMDUnicodeCtrls Unit is deprecated now and provides references to deprecated control types: TLMDWideButton, TLMDWideCheckBox and TLMDWideRadioButton.

LMDUnicodeDialogs Unit contains 2 classes - TLMDOpenDilaog and TLMDSaveDialog, that supports unicode features of Windows NT family OSes. They can be used to open/save files with unicode names, can be customized by unicode strings (unicode Title, Filters etc.). Also they used by TLMDFileOpenDialog/TLMDFileSaveDialog (since LMD Tools 2007.1) as Windows XP replacement of Windows Vista new dialogs.