Fixes bug #15933 in WinCE TMemo

git-svn-id: trunk@23905 -
This commit is contained in:
sekelsenmat 2010-03-09 21:52:33 +00:00
parent e41a4b5a78
commit ffd4e28b5c
3 changed files with 36 additions and 21 deletions

View File

@ -20,7 +20,8 @@ TWinCEMemoStrings = class(TStrings)
public
constructor Create(Handle: HWND; TheOwner: TWinControl);
destructor Destroy; override;
procedure Assign(Source : TPersistent); override;
procedure Assign(Source: TPersistent); override;
procedure AddStrings(TheStrings: TStrings); override;
procedure Clear; override;
procedure Delete(Index : integer); override;
procedure Insert(Index : integer; const S: string); override;
@ -61,19 +62,21 @@ end;
function TWinCEMemoStrings.Get(Index: Integer): string;
var
textbuf: PWideChar;
fLength: Integer;
len: Integer;
WideBuffer: WideString;
begin
fLength := GetLineLength(Index);
if fLength = 0 then Result := ''
else
len := GetLineLength(Index);
if len=0 then
begin
textbuf := PWideChar(SysAllocStringLen(nil,fLength+1));
PWord(textbuf)^ := Word(fLength+1);
SendMessageW(fHandle, EM_GETLINE, Index, lparam(textbuf));
Result := UTF8Encode(WideString(textbuf));
SysFreeString(textbuf);
Result := '';
exit;
end;
Setlength(WideBuffer, len);
PWord(@WideBuffer[1])^ := len+1;
len := SendMessageW(FHandle, EM_GETLINE, Index, lparam(PWideChar(WideBuffer)));
Result := UTF16ToUTF8(WideBuffer);
end;
procedure TWinCEMemoStrings.SetUpdateState(Updating: Boolean);
@ -97,13 +100,27 @@ begin
end;
procedure TWinCEMemoStrings.Assign(Source: TPersistent);
var
S: TStrings absolute Source;
begin
if (Source=Self) or (Source=nil) then exit;
if Source is TStrings then begin
SetText(PChar(TStrings(Source).Text));
exit;
end;
Inherited Assign(Source);
if Source is TStrings then
begin
// to prevent Clear and then SetText we need to use our own Assign
QuoteChar := S.QuoteChar;
Delimiter := S.Delimiter;
NameValueSeparator := S.NameValueSeparator;
TextLineBreakStyle := S.TextLineBreakStyle;
Text := S.Text;
end
else
inherited Assign(Source);
end;
procedure TWinCEMemoStrings.AddStrings(TheStrings: TStrings);
begin
SetTextStr(GetTextStr + TStrings(TheStrings).Text);
end;
procedure TWinCEMemoStrings.Clear;

View File

@ -304,10 +304,8 @@ begin
else
pHandles := nil;
// retVal := Windows.MsgWaitForMultipleObjects(FWaitHandleCount,
// pHandles, False, 0, QS_ALLINPUT);
retVal := Windows.MsgWaitForMultipleObjects(0,
nil, False, 0, QS_ALLINPUT);
retVal := Windows.MsgWaitForMultipleObjects(FWaitHandleCount,
pHandles, False, 0, QS_ALLINPUT);
{$ifdef DEBUG_AppProcessMessages}
DbgAppendToFile(ExtractFilePath(ParamStr(0)) + '1.log',

View File

@ -34,7 +34,7 @@ uses
{$ifdef Win32}win32compat,{$endif}
// RTL, FCL, LCL
SysUtils, LCLType, Classes, StdCtrls, Controls, Graphics, Forms, WinCEProc,
InterfaceBase, LMessages, LCLMessageGlue,
InterfaceBase, LMessages, LCLMessageGlue, LCLProc,
// Widgetset
WSControls, WSStdCtrls, WSLCLClasses, WinCEInt, WinCEWSControls, WinCEExtra,
WSProc;