[Lazarus] WinCE and strings

Antonio Fortuny a.fortuny at sitasoftware.lu
Tue Jul 10 09:43:59 CEST 2012


Hi All.

Assuming that I'm modifying an application which
- will run on Win32 and WinCE (handheld device) (X-compilation, 2 targets)
- all string variables have previously been defined as String;
- WinCE (5.?) is UNICODE

Just to make sure that I'm on the right way, do you see someting wrong 
in the following sentences:

- all components using text (TLabel, TButton, TEdit, etc) use WideStrings
- I need to convert (using conditional code) from string to WideString 
when compiling for WinCE, like

Example:
function ShowSomething(const Msg: string): Boolean; <<<-------- 
unchanged function definition
var
{$IFDEF WINCE}
   wStr: WideString;
{$ELSE}
   wStr: String;
{$ENDIF}
begin
   result := False;
{$IFDEF WINCE}
   wStr := UnicodeString(msg);
{$ELSE}
   wStr := msg;
{$ENDIF}
   ALabel.Caption := wStr;
// I  know, the Caption could be assigned immediately instead of passing 
through a variable
// this is just an example
...
   Result := True
end;

Thanks for your remarks

Antonio.







More information about the Lazarus mailing list