mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-09 08:36:15 +02:00
Large unicode improvements for Windows CE.
git-svn-id: trunk@14164 -
This commit is contained in:
parent
dbdbd492a7
commit
9e54486ffa
@ -124,6 +124,7 @@ procedure BlendRect(ADC: HDC; const ARect: TRect; Color: ColorRef);
|
|||||||
function GetLastErrorText(AErrorCode: Cardinal): String;
|
function GetLastErrorText(AErrorCode: Cardinal): String;
|
||||||
function BitmapToRegion(hBmp: HBITMAP; cTransparentColor: COLORREF = 0; cTolerance: COLORREF = $101010): HRGN;
|
function BitmapToRegion(hBmp: HBITMAP; cTransparentColor: COLORREF = 0; cTolerance: COLORREF = $101010): HRGN;
|
||||||
|
|
||||||
|
{ String functions that may be moved to the RTL in the future }
|
||||||
function WideStrLCopy(dest, source: PWideChar; maxlen: SizeInt): PWideChar;
|
function WideStrLCopy(dest, source: PWideChar; maxlen: SizeInt): PWideChar;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
@ -1066,7 +1066,7 @@ end;
|
|||||||
function TWin32WidgetSet.DrawText(DC: HDC; Str: PChar; Count: Integer; var Rect: TRect; Flags: Cardinal): Integer;
|
function TWin32WidgetSet.DrawText(DC: HDC; Str: PChar; Count: Integer; var Rect: TRect; Flags: Cardinal): Integer;
|
||||||
{$ifdef WindowsUnicodeSupport}
|
{$ifdef WindowsUnicodeSupport}
|
||||||
var
|
var
|
||||||
s: String;
|
s: AnsiString;
|
||||||
w: WideString;
|
w: WideString;
|
||||||
{$endif}
|
{$endif}
|
||||||
begin
|
begin
|
||||||
@ -1075,20 +1075,22 @@ begin
|
|||||||
|
|
||||||
{$ifdef WindowsUnicodeSupport}
|
{$ifdef WindowsUnicodeSupport}
|
||||||
// use temp buffer, if count is set, there might be no null terminator
|
// use temp buffer, if count is set, there might be no null terminator
|
||||||
if count = -1
|
if count = -1 then
|
||||||
then s := str
|
s := str
|
||||||
else begin
|
else
|
||||||
|
begin
|
||||||
SetLength(s, count);
|
SetLength(s, count);
|
||||||
move(str^, s[1], count);
|
move(str^, s[1], count);
|
||||||
end;
|
end;
|
||||||
// the length of utf8 vs Wide/Ansi the strings differ, so recalc.
|
// the length of utf8 vs Wide/Ansi the strings differ, so recalc.
|
||||||
if UnicodeEnabledOS
|
if UnicodeEnabledOS then
|
||||||
then begin
|
begin
|
||||||
// TODO: use the real number of chars (and not the lenght)
|
// TODO: use the real number of chars (and not the lenght)
|
||||||
W := Utf8Decode(S);
|
W := Utf8Decode(S);
|
||||||
Result := Windows.DrawTextW(DC, PWideChar(W), Length(W), @Rect, Flags);
|
Result := Windows.DrawTextW(DC, PWideChar(W), Length(W), @Rect, Flags);
|
||||||
end
|
end
|
||||||
else begin
|
else
|
||||||
|
begin
|
||||||
S := Utf8ToAnsi(S);
|
S := Utf8ToAnsi(S);
|
||||||
Result := Windows.DrawText(DC, PChar(S), Length(S), @Rect, Flags);
|
Result := Windows.DrawText(DC, PChar(S), Length(S), @Rect, Flags);
|
||||||
end;
|
end;
|
||||||
@ -1232,7 +1234,7 @@ end;
|
|||||||
function TWin32WidgetSet.ExtTextOut(DC: HDC; X, Y: Integer; Options: Longint; Rect: PRect; Str: PChar; Count: Longint; Dx: PInteger): Boolean;
|
function TWin32WidgetSet.ExtTextOut(DC: HDC; X, Y: Integer; Options: Longint; Rect: PRect; Str: PChar; Count: Longint; Dx: PInteger): Boolean;
|
||||||
{$ifdef WindowsUnicodeSupport}
|
{$ifdef WindowsUnicodeSupport}
|
||||||
var
|
var
|
||||||
s: String;
|
s: AnsiString;
|
||||||
w: WideString;
|
w: WideString;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
begin
|
begin
|
||||||
@ -1828,7 +1830,7 @@ end;
|
|||||||
function TWin32WidgetSet.GetTextExtentPoint(DC: HDC; Str: PChar; Count: Integer; Var Size: TSize): Boolean;
|
function TWin32WidgetSet.GetTextExtentPoint(DC: HDC; Str: PChar; Count: Integer; Var Size: TSize): Boolean;
|
||||||
{$ifdef WindowsUnicodeSupport}
|
{$ifdef WindowsUnicodeSupport}
|
||||||
var
|
var
|
||||||
s: String;
|
s: AnsiString;
|
||||||
w: WideString;
|
w: WideString;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
begin
|
begin
|
||||||
|
@ -169,7 +169,6 @@ begin
|
|||||||
Parent := TWin32WidgetSet(WidgetSet).AppHandle;
|
Parent := TWin32WidgetSet(WidgetSet).AppHandle;
|
||||||
|
|
||||||
SubClassWndProc := @WindowProc;
|
SubClassWndProc := @WindowProc;
|
||||||
WindowTitle := nil;
|
|
||||||
StrCaption := PChar(AWinControl.Caption);
|
StrCaption := PChar(AWinControl.Caption);
|
||||||
WindowTitle := nil;
|
WindowTitle := nil;
|
||||||
Height := AWinControl.Height;
|
Height := AWinControl.Height;
|
||||||
@ -473,8 +472,8 @@ end;
|
|||||||
|
|
||||||
class procedure TWin32WSWinControl.SetText(const AWinControl: TWinControl; const AText: string);
|
class procedure TWin32WSWinControl.SetText(const AWinControl: TWinControl; const AText: string);
|
||||||
Begin
|
Begin
|
||||||
if not WSCheckHandleAllocated(AWincontrol, 'SetText')
|
if not WSCheckHandleAllocated(AWincontrol, 'SetText') then Exit;
|
||||||
then Exit;
|
|
||||||
{$ifdef WindowsUnicodeSupport}
|
{$ifdef WindowsUnicodeSupport}
|
||||||
if UnicodeEnabledOS
|
if UnicodeEnabledOS
|
||||||
then Windows.SetWindowTextW(AWinControl.Handle, PWideChar(Utf8Decode(AText)))
|
then Windows.SetWindowTextW(AWinControl.Handle, PWideChar(Utf8Decode(AText)))
|
||||||
|
@ -230,7 +230,7 @@ Var
|
|||||||
PageHandle: HWND;
|
PageHandle: HWND;
|
||||||
begin
|
begin
|
||||||
Notebook := GetWindowInfo(NotebookHandle)^.WinControl as TCustomNotebook;
|
Notebook := GetWindowInfo(NotebookHandle)^.WinControl as TCustomNotebook;
|
||||||
PageIndex := Windows.SendMessage(NotebookHandle, TCM_GETCURSEL, 0, 0);
|
PageIndex := Windows.SendMessageW(NotebookHandle, TCM_GETCURSEL, 0, 0);
|
||||||
//PageIndex := NotebookPageRealToLCLIndex(Notebook, PageIndex);
|
//PageIndex := NotebookPageRealToLCLIndex(Notebook, PageIndex);
|
||||||
if PageIndex = -1 then exit;
|
if PageIndex = -1 then exit;
|
||||||
PageHandle := Notebook.CustomPage(PageIndex).Handle;
|
PageHandle := Notebook.CustomPage(PageIndex).Handle;
|
||||||
@ -438,7 +438,7 @@ Var
|
|||||||
// tabpage parent and got a dc to draw in, divert paint to parent
|
// tabpage parent and got a dc to draw in, divert paint to parent
|
||||||
DCIndex := Windows.SaveDC(PaintMsg.DC);
|
DCIndex := Windows.SaveDC(PaintMsg.DC);
|
||||||
MoveWindowOrgEx(PaintMsg.DC, -parLeft, -parTop);
|
MoveWindowOrgEx(PaintMsg.DC, -parLeft, -parTop);
|
||||||
Windows.SendMessage(ParentPaintWindow, WM_PAINT, PaintMsg.DC, 0);
|
Windows.SendMessageW(ParentPaintWindow, WM_PAINT, PaintMsg.DC, 0);
|
||||||
Windows.RestoreDC(PaintMsg.DC, DCIndex);
|
Windows.RestoreDC(PaintMsg.DC, DCIndex);
|
||||||
end;
|
end;
|
||||||
if (WParam = 0) or not needParentPaint then
|
if (WParam = 0) or not needParentPaint then
|
||||||
@ -487,9 +487,9 @@ Var
|
|||||||
begin
|
begin
|
||||||
MousePos.X := LMMouse.Pos.X;
|
MousePos.X := LMMouse.Pos.X;
|
||||||
MousePos.Y := LMMouse.Pos.Y;
|
MousePos.Y := LMMouse.Pos.Y;
|
||||||
for I := 0 to Windows.SendMessage(Window, LB_GETCOUNT, 0, 0) - 1 do
|
for I := 0 to Windows.SendMessageW(Window, LB_GETCOUNT, 0, 0) - 1 do
|
||||||
begin
|
begin
|
||||||
Windows.SendMessage(Window, LB_GETITEMRECT, I, PtrInt(@ItemRect));
|
Windows.SendMessageW(Window, LB_GETITEMRECT, I, PtrInt(@ItemRect));
|
||||||
ItemRect.Right := ItemRect.Left + ItemRect.Bottom - ItemRect.Top;
|
ItemRect.Right := ItemRect.Left + ItemRect.Bottom - ItemRect.Top;
|
||||||
if Windows.PtInRect(ItemRect, MousePos) then
|
if Windows.PtInRect(ItemRect, MousePos) then
|
||||||
begin
|
begin
|
||||||
@ -518,7 +518,7 @@ Var
|
|||||||
Sibling := Parent.Controls[i];
|
Sibling := Parent.Controls[i];
|
||||||
if (Sibling is TRadioButton) and (Sibling<>RadioButton) and
|
if (Sibling is TRadioButton) and (Sibling<>RadioButton) and
|
||||||
(TRadioButton(Sibling).HandleAllocated) then
|
(TRadioButton(Sibling).HandleAllocated) then
|
||||||
Windows.SendMessage(TRadioButton(Sibling).Handle, BM_SETCHECK,
|
Windows.SendMessageW(TRadioButton(Sibling).Handle, BM_SETCHECK,
|
||||||
Windows.WParam(BST_UNCHECKED), 0);
|
Windows.WParam(BST_UNCHECKED), 0);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -541,7 +541,7 @@ Var
|
|||||||
var
|
var
|
||||||
Buddy: HWND;
|
Buddy: HWND;
|
||||||
begin
|
begin
|
||||||
Buddy := SendMessage(SpinEditHandle, UDM_GETBUDDY, 0, 0);
|
Buddy := SendMessageW(SpinEditHandle, UDM_GETBUDDY, 0, 0);
|
||||||
DestroyWindow(Buddy);
|
DestroyWindow(Buddy);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -549,7 +549,7 @@ Var
|
|||||||
var
|
var
|
||||||
Buddy: HWND;
|
Buddy: HWND;
|
||||||
begin
|
begin
|
||||||
Buddy := SendMessage(SpinEditHandle, UDM_GETBUDDY, 0, 0);
|
Buddy := SendMessageW(SpinEditHandle, UDM_GETBUDDY, 0, 0);
|
||||||
Windows.EnableWindow(Buddy, Enable);
|
Windows.EnableWindow(Buddy, Enable);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -723,7 +723,7 @@ Var
|
|||||||
begin
|
begin
|
||||||
prevFocus := Windows.GetFocus;
|
prevFocus := Windows.GetFocus;
|
||||||
Windows.SetFocus(targetWindow);
|
Windows.SetFocus(targetWindow);
|
||||||
PLMsg^.Result := Windows.SendMessage(targetWindow, WM_SYSCOMMAND, WParam, LParam);
|
PLMsg^.Result := Windows.SendMessageW(targetWindow, WM_SYSCOMMAND, WParam, LParam);
|
||||||
Windows.SetFocus(prevFocus);
|
Windows.SetFocus(prevFocus);
|
||||||
WinProcess := false;
|
WinProcess := false;
|
||||||
end;
|
end;
|
||||||
|
@ -136,7 +136,7 @@ Var
|
|||||||
S: TStrings;
|
S: TStrings;
|
||||||
Counter: Integer;
|
Counter: Integer;
|
||||||
AnIndex: Integer;
|
AnIndex: Integer;
|
||||||
tmpStr : PWideChar;
|
tmpStr : widestring;
|
||||||
Begin
|
Begin
|
||||||
{ Do not call inherited Assign as it does things we do not want to happen }
|
{ Do not call inherited Assign as it does things we do not want to happen }
|
||||||
If Source Is TStrings Then
|
If Source Is TStrings Then
|
||||||
@ -148,9 +148,9 @@ Begin
|
|||||||
Windows.SendMessage(FWinCEList, FFlagResetContent, 0, 0);
|
Windows.SendMessage(FWinCEList, FFlagResetContent, 0, 0);
|
||||||
For Counter := 0 To (TStrings(Source).Count - 1) Do
|
For Counter := 0 To (TStrings(Source).Count - 1) Do
|
||||||
Begin
|
Begin
|
||||||
tmpStr := LCLStringToPWideChar(s[Counter]);
|
tmpStr := UTF8Decode(s[Counter]);
|
||||||
AnIndex := Windows.SendMessage(FWinCEList, FFlagAddString, 0, LPARAM(PWideChar(tmpStr))); //Insert
|
AnIndex := Windows.SendMessageW(FWinCEList, FFlagAddString, 0,
|
||||||
FreeMem(tmpStr);
|
LPARAM(PWideChar(tmpStr))); //Insert
|
||||||
PutObject(AnIndex, S.Objects[Counter]);
|
PutObject(AnIndex, S.Objects[Counter]);
|
||||||
end;
|
end;
|
||||||
End
|
End
|
||||||
@ -181,17 +181,16 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
Function TWinCEListStringList.Get(Index: Integer): String;
|
Function TWinCEListStringList.Get(Index: Integer): String;
|
||||||
Var
|
Var
|
||||||
Item: PWideChar;
|
w: widestring;
|
||||||
Begin
|
Begin
|
||||||
If (Index < 0) Or (Index >= Count) Then
|
If (Index < 0) Or (Index >= Count) Then
|
||||||
Raise Exception.Create('Out of bounds.')
|
Raise Exception.Create('Out of bounds.')
|
||||||
Else
|
Else
|
||||||
Begin
|
Begin
|
||||||
Item := PWideChar(SysAllocStringLen(nil,Windows.SendMessage(FWinCEList, FFlagGetTextLen, Index, 0)));
|
SetLength(w, Windows.SendMessageW(FWinCEList, FFlagGetTextLen, Index, 0));
|
||||||
Windows.SendMessage(FWinCEList, FFlagGetText, Index, LPARAM(Item));
|
Windows.SendMessageW(FWinCEList, FFlagGetText, Index, LPARAM(PWideChar(w)));
|
||||||
|
Result := UTF8Encode(w);
|
||||||
End;
|
End;
|
||||||
Result := String(WideString(Item));//roozbeh:maybe WideStringToString?
|
|
||||||
SysFreeString(Item);
|
|
||||||
End;
|
End;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -235,7 +234,7 @@ End;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
Function TWinCEListStringList.GetObject(Index: Integer): TObject;
|
Function TWinCEListStringList.GetObject(Index: Integer): TObject;
|
||||||
Begin
|
Begin
|
||||||
HWND(Result) := Windows.SendMessage(FWinCEList, FFlagGetItemData, Index, 0);
|
HWND(Result) := Windows.SendMessageW(FWinCEList, FFlagGetItemData, Index, 0);
|
||||||
End;
|
End;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -245,16 +244,12 @@ End;
|
|||||||
|
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
Procedure TWinCEListStringList.Insert(Index: Integer; Const S: String);
|
Procedure TWinCEListStringList.Insert(Index: Integer; Const S: String);
|
||||||
var
|
|
||||||
tmpS : PWideChar;
|
|
||||||
Begin
|
Begin
|
||||||
FLastInsertedIndex := Index;
|
FLastInsertedIndex := Index;
|
||||||
tmpS := LCLStringToPWideChar(s);
|
if FSorted then
|
||||||
If FSorted Then
|
FLastInsertedIndex := Windows.SendMessageW(FWinCEList, FFlagAddString, 0, LPARAM(PWideChar(Utf8Decode(S))))
|
||||||
FLastInsertedIndex := Windows.SendMessage(FWinCEList, FFlagAddString, 0, LPARAM(PWideChar(tmpS)))
|
else
|
||||||
Else
|
Windows.SendMessageW(FWinCEList, FFlagInsertString, Index, LPARAM(PWideChar(Utf8Decode(S))));
|
||||||
Windows.SendMessage(FWinCEList, FFlagInsertString, Index, LPARAM(PWideChar(tmpS)));
|
|
||||||
FreeMem(tmpS);
|
|
||||||
End;
|
End;
|
||||||
|
|
||||||
procedure TWinCEListStringList.Put(Index: integer; const S: string);
|
procedure TWinCEListStringList.Put(Index: integer; const S: string);
|
||||||
@ -266,14 +261,14 @@ begin
|
|||||||
lItemIndex := -1;
|
lItemIndex := -1;
|
||||||
if FFlagGetSelected <> 0 then
|
if FFlagGetSelected <> 0 then
|
||||||
begin
|
begin
|
||||||
lItemIndex := SendMessage(FWinCEList, FFlagGetSelected, Index, 0);
|
lItemIndex := SendMessageW(FWinCEList, FFlagGetSelected, Index, 0);
|
||||||
lSelected := lItemIndex > 0;
|
lSelected := lItemIndex > 0;
|
||||||
if lItemIndex <> LB_ERR then
|
if lItemIndex <> LB_ERR then
|
||||||
lItemIndex := Index;
|
lItemIndex := Index;
|
||||||
end;
|
end;
|
||||||
if lItemIndex = -1 then
|
if lItemIndex = -1 then
|
||||||
begin
|
begin
|
||||||
lItemIndex := SendMessage(FWinCEList, FFlagGetItemIndex, 0, 0);
|
lItemIndex := SendMessageW(FWinCEList, FFlagGetItemIndex, 0, 0);
|
||||||
lSelected := true;
|
lSelected := true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -282,9 +277,9 @@ begin
|
|||||||
if lSelected then
|
if lSelected then
|
||||||
begin
|
begin
|
||||||
if (FFlagSetSelected = 0)
|
if (FFlagSetSelected = 0)
|
||||||
or (SendMessage(FWinCEList, FFlagSetSelected, Windows.WParam(true), lItemIndex) = -1) then
|
or (SendMessageW(FWinCEList, FFlagSetSelected, Windows.WParam(true), lItemIndex) = -1) then
|
||||||
begin
|
begin
|
||||||
SendMessage(FWinCEList, FFlagSetItemIndex, lItemIndex, 0);
|
SendMessageW(FWinCEList, FFlagSetItemIndex, lItemIndex, 0);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -617,15 +612,12 @@ End;
|
|||||||
|
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
Procedure TWinCECListStringList.Insert(Index: Integer; Const S: String);
|
Procedure TWinCECListStringList.Insert(Index: Integer; Const S: String);
|
||||||
var
|
|
||||||
tmpS : PWideChar;
|
|
||||||
Begin
|
Begin
|
||||||
tmpS := LCLStringToPWideChar(S);
|
FLastInsertedIndex := Index;
|
||||||
If FSorted Then
|
if FSorted then
|
||||||
Windows.SendMessage(FWinCECList,LB_ADDSTRING, 0, LPARAM(PWideChar(tmpS)))
|
FLastInsertedIndex := Windows.SendMessageW(FWinCECList, LB_ADDSTRING, 0, LPARAM(PWideChar(Utf8Decode(S))))
|
||||||
Else
|
else
|
||||||
Windows.SendMessage(FWinCECList,LB_INSERTSTRING, Index, LPARAM(PWideChar(tmpS)));
|
Windows.SendMessageW(FWinCECList, LB_INSERTSTRING, Index, LPARAM(PWideChar(Utf8Decode(S))));
|
||||||
FreeMem(tmpS);
|
|
||||||
End;
|
End;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
|
@ -118,6 +118,7 @@ Type
|
|||||||
FWinCECList: HWND;
|
FWinCECList: HWND;
|
||||||
FSender: TWinControl; // Needed to recreate the window
|
FSender: TWinControl; // Needed to recreate the window
|
||||||
FSorted: Boolean;
|
FSorted: Boolean;
|
||||||
|
FlastInsertedIndex: Integer;
|
||||||
Protected
|
Protected
|
||||||
Function Get(Index: Integer): String; Override;
|
Function Get(Index: Integer): String; Override;
|
||||||
Function GetCount: Integer; Override;
|
Function GetCount: Integer; Override;
|
||||||
|
@ -121,17 +121,14 @@ procedure TWinCEMemoStrings.Insert(Index: integer; const S: string);
|
|||||||
var
|
var
|
||||||
LineStart: Integer;
|
LineStart: Integer;
|
||||||
NewLine: String;
|
NewLine: String;
|
||||||
tmpNewLine : PWideChar;
|
|
||||||
begin
|
begin
|
||||||
LineStart := GetLineStart(Index);
|
LineStart := GetLineStart(Index);
|
||||||
if Index < GetRealCount then begin
|
if Index < GetRealCount then begin
|
||||||
//insert with LineEnding
|
//insert with LineEnding
|
||||||
LineStart := GetLineStart(Index);
|
LineStart := GetLineStart(Index);
|
||||||
NewLine := S+LineEnding;
|
NewLine := S+LineEnding;
|
||||||
tmpNewLine := LCLStringToPWideChar(NewLine);
|
SendMessageW(fHandle, EM_SETSEL, LineStart, LineStart);
|
||||||
SendMessage(fHandle, EM_SETSEL, LineStart, LineStart);
|
SendMessageW(fHandle, EM_REPLACESEL, 0, lparam(PWideChar(Utf8Decode(NewLine))))
|
||||||
SendMessage(fHandle, EM_REPLACESEL,0 , lparam(PWideChar(tmpNewLine)));
|
|
||||||
FreeMem(tmpNewLine);
|
|
||||||
end
|
end
|
||||||
else begin
|
else begin
|
||||||
//append with a preceding LineEnding
|
//append with a preceding LineEnding
|
||||||
@ -141,19 +138,13 @@ begin
|
|||||||
NewLine := LineEnding+S+LineEnding
|
NewLine := LineEnding+S+LineEnding
|
||||||
else
|
else
|
||||||
NewLine := S+LineEnding;
|
NewLine := S+LineEnding;
|
||||||
tmpNewLine := LCLStringToPWideChar(NewLine);
|
SendMessageW(fHandle, EM_REPLACESEL, 0, lparam(PWideChar(Utf8Decode(NewLine))))
|
||||||
SendMessage(fHandle, EM_REPLACESEL,0 , lparam(PWideChar(tmpNewLine)));
|
|
||||||
FreeMem(tmpNewLine);
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TWinCEMemoStrings.SetText(TheText: PChar);
|
procedure TWinCEMemoStrings.SetText(TheText: PChar);
|
||||||
var
|
|
||||||
tmpTheText : PWideChar;
|
|
||||||
begin
|
begin
|
||||||
tmpTheText := LCLStringToPWideChar(TheText);
|
Windows.SetWindowTextW(fHandle, PWideChar(Utf8Decode(TheText)))
|
||||||
SendMessage(fHandle, WM_SETTEXT, 0, LPARAM(tmpTheText));
|
|
||||||
FreeMem(tmpTheText);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
@ -144,8 +144,9 @@ begin
|
|||||||
|
|
||||||
// Create parent of all windows, 'button on taskbar'
|
// Create parent of all windows, 'button on taskbar'
|
||||||
// does this work on wince?!
|
// does this work on wince?!
|
||||||
FAppHandle := CreateWindowExW(0, @ClsName, LCLStringToPWideChar(Application.Title),
|
FAppHandle := CreateWindowExW(0, @ClsName,
|
||||||
WS_POPUP or WS_CLIPSIBLINGS or WS_CAPTION or WS_SYSMENU or WS_MINIMIZEBOX,
|
PWideChar(UTF8Decode(Application.Title)),
|
||||||
|
WS_POPUP or WS_CLIPSIBLINGS or WS_CAPTION or WS_SYSMENU or WS_MINIMIZEBOX,
|
||||||
0, {Windows.GetSystemMetrics(SM_CXSCREEN) div 2,}
|
0, {Windows.GetSystemMetrics(SM_CXSCREEN) div 2,}
|
||||||
0, {Windows.GetSystemMetrics(SM_CYSCREEN) div 2,}
|
0, {Windows.GetSystemMetrics(SM_CYSCREEN) div 2,}
|
||||||
0, 0, HWND(nil), HMENU(nil), HInstance, nil);
|
0, 0, HWND(nil), HMENU(nil), HInstance, nil);
|
||||||
@ -428,12 +429,8 @@ end;
|
|||||||
|
|
||||||
|
|
||||||
procedure TWinCEWidgetSet.AppSetTitle(const ATitle: string);
|
procedure TWinCEWidgetSet.AppSetTitle(const ATitle: string);
|
||||||
var
|
|
||||||
tmpText: PWideChar;
|
|
||||||
begin
|
begin
|
||||||
tmpText := LCLStringToPWideChar(ATitle);
|
Windows.SetWindowTextW(FAppHandle, PWideChar(UTF8Decode(ATitle)));
|
||||||
Windows.SetWindowText(FAppHandle, @tmpText);
|
|
||||||
FreeMem(tmpText);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
@ -96,6 +96,9 @@ procedure RedrawMenus;
|
|||||||
function MeasureText(const AWinControl: TWinControl; Text: string; var Width, Height: integer): boolean;
|
function MeasureText(const AWinControl: TWinControl; Text: string; var Width, Height: integer): boolean;
|
||||||
function GetControlText(AHandle: HWND): string;
|
function GetControlText(AHandle: HWND): string;
|
||||||
|
|
||||||
|
{ String functions that may be moved to the RTL in the future }
|
||||||
|
function WideStrLCopy(dest, source: PWideChar; maxlen: SizeInt): PWideChar;
|
||||||
|
|
||||||
type
|
type
|
||||||
PDisableWindowsInfo = ^TDisableWindowsInfo;
|
PDisableWindowsInfo = ^TDisableWindowsInfo;
|
||||||
TDisableWindowsInfo = record
|
TDisableWindowsInfo = record
|
||||||
@ -124,12 +127,9 @@ uses
|
|||||||
and the caller is responsible for freeing it with FreeMem
|
and the caller is responsible for freeing it with FreeMem
|
||||||
}
|
}
|
||||||
function LCLStringToPWideChar(inString: string): PWideChar;
|
function LCLStringToPWideChar(inString: string): PWideChar;
|
||||||
{$ifdef WindowsUnicodeSupport}
|
|
||||||
var
|
var
|
||||||
WideBuffer: widestring;
|
WideBuffer: widestring;
|
||||||
{$endif}
|
|
||||||
begin
|
begin
|
||||||
{$ifdef WindowsUnicodeSupport}
|
|
||||||
{ Converts to a buffer }
|
{ Converts to a buffer }
|
||||||
WideBuffer := Utf8Decode(inString);
|
WideBuffer := Utf8Decode(inString);
|
||||||
|
|
||||||
@ -137,10 +137,7 @@ begin
|
|||||||
Result := GetMem(Length(WideBuffer) * 2 + 2);
|
Result := GetMem(Length(WideBuffer) * 2 + 2);
|
||||||
|
|
||||||
{ Copies to the final destination }
|
{ Copies to the final destination }
|
||||||
Move(WideBuffer[1], Result^, Length(WideBuffer) * 2 + 2);
|
WideStrLCopy(PWideChar(WideBuffer), Result, Length(WideBuffer));
|
||||||
{$else}
|
|
||||||
Result := StringToPWideChar(inString);
|
|
||||||
{$endif}
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ well this is different from normal string(widestring)
|
{ well this is different from normal string(widestring)
|
||||||
@ -1311,16 +1308,13 @@ var
|
|||||||
winHandle: HWND;
|
winHandle: HWND;
|
||||||
canvasHandle: HDC;
|
canvasHandle: HDC;
|
||||||
oldFontHandle: HFONT;
|
oldFontHandle: HFONT;
|
||||||
tmpText : PWideChar;
|
|
||||||
begin
|
begin
|
||||||
winHandle := AWinControl.Handle;
|
winHandle := AWinControl.Handle;
|
||||||
canvasHandle := GetDC(winHandle);
|
canvasHandle := GetDC(winHandle);
|
||||||
oldFontHandle := SelectObject(canvasHandle, Windows.SendMessage(winHandle, WM_GetFont, 0, 0));
|
oldFontHandle := SelectObject(canvasHandle, Windows.SendMessage(winHandle, WM_GetFont, 0, 0));
|
||||||
DeleteAmpersands(Text);
|
DeleteAmpersands(Text);
|
||||||
|
|
||||||
tmpText := LCLStringToPWideChar(Text);
|
Result := LCLIntf.GetTextExtentPoint32(canvasHandle, PChar(Text), Length(Text), textSize);
|
||||||
Result := Windows.GetTextExtentPoint32W(canvasHandle, PWideChar(tmpText), Length(Text), textSize);
|
|
||||||
FreeMem(tmpText);
|
|
||||||
|
|
||||||
if Result then
|
if Result then
|
||||||
begin
|
begin
|
||||||
@ -1343,6 +1337,25 @@ begin
|
|||||||
SysFreeString(tmpWideStr);
|
SysFreeString(tmpWideStr);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ Exactly equal to StrLCopy but for PWideChars
|
||||||
|
Copyes a widestring up to a maximal length, in WideChars }
|
||||||
|
function WideStrLCopy(dest, source: PWideChar; maxlen: SizeInt): PWideChar;
|
||||||
|
var
|
||||||
|
counter: SizeInt;
|
||||||
|
begin
|
||||||
|
counter := 0;
|
||||||
|
|
||||||
|
while (Source[counter] <> #0) and (counter < MaxLen) do
|
||||||
|
begin
|
||||||
|
Dest[counter] := Source[counter];
|
||||||
|
Inc(counter);
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ terminate the string }
|
||||||
|
Dest[counter] := #0;
|
||||||
|
Result := Dest;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{-------------------------------------------------------------------------------
|
{-------------------------------------------------------------------------------
|
||||||
procedure AddToChangedMenus(Window: HWnd);
|
procedure AddToChangedMenus(Window: HWnd);
|
||||||
|
@ -159,7 +159,7 @@ var
|
|||||||
Details: TThemedElementDetails;
|
Details: TThemedElementDetails;
|
||||||
OldColor: COLORREF;
|
OldColor: COLORREF;
|
||||||
OldBackColor: COLORREF;
|
OldBackColor: COLORREF;
|
||||||
WideBuffer: PWideChar;
|
WideBuffer: widestring;
|
||||||
begin
|
begin
|
||||||
Selected := (Data^.itemState AND ODS_SELECTED)>0;
|
Selected := (Data^.itemState AND ODS_SELECTED)>0;
|
||||||
Enabled := CheckListBox.Enabled;
|
Enabled := CheckListBox.Enabled;
|
||||||
@ -211,10 +211,9 @@ var
|
|||||||
OldBackColor := Windows.SetBkColor(Data^._HDC, LCLIntf.GetSysColor(COLOR_WINDOW)); // $00FFFFFF
|
OldBackColor := Windows.SetBkColor(Data^._HDC, LCLIntf.GetSysColor(COLOR_WINDOW)); // $00FFFFFF
|
||||||
end;
|
end;
|
||||||
|
|
||||||
WideBuffer := LCLStringToPWideChar(CheckListBox.Items[Data^.ItemID]);
|
WideBuffer := UTF8Decode(CheckListBox.Items[Data^.ItemID]);
|
||||||
Windows.DrawTextW(Data^._HDC, WideBuffer, -1,
|
Windows.DrawTextW(Data^._HDC, PWideChar(WideBuffer), -1,
|
||||||
Rect, DT_SINGLELINE or DT_VCENTER or DT_NOPREFIX);
|
Rect, DT_SINGLELINE or DT_VCENTER or DT_NOPREFIX);
|
||||||
FreeMem(WideBuffer);
|
|
||||||
|
|
||||||
// Return to default text and background colors
|
// Return to default text and background colors
|
||||||
Windows.SetTextColor(Data^._HDC, OldColor);
|
Windows.SetTextColor(Data^._HDC, OldColor);
|
||||||
@ -328,7 +327,7 @@ end;
|
|||||||
): string;
|
): string;
|
||||||
begin
|
begin
|
||||||
Result:=inherited ClipboardFormatToMimeType(FormatID);
|
Result:=inherited ClipboardFormatToMimeType(FormatID);
|
||||||
end;
|
end; }
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Method: ClipboardGetData
|
Method: ClipboardGetData
|
||||||
Params: ClipboardType - clipboard type
|
Params: ClipboardType - clipboard type
|
||||||
@ -337,11 +336,11 @@ end;
|
|||||||
stream
|
stream
|
||||||
Returns: true on success
|
Returns: true on success
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function TWinCEWidgetSet.ClipboardGetData(ClipboardType: TClipboardType;
|
{function TWinCEWidgetSet.ClipboardGetData(ClipboardType: TClipboardType;
|
||||||
FormatID: TClipboardFormat; Stream: TStream): boolean;
|
FormatID: TClipboardFormat; Stream: TStream): boolean;
|
||||||
begin
|
begin
|
||||||
Result:=inherited ClipboardGetData(ClipboardType, FormatID, Stream);
|
Result:=inherited ClipboardGetData(ClipboardType, FormatID, Stream);
|
||||||
end;
|
end; }
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Method: ClipboardGetFormats
|
Method: ClipboardGetFormats
|
||||||
Params: ClipboardType - the type of clipboard operation (GTK only; ignored here)
|
Params: ClipboardType - the type of clipboard operation (GTK only; ignored here)
|
||||||
@ -350,11 +349,11 @@ end;
|
|||||||
(you must free it yourself)
|
(you must free it yourself)
|
||||||
Returns: true on success
|
Returns: true on success
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function TWinCEWidgetSet.ClipboardGetFormats(ClipboardType: TClipboardType;
|
{function TWinCEWidgetSet.ClipboardGetFormats(ClipboardType: TClipboardType;
|
||||||
var Count: integer; var List: PClipboardFormat): boolean;
|
var Count: integer; var List: PClipboardFormat): boolean;
|
||||||
begin
|
begin
|
||||||
Result:=inherited ClipboardGetFormats(ClipboardType, Count, List);
|
Result:=inherited ClipboardGetFormats(ClipboardType, Count, List);
|
||||||
end;
|
end; }
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Method: ClipboardGetOwnerShip
|
Method: ClipboardGetOwnerShip
|
||||||
@ -374,13 +373,13 @@ end;
|
|||||||
if someone else requests the ownership, the OnRequestProc will be executed
|
if someone else requests the ownership, the OnRequestProc will be executed
|
||||||
with the invalid FormatID 0 to notify the old owner of the lost of ownership.
|
with the invalid FormatID 0 to notify the old owner of the lost of ownership.
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function TWinCEWidgetSet.ClipboardGetOwnerShip(ClipboardType: TClipboardType;
|
{function TWinCEWidgetSet.ClipboardGetOwnerShip(ClipboardType: TClipboardType;
|
||||||
OnRequestProc: TClipboardRequestEvent; FormatCount: integer;
|
OnRequestProc: TClipboardRequestEvent; FormatCount: integer;
|
||||||
Formats: PClipboardFormat): boolean;
|
Formats: PClipboardFormat): boolean;
|
||||||
begin
|
begin
|
||||||
Result:=inherited ClipboardGetOwnerShip(ClipboardType, OnRequestProc,
|
Result:=inherited ClipboardGetOwnerShip(ClipboardType, OnRequestProc,
|
||||||
FormatCount, Formats);
|
FormatCount, Formats);
|
||||||
end;
|
end; }
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Method: ClipboardRegisterFormat
|
Method: ClipboardRegisterFormat
|
||||||
@ -388,7 +387,7 @@ end;
|
|||||||
type to register
|
type to register
|
||||||
Returns: the registered Format identifier (TClipboardFormat)
|
Returns: the registered Format identifier (TClipboardFormat)
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function TWinCEWidgetSet.ClipboardRegisterFormat(const AMimeType: string
|
{function TWinCEWidgetSet.ClipboardRegisterFormat(const AMimeType: string
|
||||||
): TClipboardFormat;
|
): TClipboardFormat;
|
||||||
begin
|
begin
|
||||||
Result:=inherited ClipboardRegisterFormat(AMimeType);
|
Result:=inherited ClipboardRegisterFormat(AMimeType);
|
||||||
@ -776,13 +775,26 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function TWinCEWidgetSet.DrawText(DC: HDC; Str: PChar; Count: Integer; var Rect: TRect; Flags: Cardinal): Integer;
|
function TWinCEWidgetSet.DrawText(DC: HDC; Str: PChar; Count: Integer; var Rect: TRect; Flags: Cardinal): Integer;
|
||||||
var
|
var
|
||||||
WideStr : PWideChar;
|
s: AnsiString;
|
||||||
|
w: WideString;
|
||||||
begin
|
begin
|
||||||
Assert(False, Format('trace:> [TWinCEWidgetSet.DrawText] DC:0x%x, Str:''%s'', Count: %d, Rect = %d,%d,%d,%d, Flags:%d',
|
Assert(False, Format('trace:> [TWinCEWidgetSet.DrawText] DC:0x%x, Str:''%s'', Count: %d, Rect = %d,%d,%d,%d, Flags:%d',
|
||||||
[DC, Str, Count, Rect.Left, Rect.Top, Rect.Right, Rect.Bottom, Flags]));
|
[DC, Str, Count, Rect.Left, Rect.Top, Rect.Right, Rect.Bottom, Flags]));
|
||||||
WideStr := LCLStringToPWideChar(String(str));
|
|
||||||
Result := Windows.DrawTextW(DC, WideStr, Count, @Rect, Flags);
|
// use temp buffer, if count is set, there might be no null terminator
|
||||||
FreeMem(WideStr);
|
if count = -1 then
|
||||||
|
s := str
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
SetLength(s, count);
|
||||||
|
move(str^, s[1], count);
|
||||||
|
end;
|
||||||
|
// the length of utf8 vs Wide/Ansi the strings differ, so recalc.
|
||||||
|
|
||||||
|
// TODO: use the real number of chars (and not the lenght)
|
||||||
|
W := Utf8Decode(S);
|
||||||
|
Result := Windows.DrawTextW(DC, PWideChar(W), Length(W), @Rect, Flags);
|
||||||
|
// Result := Windows.DrawTextW(DC, WideStr, Count, @Rect, Flags);
|
||||||
Assert(False, Format('trace:> [TWinCEWidgetSet.DrawText] DC:0x%x, Str:''%s'', Count: %d, Rect = %d,%d,%d,%d, Flags:%d',
|
Assert(False, Format('trace:> [TWinCEWidgetSet.DrawText] DC:0x%x, Str:''%s'', Count: %d, Rect = %d,%d,%d,%d, Flags:%d',
|
||||||
[DC, Str, Count, Rect.Left, Rect.Top, Rect.Right, Rect.Bottom, Flags]));
|
[DC, Str, Count, Rect.Left, Rect.Top, Rect.Right, Rect.Bottom, Flags]));
|
||||||
end;
|
end;
|
||||||
@ -898,12 +910,25 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function TWinCEWidgetSet.ExtTextOut(DC: HDC; X, Y: Integer; Options: Longint; Rect: PRect; Str: PChar; Count: Longint; Dx: PInteger): Boolean;
|
function TWinCEWidgetSet.ExtTextOut(DC: HDC; X, Y: Integer; Options: Longint; Rect: PRect; Str: PChar; Count: Longint; Dx: PInteger): Boolean;
|
||||||
var
|
var
|
||||||
pWideStr : PWideChar;
|
s: AnsiString;
|
||||||
|
w: WideString;
|
||||||
begin
|
begin
|
||||||
Assert(False, Format('trace:> [TWinCEWidgetSet.ExtTextOut] DC:0x%x, X:%d, Y:%d, Options:%d, Str:''%s'', Count: %d', [DC, X, Y, Options, Str, Count]));
|
Assert(False, Format('trace:> [TWinCEWidgetSet.ExtTextOut] DC:0x%x, X:%d, Y:%d, Options:%d, Str:''%s'', Count: %d', [DC, X, Y, Options, Str, Count]));
|
||||||
pWideStr := LCLStringToPWideChar(string(Str));
|
|
||||||
Result := Boolean(Windows.ExtTextOutW(DC, X, Y, Options, LPRECT(Rect), pWideStr, Count, Dx));
|
// use temp buffer, if count is set, there might be no null terminator
|
||||||
FreeMem(pWideStr);
|
if count = -1 then
|
||||||
|
s := str
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
SetLength(s, count);
|
||||||
|
move(str^, s[1], count);
|
||||||
|
end;
|
||||||
|
// the length of utf8 vs Wide/Ansi the strings differ, so recalc.
|
||||||
|
|
||||||
|
// TODO: use the real number of chars (and not the lenght)
|
||||||
|
W := Utf8Decode(S);
|
||||||
|
Result := Windows.ExtTextOutW(DC, X, Y, Options, LPRECT(Rect), PWideChar(W), Length(W), Dx);
|
||||||
|
// Result := Boolean(Windows.ExtTextOutW(DC, X, Y, Options, LPRECT(Rect), pWideStr, Count, Dx));
|
||||||
Assert(False, Format('trace:< [TWinCEWidgetSet.ExtTextOut] DC:0x%x, X:%d, Y:%d, Options:%d, Str:''%s'', Count: %d', [DC, X, Y, Options, Str, Count]));
|
Assert(False, Format('trace:< [TWinCEWidgetSet.ExtTextOut] DC:0x%x, X:%d, Y:%d, Options:%d, Str:''%s'', Count: %d', [DC, X, Y, Options, Str, Count]));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1399,15 +1424,14 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function TWinCEWidgetSet.GetProp(Handle: hwnd; Str: PChar): Pointer;
|
function TWinCEWidgetSet.GetProp(Handle: hwnd; Str: PChar): Pointer;
|
||||||
var
|
var
|
||||||
WideStr: PWideChar;
|
WideStr: widestring;
|
||||||
begin
|
begin
|
||||||
WideStr := LCLStringToPWideChar(String(str));
|
WideStr := UTF8Decode(String(str));
|
||||||
{$ifdef win32}
|
{$ifdef win32}
|
||||||
Result := Pointer(Windows.GetPropW(Handle, WideStr));
|
Result := Pointer(Windows.GetPropW(Handle, PWideChar(WideStr)));
|
||||||
{$else}
|
{$else}
|
||||||
Result := Pointer(Windows.GetProp(Handle, WideStr));
|
Result := Pointer(Windows.GetProp(Handle, PWideChar(WideStr)));
|
||||||
{$endif}
|
{$endif}
|
||||||
FreeMem(WideStr);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{function TWinCEWidgetSet.GetRawImageFromDevice(SrcDC: HDC;
|
{function TWinCEWidgetSet.GetRawImageFromDevice(SrcDC: HDC;
|
||||||
@ -1536,13 +1560,24 @@ end;
|
|||||||
|
|
||||||
function TWinCEWidgetSet.GetTextExtentPoint(DC: HDC; Str: PChar; Count: Integer; var Size: TSize): Boolean;
|
function TWinCEWidgetSet.GetTextExtentPoint(DC: HDC; Str: PChar; Count: Integer; var Size: TSize): Boolean;
|
||||||
var
|
var
|
||||||
WideStr : PWideChar;
|
s: AnsiString;
|
||||||
|
w: WideString;
|
||||||
begin
|
begin
|
||||||
Assert(False, 'Trace:[TWinCEWidgetSet.GetTextExtentPoint] - Start');
|
Assert(False, 'Trace:[TWinCEWidgetSet.GetTextExtentPoint] - Start');
|
||||||
Result := false;
|
if count = -1 then
|
||||||
WideStr := LCLStringToPWideChar(String(Str));
|
s := str
|
||||||
Result := Boolean(Windows.GetTextExtentExPointW(DC, WideStr, Count, 0,nil,nil,@Size));
|
else
|
||||||
FreeMem(WideStr);
|
begin
|
||||||
|
SetLength(s, count);
|
||||||
|
move(str^, s[1], count);
|
||||||
|
end;
|
||||||
|
// the length of utf8 vs Wide/Ansi the strings differ, so recalc.
|
||||||
|
|
||||||
|
// TODO: use the real number of chars (and not the lenght)
|
||||||
|
w := Utf8Decode(S);
|
||||||
|
Result := Windows.GetTextExtentPoint32W(DC, PWideChar(W), Length(W),
|
||||||
|
{$ifdef Win32}@Size{$else}Size{$endif});
|
||||||
|
// Result := Boolean(Windows.GetTextExtentExPointW(DC, WideStr, Count, 0,nil,nil,@Size));
|
||||||
Assert(False, 'Trace:[TWinCEWidgetSet.GetTextExtentPoint] - Exit');
|
Assert(False, 'Trace:[TWinCEWidgetSet.GetTextExtentPoint] - Exit');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1865,13 +1900,13 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function TWinCEWidgetSet.MessageBox(HWnd: HWND; LPText, LPCaption: PChar; UType: Cardinal): Integer;
|
function TWinCEWidgetSet.MessageBox(HWnd: HWND; LPText, LPCaption: PChar; UType: Cardinal): Integer;
|
||||||
var
|
var
|
||||||
LPWCaption,LPWText : PWideChar;
|
WideLPText, WideLPCaption: widestring;
|
||||||
begin
|
begin
|
||||||
LPWCaption := LCLStringToPWideChar(String(LPCaption));
|
WideLPText := UTF8Decode(string(LPText));
|
||||||
LPWText := LCLStringToPWideChar(String(LPText));
|
WideLPCaption := UTF8Decode(string(LPCaption));
|
||||||
Result := Windows.MessageBoxW(HWnd, LPWText, LPWCaption, UType);
|
|
||||||
FreeMem(LPWCaption);
|
Result := Windows.MessageBoxW(HWnd, PWideChar(WideLPText),
|
||||||
FreeMem(LPWText);
|
PWideChar(WideLPCaption), UType);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -2385,15 +2420,14 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function TWinCEWidgetSet.SetProp(Handle: hwnd; Str: PChar; Data: Pointer): Boolean;
|
function TWinCEWidgetSet.SetProp(Handle: hwnd; Str: PChar; Data: Pointer): Boolean;
|
||||||
var
|
var
|
||||||
WideStr: PWideChar;
|
WideStr: widestring;
|
||||||
begin
|
begin
|
||||||
WideStr := LCLStringToPWideChar(String(str));
|
WideStr := UTF8Decode(String(str));
|
||||||
{$ifdef win32}
|
{$ifdef win32}
|
||||||
Result := Boolean(Windows.SetPropW(Handle, WideStr, Windows.HANDLE(Data)));
|
Result := Boolean(Windows.SetPropW(Handle, PWideChar(WideStr), Windows.HANDLE(Data)));
|
||||||
{$else}
|
{$else}
|
||||||
Result := Boolean(Windows.SetProp(Handle, WideStr, Windows.HANDLE(Data)));
|
Result := Boolean(Windows.SetProp(Handle, PWideChar(WideStr), Windows.HANDLE(Data)));
|
||||||
{$endif}
|
{$endif}
|
||||||
FreeMem(WideStr);
|
|
||||||
end;
|
end;
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Method: SetROP2
|
Method: SetROP2
|
||||||
|
@ -247,7 +247,6 @@ procedure UpdateStatusBarPanel(const StatusPanel: TStatusPanel);
|
|||||||
var
|
var
|
||||||
BevelType: integer;
|
BevelType: integer;
|
||||||
Text: string;
|
Text: string;
|
||||||
pwText : PWideChar;
|
|
||||||
begin
|
begin
|
||||||
Text := StatusPanel.Text;
|
Text := StatusPanel.Text;
|
||||||
case StatusPanel.Alignment of
|
case StatusPanel.Alignment of
|
||||||
@ -259,9 +258,8 @@ begin
|
|||||||
pbLowered: BevelType := 0;
|
pbLowered: BevelType := 0;
|
||||||
pbRaised: BevelType := Windows.SBT_POPOUT;
|
pbRaised: BevelType := Windows.SBT_POPOUT;
|
||||||
end;
|
end;
|
||||||
pwText := LCLStringToPWideChar(Text);
|
Windows.SendMessageW(StatusPanel.StatusBar.Handle, SB_SETTEXT,
|
||||||
Windows.SendMessage(StatusPanel.StatusBar.Handle, SB_SETTEXT, StatusPanel.Index or BevelType, LPARAM(pwText));
|
StatusPanel.Index or BevelType, LPARAM(PWideChar(UTF8Decode(Text))));
|
||||||
FreeMem(pwText);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure UpdateStatusBarPanelWidths(const StatusBar: TStatusBar);
|
procedure UpdateStatusBarPanelWidths(const StatusBar: TStatusBar);
|
||||||
@ -272,8 +270,8 @@ var
|
|||||||
begin
|
begin
|
||||||
if StatusBar.Panels.Count=0 then begin
|
if StatusBar.Panels.Count=0 then begin
|
||||||
// SETPARTS 0,0 does not work :S
|
// SETPARTS 0,0 does not work :S
|
||||||
Windows.SendMessage(StatusBar.Handle, SB_SIMPLE, 1, 0);
|
Windows.SendMessageW(StatusBar.Handle, SB_SIMPLE, 1, 0);
|
||||||
Windows.SendMessage(StatusBar.Handle, SB_SETTEXT, 255, WPARAM(PWideChar('')));
|
Windows.SendMessageW(StatusBar.Handle, SB_SETTEXT, 255, WPARAM(PWideChar('')));
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
Getmem(Rights, StatusBar.Panels.Count * sizeof(integer));
|
Getmem(Rights, StatusBar.Panels.Count * sizeof(integer));
|
||||||
@ -355,7 +353,7 @@ begin
|
|||||||
if AStatusBar.SimplePanel then
|
if AStatusBar.SimplePanel then
|
||||||
begin
|
begin
|
||||||
tmpSimpleText := LCLStringToPWideChar(AStatusBar.SimpleText);
|
tmpSimpleText := LCLStringToPWideChar(AStatusBar.SimpleText);
|
||||||
Windows.SendMessage(AStatusBar.Handle, SB_SETTEXT, 255, LPARAM(PWideChar(tmpSimpleText)));
|
Windows.SendMessageW(AStatusBar.Handle, SB_SETTEXT, 255, LPARAM(PWideChar(tmpSimpleText)));
|
||||||
FreeMem(tmpSimpleText);
|
FreeMem(tmpSimpleText);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
@ -145,7 +145,7 @@ type
|
|||||||
MenuHandle: HMENU;
|
MenuHandle: HMENU;
|
||||||
Flags, FlagsEx: dword;
|
Flags, FlagsEx: dword;
|
||||||
SubClassWndProc: pointer;
|
SubClassWndProc: pointer;
|
||||||
WindowTitle, StrCaption: PWideChar;
|
WindowTitle, StrCaption: PChar;
|
||||||
pClassName: PWideChar;
|
pClassName: PWideChar;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -181,9 +181,8 @@ begin
|
|||||||
|
|
||||||
SubClassWndProc := @WindowProc;
|
SubClassWndProc := @WindowProc;
|
||||||
WindowTitle := nil;
|
WindowTitle := nil;
|
||||||
|
StrCaption := PChar(AWinControl.Caption);
|
||||||
|
|
||||||
StrCaption := LCLStringToPWideChar(AWinControl.Caption);
|
|
||||||
WindowTitle := nil;
|
|
||||||
Height := AWinControl.Height;
|
Height := AWinControl.Height;
|
||||||
Left := AWinControl.Left;
|
Left := AWinControl.Left;
|
||||||
//Parent := AWinControl.Parent;
|
//Parent := AWinControl.Parent;
|
||||||
@ -229,7 +228,7 @@ begin
|
|||||||
Window := CreateWindowExW(
|
Window := CreateWindowExW(
|
||||||
FlagsEx, // Extra Flags
|
FlagsEx, // Extra Flags
|
||||||
pClassName, // Name of the registered class
|
pClassName, // Name of the registered class
|
||||||
WindowTitle, // Title of the window
|
PWideChar(UTF8Decode(WindowTitle)),// Title of the window
|
||||||
Flags, // Style of the window
|
Flags, // Style of the window
|
||||||
Left, // x-position (at beginning)
|
Left, // x-position (at beginning)
|
||||||
Top, // y-position (at beginning)
|
Top, // y-position (at beginning)
|
||||||
@ -242,9 +241,8 @@ begin
|
|||||||
|
|
||||||
if Window = 0 then
|
if Window = 0 then
|
||||||
begin
|
begin
|
||||||
// Writeln('failed to create wince control, error: '+ IntToStr(GetLastError()));
|
|
||||||
raise exception.create('failed to create win32 control, error: '+IntToStr(GetLastError())
|
raise exception.create('failed to create win32 control, error: '+IntToStr(GetLastError())
|
||||||
+ ' control: ' + WindowTitle);
|
+ ' WindowTitle: ' + WindowTitle);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
{ after creating a child window the following happens:
|
{ after creating a child window the following happens:
|
||||||
@ -449,14 +447,10 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
class procedure TWinCEWSWinControl.SetText(const AWinControl: TWinControl; const AText: string);
|
class procedure TWinCEWSWinControl.SetText(const AWinControl: TWinControl; const AText: string);
|
||||||
var
|
|
||||||
tmpStr : PWideChar;
|
|
||||||
begin
|
begin
|
||||||
if not WSCheckHandleAllocated(AWincontrol, 'SetText')
|
if not WSCheckHandleAllocated(AWincontrol, 'SetText') then Exit;
|
||||||
then Exit;
|
|
||||||
tmpStr := LCLStringToPWideChar(AText);
|
Windows.SetWindowTextW(AWinControl.Handle, PWideChar(UTF8Decode(AText)));
|
||||||
Windows.SetWindowTextW(AWinControl.Handle, PWideChar(tmpStr));
|
|
||||||
FreeMem(tmpStr);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class procedure TWinCEWSWinControl.ConstraintsChange(const AWinControl: TWinControl);
|
class procedure TWinCEWSWinControl.ConstraintsChange(const AWinControl: TWinControl);
|
||||||
|
@ -205,7 +205,7 @@ begin
|
|||||||
|
|
||||||
{$ifdef Win32}
|
{$ifdef Win32}
|
||||||
lvc.pszText := PChar(LCLStringToPWideChar(ACaption));
|
lvc.pszText := PChar(LCLStringToPWideChar(ACaption));
|
||||||
SendMessage(ALV.Handle, LVM_SETCOLUMNW, WPARAM(AIndex), LPARAM(@lvc));
|
SendMessageW(ALV.Handle, LVM_SETCOLUMNW, WPARAM(AIndex), LPARAM(@lvc));
|
||||||
{$else}
|
{$else}
|
||||||
lvc.pszText := LCLStringToPWideChar(ACaption);
|
lvc.pszText := LCLStringToPWideChar(ACaption);
|
||||||
ListView_SetColumn(ALV.Handle, AIndex, lvc);
|
ListView_SetColumn(ALV.Handle, AIndex, lvc);
|
||||||
@ -317,7 +317,7 @@ begin
|
|||||||
|
|
||||||
{$ifdef Win32}
|
{$ifdef Win32}
|
||||||
lvi.pszText := PChar(LCLStringToPWideChar(AItem.Caption));
|
lvi.pszText := PChar(LCLStringToPWideChar(AItem.Caption));
|
||||||
SendMessage(ALV.Handle, LVM_INSERTITEMW, 0, LPARAM(@lvi));
|
SendMessageW(ALV.Handle, LVM_INSERTITEMW, 0, LPARAM(@lvi));
|
||||||
{$else}
|
{$else}
|
||||||
lvi.pszText := LCLStringToPWideChar(AItem.Caption);
|
lvi.pszText := LCLStringToPWideChar(AItem.Caption);
|
||||||
ListView_InsertItem(ALV.Handle, lvi);
|
ListView_InsertItem(ALV.Handle, lvi);
|
||||||
@ -369,7 +369,7 @@ begin
|
|||||||
_gnu_lvi.iSubItem := ASubIndex;
|
_gnu_lvi.iSubItem := ASubIndex;
|
||||||
_gnu_lvi.pszText := PChar(PWideChar(Utf8Decode(AText)));
|
_gnu_lvi.pszText := PChar(PWideChar(Utf8Decode(AText)));
|
||||||
|
|
||||||
SendMessage(ALV.Handle, LVM_SETITEMTEXTW, WPARAM(AIndex), LPARAM(@_gnu_lvi));
|
SendMessageW(ALV.Handle, LVM_SETITEMTEXTW, WPARAM(AIndex), LPARAM(@_gnu_lvi));
|
||||||
{$else}
|
{$else}
|
||||||
tmpAText := LCLStringToPWideChar(AText);
|
tmpAText := LCLStringToPWideChar(AText);
|
||||||
ListView_SetItemText(ALV.Handle, AIndex, ASubIndex, tmpAText);
|
ListView_SetItemText(ALV.Handle, AIndex, ASubIndex, tmpAText);
|
||||||
|
@ -334,17 +334,17 @@ begin
|
|||||||
begin
|
begin
|
||||||
// retrieve page handle from tab as extra check (in case page isn't added yet).
|
// retrieve page handle from tab as extra check (in case page isn't added yet).
|
||||||
TCI.mask := TCIF_PARAM;
|
TCI.mask := TCIF_PARAM;
|
||||||
Windows.SendMessage(NotebookHandle, TCM_GETITEM, PageIndex, LPARAM(@TCI));
|
Windows.SendMessageW(NotebookHandle, TCM_GETITEMW, PageIndex, LPARAM(@TCI));
|
||||||
if PtrUInt(TCI.lParam)=PtrUInt(AWinControl) then
|
if PtrUInt(TCI.lParam)=PtrUInt(AWinControl) then
|
||||||
begin
|
begin
|
||||||
Assert(False, Format('Trace:TWinCEWSCustomPage.SetText --> %S', [AText]));
|
Assert(False, Format('Trace:TWinCEWSCustomPage.SetText --> %S', [AText]));
|
||||||
TCI.mask := TCIF_TEXT;
|
TCI.mask := TCIF_TEXT;
|
||||||
{$ifdef Win32}
|
{$ifdef Win32}
|
||||||
TCI.pszText := PChar(LCLStringToPWideChar(AText));
|
TCI.pszText := PChar(PWideChar(UTF8Decode(AText)));
|
||||||
{$else}
|
{$else}
|
||||||
TCI.pszText := LCLStringToPWideChar(AText);
|
TCI.pszText := PWideChar(UTF8Decode(AText));
|
||||||
{$endif}
|
{$endif}
|
||||||
Windows.SendMessage(NotebookHandle, TCM_SETITEMW, PageIndex, LPARAM(@TCI));
|
Windows.SendMessageW(NotebookHandle, TCM_SETITEMW, PageIndex, LPARAM(@TCI));
|
||||||
FreeMem(TCI.pszText);
|
FreeMem(TCI.pszText);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -399,13 +399,13 @@ begin
|
|||||||
begin
|
begin
|
||||||
TCI.Mask := TCIF_TEXT or TCIF_PARAM;
|
TCI.Mask := TCIF_TEXT or TCIF_PARAM;
|
||||||
{$ifdef Win32}
|
{$ifdef Win32}
|
||||||
TCI.pszText := PChar(LCLStringToPWideChar(AChild.Caption));
|
TCI.pszText := PChar(PWideChar(UTF8Decode((AChild.Caption))));
|
||||||
{$else}
|
{$else}
|
||||||
TCI.pszText := LCLStringToPWideChar(AChild.Caption);
|
TCI.pszText := PWideChar(UTF8Decode(AChild.Caption));
|
||||||
{$endif}
|
{$endif}
|
||||||
// store object as extra, so we can verify we got the right page later
|
// store object as extra, so we can verify we got the right page later
|
||||||
TCI.lParam := PtrUInt(AChild);
|
TCI.lParam := PtrUInt(AChild);
|
||||||
Windows.SendMessage(Handle, TCM_INSERTITEMW, AIndex, LPARAM(@TCI));
|
Windows.SendMessageW(Handle, TCM_INSERTITEMW, AIndex, LPARAM(@TCI));
|
||||||
FreeMem(TCI.pszText);
|
FreeMem(TCI.pszText);
|
||||||
// clientrect possible changed, adding first tab, or deleting last
|
// clientrect possible changed, adding first tab, or deleting last
|
||||||
// windows should send a WM_SIZE message because of this, but it doesn't
|
// windows should send a WM_SIZE message because of this, but it doesn't
|
||||||
@ -456,11 +456,11 @@ begin
|
|||||||
TCI.Mask := TCIF_TEXT or TCIF_PARAM;
|
TCI.Mask := TCIF_TEXT or TCIF_PARAM;
|
||||||
TCI.lParam := PtrUInt(lPage);
|
TCI.lParam := PtrUInt(lPage);
|
||||||
{$ifdef Win32}
|
{$ifdef Win32}
|
||||||
TCI.pszText := PChar(LCLStringToPWideChar(lPage.Caption));
|
TCI.pszText := PChar(PWideChar(UTF8Decode(lPage.Caption)));
|
||||||
{$else}
|
{$else}
|
||||||
TCI.pszText := LCLStringToPWideChar(lPage.Caption);
|
TCI.pszText := PWideChar(UTF8Decode(lPage.Caption));
|
||||||
{$endif}
|
{$endif}
|
||||||
Windows.SendMessage(WinHandle, TCM_INSERTITEMW, RealIndex, LPARAM(@TCI));
|
Windows.SendMessageW(WinHandle, TCM_INSERTITEMW, RealIndex, LPARAM(@TCI));
|
||||||
end;
|
end;
|
||||||
Inc(RealIndex);
|
Inc(RealIndex);
|
||||||
end;
|
end;
|
||||||
|
@ -262,6 +262,7 @@ begin
|
|||||||
pClassName := @ClsName;
|
pClassName := @ClsName;
|
||||||
FlagsEx := 0;
|
FlagsEx := 0;
|
||||||
Flags := WS_OVERLAPPEDWINDOW;
|
Flags := WS_OVERLAPPEDWINDOW;
|
||||||
|
WindowTitle := StrCaption;
|
||||||
lForm := TCustomForm(AWinControl);
|
lForm := TCustomForm(AWinControl);
|
||||||
CalcFormWindowFlags(lForm, Flags, FlagsEx);
|
CalcFormWindowFlags(lForm, Flags, FlagsEx);
|
||||||
SubClassWndProc := nil;
|
SubClassWndProc := nil;
|
||||||
|
@ -103,13 +103,10 @@ procedure UpdateFloatSpinEditText(const ASpinHandle: HWND; const ANewValue: sing
|
|||||||
var
|
var
|
||||||
editHandle: HWND;
|
editHandle: HWND;
|
||||||
newValueText: string;
|
newValueText: string;
|
||||||
pwnewValueText : PWideChar;
|
|
||||||
begin
|
begin
|
||||||
editHandle := GetBuddyWindow(ASpinHandle);
|
editHandle := GetBuddyWindow(ASpinHandle);
|
||||||
newValueText := FloatToStrF(ANewValue, ffFixed, 20, ADecimalPlaces);
|
newValueText := FloatToStrF(ANewValue, ffFixed, 20, ADecimalPlaces);
|
||||||
pwnewValueText := LCLStringToPWideChar(newValueText);
|
Windows.SendMessageW(editHandle, WM_SETTEXT, 0, Windows.LPARAM(PWideChar(UTF8Decode(newValueText))));
|
||||||
Windows.SendMessage(editHandle, WM_SETTEXT, 0, Windows.LPARAM(PWideChar(pwnewValueText)));
|
|
||||||
FreeMem(pwnewValueText);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class function TWinCEWSCustomFloatSpinEdit.CreateHandle(const AWinControl: TWinControl;
|
class function TWinCEWSCustomFloatSpinEdit.CreateHandle(const AWinControl: TWinControl;
|
||||||
@ -122,7 +119,11 @@ begin
|
|||||||
// customization of Params
|
// customization of Params
|
||||||
with Params do
|
with Params do
|
||||||
begin
|
begin
|
||||||
Buddy := CreateWindowExW(WS_EX_CLIENTEDGE, 'EDIT', StrCaption, Flags Or ES_AUTOHSCROLL, Left, Top, Width, Height, Parent, HMENU(Nil), HInstance, Nil);
|
Buddy := CreateWindowExW(WS_EX_CLIENTEDGE, 'EDIT',
|
||||||
|
PWideChar(UTF8Decode(StrCaption)),
|
||||||
|
Flags Or ES_AUTOHSCROLL,
|
||||||
|
Left, Top, Width, Height,
|
||||||
|
Parent, HMENU(Nil), HInstance, Nil);
|
||||||
{Window := CreateUpDownControl(Flags or DWORD(WS_BORDER or UDS_ALIGNRIGHT or UDS_ARROWKEYS),
|
{Window := CreateUpDownControl(Flags or DWORD(WS_BORDER or UDS_ALIGNRIGHT or UDS_ARROWKEYS),
|
||||||
0, 0, // pos - ignored for buddy
|
0, 0, // pos - ignored for buddy
|
||||||
0, 0, // size - ignored for buddy
|
0, 0, // size - ignored for buddy
|
||||||
|
@ -233,11 +233,8 @@ type
|
|||||||
protected
|
protected
|
||||||
public
|
public
|
||||||
class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
|
class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
|
||||||
class procedure DestroyHandle(const AWinControl: TWinControl); override;
|
|
||||||
class function GetText(const AWinControl: TWinControl; var AText: String): Boolean; override;
|
|
||||||
// class procedure SetDefault(const AButton: TCustomButton; ADefault: Boolean); override;
|
// class procedure SetDefault(const AButton: TCustomButton; ADefault: Boolean); override;
|
||||||
// class procedure SetShortcut(const AButton: TCustomButton; const OldShortcut, NewShortcut: TShortcut); override;
|
// class procedure SetShortcut(const AButton: TCustomButton; const OldShortcut, NewShortcut: TShortcut); override;
|
||||||
class procedure SetText(const AWinControl: TWinControl; const AText: String); override;
|
|
||||||
// class procedure GetPreferredSize(const AWinControl: TWinControl;
|
// class procedure GetPreferredSize(const AWinControl: TWinControl;
|
||||||
// var PreferredWidth, PreferredHeight: integer); override;
|
// var PreferredWidth, PreferredHeight: integer); override;
|
||||||
end;
|
end;
|
||||||
@ -771,16 +768,15 @@ end;
|
|||||||
class procedure TWinCEWSCustomComboBox.SetText(const AWinControl: TWinControl; const AText: string);
|
class procedure TWinCEWSCustomComboBox.SetText(const AWinControl: TWinControl; const AText: string);
|
||||||
var
|
var
|
||||||
Handle: HWND;
|
Handle: HWND;
|
||||||
pwAText : pWideChar;
|
pwAText: widestring;
|
||||||
begin
|
begin
|
||||||
Assert(False, Format('Trace:TWinCEWSCustomComboBox.SetText --> %S', [AText]));
|
Assert(False, Format('Trace:TWinCEWSCustomComboBox.SetText --> %S', [AText]));
|
||||||
Handle := AWinControl.Handle;
|
Handle := AWinControl.Handle;
|
||||||
pwAText := LCLStringToPWideChar(AText);
|
pwAText := UTF8Decode(AText);
|
||||||
if TCustomComboBox(AWinControl).ReadOnly then
|
if TCustomComboBox(AWinControl).ReadOnly then
|
||||||
Windows.SendMessage(Handle, CB_SELECTSTRING, -1, LPARAM(pwAText))
|
Windows.SendMessageW(Handle, CB_SELECTSTRING, -1, LPARAM(PWideChar(pwAText)))
|
||||||
else
|
else
|
||||||
Windows.SendMessage(Handle, WM_SETTEXT, 0, LPARAM(pwAText));
|
Windows.SendMessageW(Handle, WM_SETTEXT, 0, LPARAM(PWideChar(pwAText)));
|
||||||
FreeMem(pwAText);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class function TWinCEWSCustomComboBox.GetItems(const ACustomComboBox: TCustomComboBox): TStrings;
|
class function TWinCEWSCustomComboBox.GetItems(const ACustomComboBox: TCustomComboBox): TStrings;
|
||||||
@ -982,12 +978,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
class procedure TWinCEWSCustomMemo.SetText(const AWinControl: TWinControl; const AText: string);
|
class procedure TWinCEWSCustomMemo.SetText(const AWinControl: TWinControl; const AText: string);
|
||||||
var
|
|
||||||
tmpWideStr : PWideChar;
|
|
||||||
begin
|
begin
|
||||||
tmpWideStr := LCLStringToPWideChar(AText);
|
SendMessageW(AWinControl.Handle, WM_SETTEXT, 0, LPARAM(PWideChar(UTF8Decode(AText))));
|
||||||
SendMessage(AWinControl.Handle, WM_SETTEXT, 0, LPARAM(PWideChar(tmpWideStr)));
|
|
||||||
FreeMem(tmpWideStr);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class procedure TWinCEWSCustomMemo.SetWordWrap(const ACustomMemo: TCustomMemo; const NewWordWrap: boolean);
|
class procedure TWinCEWSCustomMemo.SetWordWrap(const ACustomMemo: TCustomMemo; const NewWordWrap: boolean);
|
||||||
@ -1021,7 +1013,7 @@ begin
|
|||||||
with Params do
|
with Params do
|
||||||
begin
|
begin
|
||||||
pClassName := @LabelClsName;
|
pClassName := @LabelClsName;
|
||||||
WindowTitle := LCLStringToPWideChar(AWinControl.Caption);//roozbeh..we already have this in strcaptiob..whats the diffrence?
|
WindowTitle := StrCaption;
|
||||||
Flags := WS_CHILD or WS_VISIBLE or WS_TABSTOP or SS_LEFT;//Flags or CalcStaticTextFlags(TCustomStaticText(AWinControl).Alignment);//is ws_child included?
|
Flags := WS_CHILD or WS_VISIBLE or WS_TABSTOP or SS_LEFT;//Flags or CalcStaticTextFlags(TCustomStaticText(AWinControl).Alignment);//is ws_child included?
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1079,7 +1071,7 @@ begin
|
|||||||
// Flags := Flags or BS_PUSHBUTTON;
|
// Flags := Flags or BS_PUSHBUTTON;
|
||||||
Flags := WS_CHILD or WS_VISIBLE;
|
Flags := WS_CHILD or WS_VISIBLE;
|
||||||
pClassName := @ButtonClsName;
|
pClassName := @ButtonClsName;
|
||||||
WindowTitle := LCLStringToPWideChar(StrCaption);
|
WindowTitle := StrCaption;
|
||||||
Left := AWinControl.Left;
|
Left := AWinControl.Left;
|
||||||
Top := AWinControl.Top;
|
Top := AWinControl.Top;
|
||||||
Width := AWinControl.Width;
|
Width := AWinControl.Width;
|
||||||
@ -1102,44 +1094,6 @@ begin
|
|||||||
{$endif}
|
{$endif}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
|
||||||
Function: TWinCEWSButton.DestroyHandle
|
|
||||||
Params: None
|
|
||||||
Returns: Nothing
|
|
||||||
------------------------------------------------------------------------------}
|
|
||||||
class procedure TWinCEWSButton.DestroyHandle(const AWinControl: TWinControl);
|
|
||||||
begin
|
|
||||||
end;
|
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
|
||||||
Function: TWinCEWSButton.GetText
|
|
||||||
Params: None
|
|
||||||
Returns: Nothing
|
|
||||||
------------------------------------------------------------------------------}
|
|
||||||
class function TWinCEWSButton.GetText(const AWinControl: TWinControl; var AText: String): Boolean;
|
|
||||||
var
|
|
||||||
tmpStr : PWideChar;
|
|
||||||
begin
|
|
||||||
tmpstr := PWideChar(SysAllocStringLen(nil,256));
|
|
||||||
Result := Boolean(Windows.GetWindowTextW(AWinControl.Handle,tmpStr,256));
|
|
||||||
AText := String(tmpStr);
|
|
||||||
SysFreeString(tmpStr);
|
|
||||||
end;
|
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
|
||||||
Function: TWinCEWSButton.SetText
|
|
||||||
Params: None
|
|
||||||
Returns: Nothing
|
|
||||||
------------------------------------------------------------------------------}
|
|
||||||
class procedure TWinCEWSButton.SetText(const AWinControl: TWinControl; const AText: String);
|
|
||||||
var
|
|
||||||
tmpStr : PWideChar;
|
|
||||||
begin
|
|
||||||
tmpstr := LCLStringToPWideChar(AText);
|
|
||||||
Windows.SetWindowTextW(AWinControl.Handle, tmpStr);
|
|
||||||
FreeMem(tmpStr);
|
|
||||||
end;
|
|
||||||
|
|
||||||
{ TWinCEWSCustomCheckBox }
|
{ TWinCEWSCustomCheckBox }
|
||||||
|
|
||||||
class function TWinCEWSCustomCheckBox.CreateHandle(const AWinControl: TWinControl;
|
class function TWinCEWSCustomCheckBox.CreateHandle(const AWinControl: TWinControl;
|
||||||
@ -1156,7 +1110,7 @@ begin
|
|||||||
with Params do
|
with Params do
|
||||||
begin
|
begin
|
||||||
pClassName := @ButtonClsName;
|
pClassName := @ButtonClsName;
|
||||||
WindowTitle := LCLStringToPWideChar(AWinControl.Caption);
|
WindowTitle := StrCaption;
|
||||||
if TCustomCheckBox(AWinControl).AllowGrayed then
|
if TCustomCheckBox(AWinControl).AllowGrayed then
|
||||||
Flags := Flags Or BS_AUTO3STATE
|
Flags := Flags Or BS_AUTO3STATE
|
||||||
else
|
else
|
||||||
@ -1164,7 +1118,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
// create window
|
// create window
|
||||||
FinishCreateWindow(AWinControl, Params, false);
|
FinishCreateWindow(AWinControl, Params, false);
|
||||||
FreeMem(Params.WindowTitle);
|
|
||||||
Result := Params.Window;
|
Result := Params.Window;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user