[Lazarus] Edti's password char with bug?
William Oliveira Ferreira
bdexterholland at gmail.com
Wed Aug 10 22:29:15 CEST 2011
But that code runs under GTK2 and i have this problem on Windows Seven Home
Basic (Where i tested), at night (now here is 05:28 PM) i'll test it on
my Debian 6/Gnome 2
________________________________
William de Oliveira Ferreira
Bacharel em Sistemas de Informação
2011/8/10 Gerard Visent <gerardusmercator at gmail.com>
> Hi Martin,
>
>>
>> Hm, on my system 158 results in a "z" with some tilde or accent.
>>
>
> Same here.
>
>
>>
>> But that is probably the correct behaviour.
>>
>> For some reason the PassWordchar field accepts an ansi char, rather than a
>> utf8 char. So what you will see depends on the codepage of the system on
>> which your app is run. Even if it displays fine on your PC, if you ship the
>> app, other people will see other chars.
>>
>> How or why it becomes an * I do not know...
>>
>
> I found why, but I can't explain the reason behind the code.
> In lcl/interfaces/gtk2/gtk2wsstdctrls :
>
> class procedure TGtk2WSCustomEdit.SetPasswordChar(
> const ACustomEdit: TCustomEdit; NewChar: char);
> var
> PWChar: Integer;
> Entry: PGtkEntry;
> begin
> if not WSCheckHandleAllocated(ACustomEdit, 'SetPasswordChar') then
> Exit;
> Entry := PGtkEntry(ACustomEdit.Handle);
> if ACustomEdit.EchoMode=emNone then
> PWChar:=0
> else begin
> PWChar:=ord(ACustomEdit.PasswordChar);
> if (PWChar<192) or (PWChar=ord('*')) then
> PWChar:=9679;
> end;
> gtk_entry_set_invisible_char(Entry,PWChar);
> end;
>
> Commenting the following lines
>
> if (PWChar<192) or (PWChar=ord('*')) then
> PWChar:=9679;
>
> allows to display any char. But there must be a reason for this check and
> whoever wrote didn't bother writing a comment.
>
> Regards,
>
> Gerard.
>
>
>
>>
>> --
>> _______________________________________________
>> Lazarus mailing list
>> Lazarus at lists.lazarus.freepascal.org
>> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>>
>>
>
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20110810/634a6baa/attachment-0003.html>
More information about the Lazarus
mailing list