Maskedit usage problems lazarus / 10-Designer ---------------------------------------------------------------------- szlbz · 2022-05-30 08:29 Linux (raspberry OS and other systems with Chinese) uses maskedit and other controls with editmask. When the mask contains / or: (9999/99/; 1; \u) Garbled code occurs during form design, and the compiled program runs normally. ---------------------------------------------------------------------- Bart · 2022-05-30 09:04 The '/' is supposed to be replaced with DefaultFormatSettings.DateSeparator. The IDE may have problems with that on your Pi? Just guessing. Whay happens if you change '/' by either '\/' (escape it with a backslash, if you want a literal '/') or e.g. by '-'? Bart ---------------------------------------------------------------------- szlbz · 2022-05-30 11:24 Quote from: Bart on May 30, 2022, 11:04:51 amThe '/' is supposed to be replaced with DefaultFormatSettings.DateSeparator. The IDE may have problems with that on your Pi? Just guessing. Whay happens if you change '/' by either '\/' (escape it with a backslash, if you want a literal '/') or e.g. by '-'? Bart The same problem occurs when using Ubuntu 20.04.4 LTS、LMDE 5 Elsie. It is normal to use other characters ---------------------------------------------------------------------- szlbz · 2022-05-30 11:26 use lazarus 2.2.2 ---------------------------------------------------------------------- Bart · 2022-05-30 15:52 Please report in the bugtracker (with screenshots). Bart ---------------------------------------------------------------------- szlbz · 2022-05-31 02:02 Hello  Bart,由于是设计时的显示Bug,debug不了IDE Bug,不过发现是MaskEdit.pp的function TCustomMaskEdit.ClearChar(Position : Integer) : TUtf8Char; Because it is a design time display bug, the IDE bug cannot be debugged, but it is found in maskedit Function tcustommaskedit Clearchar (position: integer): tutf8char; Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i function TCustomMaskEdit.ClearChar(Position : Integer) : TUtf8Char;begin  //For Delphi compatibilty, only literals remain, all others will be blanked  case GetMask(Position).MaskType Of    {Char_Space               : Result := #32; //FSpaceChar?; //not Delphi compatible, see notes above}    Char_HourSeparator        : Result := DefaultFormatSettings.TimeSeparator;//<---     Char_DateSeparator      : Result := DefaultFormatSettings.DateSeparator;//<----    Char_IsLiteral            : Result := FMask[Position].Literal; //No need to use GetMask, FMask[Position] already has been validated    otherwise      Result := FSpaceChar;  end;end;  modi: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i     Char_HourSeparator        : Result := ':';//DefaultFormatSettings.TimeSeparator;     Char_DateSeparator      : Result := '/';//DefaultFormatSettings.DateSeparator; 然后重新编译lazarus ,设计时显示就正常了,不清楚为什么设计时DefaultFormatSettings.DateSeparator为什么会出现问题。 Then recompile Lazarus, and the design time display will be normal. It is not clear why there are problems in the design time. thanks! ---------------------------------------------------------------------- Bart · 2022-05-31 08:13 That is not a fix but a workaround for your specific problem. As by desing '/' and ':' have special meaning in TMaskEdit and must be replaced with DateSeparator and TimeSeparator respectively in the text. The IDE can be debugged as wel: open the lazarus.lpi project in Lazarus, build and run it. (OK, sounds easy, but it's really not that simple). As asked before: please file a bugreport in the bugtracker. Bart ---------------------------------------------------------------------- szlbz · 2022-05-31 08:49 yes,That is not a fix。 ---------------------------------------------------------------------- szlbz · 2022-06-01 03:49 IDE debugging is difficult. I use another method to temporarily solve my problem. Open ide/lazarus.pp, add 2 lines ide调试有难度,采用另一种方法暂时解决我的问题,打开ide/lazarus.pp, 添加2行 Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i {$I revision.inc}{$R lazarus.res}{$R ../images/laz_images.res} begin  Max_Frame_Dump:=32; // the default 8 is not enough  DefaultFormatSettings.DateSeparator:='-';//2022.6.1  修复mask字符串包含/:时乱码的Bug  DefaultFormatSettings.TimeSeparator:=':';//2022.6.1  修复mask字符串包含/:时乱码的Bug ---------------------------------------------------------------------- Bart · 2022-06-01 09:08 Again: please open a ticket in the bugtracker. Then at least somebody familiar with the IDE and the widgetset involved can have a look at it. It's your only chace of getting this fixed properly. Bart ---------------------------------------------------------------------- szlbz · 2022-06-02 02:16 https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/39781 ---------------------------------------------------------------------- szlbz · 2022-06-02 08:01 刚debug发现是fpc 单元fpcsrc/packages/rtl- extra/src/unix/clocale.pp引起的,按以下方法修改就可以返回正确的分隔字符。 It has just been found in the debug that it is caused by the fpcsrc/packages/rtl-extra/src/unix/clocale.pp of the FPC unit, modify: function FindSeparator(const s: string; Def: char): char; can return the correct separator character. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   function FindSeparator(const s: string; Def: char): utf8char;  var    i: integer;    ss:string;  begin    FindSeparator := Def;    i := Pos('%', s);    if i=0 then      Exit;    inc(i);    SkipModifiers(s, i);    inc(i);    //if i<=Length(s) then    //  FindSeparator:=s[i];  if i<=Length(s) then      ss:=UTF8Copy(s,i,1);    if (ss='年') or (ss='月') or (ss='日') then      FindSeparator :='-'    ELSE      if (ss='时') or (ss='分') or (ss='秒') then        FindSeparator :=':'    else      FindSeparator:=s[i];  end; ---------------------------------------------------------------------- Bart · 2022-06-02 10:09 Ok, if the bug is in FPC, then file a bugreport in the FPC bugtracker please. Bart ---------------------------------------------------------------------- szlbz · 2022-06-02 11:09 Quote from: Bart on June 02, 2022, 12:09:57 pmOk, if the bug is in FPC, then file a bugreport in the FPC bugtracker please. Bart https://gitlab.com/freepascal.org/fpc/source/-/issues/39756