On 2006-04-29 at 05:43,
Felipe Monteiro de Carvalho ([EMAIL PROTECTED]) wrote:
> Here you just need to submit a patch and all your problems are solved
> =) And they will also be solved for others that need this on the
> future.
Yes, I agree and understand.
My problem is (apart of all the usual excuses of not having
enough time etc etc) that, although using Pascal for many
many years, I am a newbie in the low level area of run time
libraries.
Nevertheless, I tried to get some look inside the hub...
Maybe you could help/suggest about the following:
In C:\Lazarus\lcl\interfaces\win32\Win32WSStdCtrls.pp I come
to this:
function TWin32WSCustomEdit.GetText(const AWinControl: TWinControl; var AText:
string): boolean;
begin
Result := AWinControl.HandleAllocated;
if not Result then
exit;
AText := GetControlText(AWinControl.Handle);
end;
then in C:\Lazarus\lcl\interfaces\win32\Win32proc.pp
I come to this:
function GetControlText(AHandle: HWND): string;
var
TextLen: dword;
begin
TextLen := GetWindowTextLength(AHandle);
SetLength(Result, TextLen);
GetWindowText(AHandle, PChar(Result), TextLen + 1);
end;
from where GetWindowText leads apparently to the fpc-level
and to C:\Lazarus\fpcsrc\rtl\win32\wininc\ascdef.inc,
where one finds Windows ansii calls, for instance:
function GetWindowText(hWnd:HWND; lpString:LPSTR; nMaxCount:longint):longint;
external 'user32' name 'GetWindowTextA';
Now, if I want to get a Unicode string from Windows, I have
to use
function GetWindowText(hWnd:HWND; lpString:LPWSTR; nMaxCount:longint):longint;
external 'user32' name 'GetWindowTextW';
which indeed is to be found in
C:\Lazarus\fpcsrc\rtl\win32\wininc\unidef.inc.
Now, in my understanding, which might very well be wrong, a
widget should obtain Unicode (=WideString) from the Windows
(via GetWindowTextW), convert it to UTF8 and give it further
to lcl-level. In this way, the basic concept of UTF8 as
internal lingua franca would be maintained (albeit on the
expense of unnecessary transformations under WinNT+).
If all this is correct, I believe that it means that inside
of the fpc rtl there should be a discriminating unit, which
would, for instance define GetWindowText in terms of both
GetWindowTextA and GetWindowTextW (i.e using both ascfun.inc
and unifun.inc), depending on weather the run time Windows
is Unicode enabled (WinNT+) or not.
It is only when this would be available, that one could
think further in terms of Lazarus Unicode-enabled widgets
for win32.
Do I see this in a correct way? Any corrections, suggestions and
direction pointing would be very welcome.
Thanks,
Borut
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives