Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2009-01

Drawing text in WinCE

7 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Paul van Helden

Hi All,

I'm new to Lazarus having decided to switch from Delphi for a WinCE project. I'm stumped though. Labels on forms display garbage characters. Having spent a whole two days learning about Lazarus internals, Unicode, Widestrings, etc., I'm now pulling out my hair and the project cannot continue.

The following code produces the same "garbage characters":

procedure TGPSForm.SatellitePaintBoxPaint(Sender: TObject);
var
  Rect: TRect;
  Dx: Integer;
  W: WideString;
begin
  with SatellitePaintBox do
  begin
    Rect:=ClientRect;
    W:='Abc';
    Windows.ExtTextOutW(Canvas.Handle, 1, 1, 0, LPRECT(@Rect),
PWideChar(W), Length(W), @Dx);
  end;
end;

Any ideas?

Thanks,

Paul.

Reply by email

John vd Waeter
to Paul van Helden
Paul van Helden wrote 27 lines
Hi All, I'm new to Lazarus having decided to switch from Delphi for a WinCE project. I'm stumped though. Labels on forms display garbage characters. Having spent a whole two days learning about Lazarus internals, Unicode, Widestrings, etc., I'm now pulling out my hair and the project cannot continue. The following code produces the same "garbage characters": procedure TGPSForm.SatellitePaintBoxPaint(Sender: TObject); var Rect: TRect; Dx: Integer; W: WideString; begin with SatellitePaintBox do begin Rect:=ClientRect; W:='Abc'; Windows.ExtTextOutW(Canvas.Handle, 1, 1, 0, LPRECT(@Rect), PWideChar(W), Length(W), @Dx); end; end; Any ideas?

Hmm,
Dunno, I use KOL without major problems.
But what is output when you try:

with SatellitePaintBox do
  begin
    Canvas.Textou(1,1,'Abc');
  end;

?

John

Reply by email

Felipe Monteiro de Carvalho
to Paul van Helden

It works for me ... it's a rather wierd problem ... TLabel not working?

What Lazarus version are you using? How did you install support for wince?

Do you have a screenshot of the problem?

Also, are your source files UTF-8 encoded?

If you start a new project, put only a label in the form and run that does it work?

Are you using a device or the emulator? Can you test with the emulator? (instructions to install it in the wiki)

Felipe Monteiro de Carvalho

Reply by email

Paul van Helden
to Felipe Monteiro de Carvalho

Hi Felipe,

I used 0.9.27SVN but also tried 0.9.26.

I have now tried it with a Windows Mobile 5.0 emulator and it works. It also works on my HTC cellphone running WM 5.

It is on a Windows Mobile 6.1 device that I have the problem. I'm now downloading an emulator image for 6.1.4.

I start a new project, drop a checkbox and a label on the form and run. The checkbox works because the OS draws it. The label comes out with garbage characters.

Thanks for your attention. I desperately need to get this working.

Regards,

Paul.

Reply by email

Paul van Helden
to Paul van Helden

Hi All,

I found the solution to my problem. :-D

Font.Name:='default'; caused strange characters to be displayed on a Windows Mobile 6.1 device. It worked on the emulator and on other devices but not on an out-of-the-box Trimble Juno SC because this device actually comes with a font (one where capital A is a ship's anchor). LCL chose this font but KOL chose "MS Sans Serif". Also when using Size=0 the font displays much bigger than "default", so LCL font control on WinCE needs some work...

Also, I have made changes to FPC source. I added a structure and function for Aygshell.dll in order to interface with a camera. How do I go about getting this into the main source? The changes were made to source\packages\winceunits\src\aygshell.pp and they are:

Inserted at line 461:

CAMERACAPTURE_STILLQUALITY= (CAMERACAPTURE_STILLQUALITY_DEFAULT=0, CAMERACAPTURE_STILLQUALITY_LOW, CAMERACAPTURE_STILLQUALITY_NORMAL,

    CAMERACAPTURE_STILLQUALITY_HIGH);

CAMERACAPTURE_VIDEOTYPE= (CAMERACAPTURE_VIDEOTYPE_ALL = $FFFF, CAMERACAPTURE_VIDEOTYPE_STANDARD = 1,

    CAMERACAPTURE_VIDEOTYPE_MESSAGING = 2);
  CAMERACAPTURE_MODE= (CAMERACAPTURE_MODE_STILL = 0,
CAMERACAPTURE_MODE_VIDEOONLY, CAMERACAPTURE_MODE_VIDEOWITHAUDIO);
  TSHCAMERACAPTURE = record
  TSHCAMERACAPTURE = record
    cbSize             : DWORD;
    hwndOwner          : HWND;
    szFile             : array[0..(MAX_PATH)-1] of WCHAR;
    pszInitialDir      : LPCTSTR;
    pszDefaultFileName : LPCTSTR;
    pszTitle           : LPCTSTR;
    StillQuality       : CAMERACAPTURE_STILLQUALITY;
    VideoTypes         : CAMERACAPTURE_VIDEOTYPE;
    nResolutionWidth   : DWORD;
    nResolutionHeight  : DWORD;
    nVideoTimeLimit    : DWORD;
    Mode               : CAMERACAPTURE_MODE;
  end;
  PSHCAMERACAPTURE=^TSHCAMERACAPTURE;

and inserted

function SHCameraCapture(var shcc: TSHCAMERACAPTURE): HRESULT; external
UserDLLAyg name 'SHCameraCapture';

just before implementation.

Regards,

Paul.

Reply by email

Joost van der Sluis
to Paul van Helden

Op dinsdag 03-02-2009 om 14:52 uur [tijdzone +0200], schreef Paul van Helden:

Show quoted text 6 lines
Also, I have made changes to FPC source. I added a structure and function for Aygshell.dll in order to interface with a camera. How do I go about getting this into the main source? The changes were made to source\packages\winceunits\src\aygshell.pp and they are:

Best is to create a patch first:
http://wiki.lazarus.freepascal.org/Creating_A_Patch

So that we are sure that we are chinging the right lines, and then add it to the bug-tracker. (http://bugs.freepascal.org/) make sure that you select 'fpc' as the project. That way we are sure that the patch is not forgotten.

Joost

Reply by email