Recent

Author Topic: Lazarus 1.6 - 1st Release Candidate  (Read 116520 times)

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
Re: Lazarus 1.6 - 1st Release Candidate
« Reply #120 on: December 29, 2015, 10:19:09 pm »
This works in at least XE7 and XE8: CharInSet(Ch,['å','ä','ö'])

Afaik this works fine in D2009+ mode, $Mode delphiunicode

jwdietrich

  • Hero Member
  • *****
  • Posts: 1232
    • formatio reticularis
Re: Lazarus 1.6 - 1st Release Candidate
« Reply #121 on: December 29, 2015, 10:45:32 pm »
Today I tested Lazarus 1.6RC1 and FPC 3.0 on Mac OS X (10.11 El Capitan).

The good news is that all my complete programs compile and run flawlessly, although some of them are rather big projects.

The bad news is that I have problems with fpcunit. I prefer test-driven development, but all unit test projects fail right in the beginning with the error message Unable to create file "<project>.fpcunit.ini". (see attachment for an example).

I do unit testing with fpcunit for years now, but I was never aware of any .ini file. How can I get fpcunit to create one - or can I completely switch off this functionality? I am even not sure, if this is an issue with Lazarus 1.6RC1 or with FPC 3.0.

Edit:

In the meanwhile I found out that this is a Lazarus issue. It results from a line that has been inserted in the unit file guitestrunner.pas. I created a bug report (# 29283) and uploaded a patch there, which resolves the issue on Mac OS X.

Lazarus 1.6RC1 runs like a charm now. :)
« Last Edit: December 30, 2015, 12:31:47 am by jwdietrich »
function GetRandomNumber: integer; // xkcd.com
begin
  GetRandomNumber := 4; // chosen by fair dice roll. Guaranteed to be random.
end;

http://www.formatio-reticularis.de

Lazarus 2.2.6 | FPC 3.2.2 | PPC, Intel, ARM | macOS, Windows, Linux

jarto

  • Full Member
  • ***
  • Posts: 106
Re: Lazarus 1.6 - 1st Release Candidate
« Reply #122 on: December 30, 2015, 02:23:39 am »
This works in at least XE7 and XE8: CharInSet(Ch,['å','ä','ö'])

Afaik this works fine in D2009+ mode, $Mode delphiunicode

No, it doesn't compile. WideChars are not allowed in the set.

jarto

  • Full Member
  • ***
  • Posts: 106
Re: Lazarus 1.6 - 1st Release Candidate
« Reply #123 on: December 30, 2015, 07:43:08 pm »
I tested the CharInSet-problem a bit more:

Both Delphi and FPC have the same type for the set:

type TSysCharSet = set of AnsiChar;

With Delphi I can use these special characters in the set: ['å','ä','ö']. It compiles and works.
FPC doesn't let it compile as those letters are compiled to widechars.

This could be used as a workaround; it compiles, and works in Delphi, but gives wrong results in FPC: [AnsiChar('å'),AnsiChar('ä'),AnsiChar('ö')]

ord(WideChar('å')) = 229 in Delphi and 229 in FPC
ord(AnsiChar('å')) = 229 in Delphi, but 63 in FPC

Ondrej Pokorny

  • Full Member
  • ***
  • Posts: 220
Re: Lazarus 1.6 - 1st Release Candidate
« Reply #124 on: December 30, 2015, 10:35:04 pm »
With Delphi I can use these special characters in the set: ['å','ä','ö']. It compiles and works.

It compiles in Delphi but it won't work if ['å','ä','ö'] are not in current ansi encoding. So if your user runs e.g. russian OS, it won't work and you'll have a bug.

Don't do it either in FPC or in Delphi. Use case instead. As a plus case is even faster than "in [...]".

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 1228
Re: Lazarus 1.6 - 1st Release Candidate
« Reply #125 on: December 31, 2015, 12:29:40 am »
hello,
for this problem :
Quote
This works in at least XE7 and XE8: CharInSet(Ch,['å','ä','ö'])

Is it a bad idea to create this function  ? :
Code: Pascal  [Select][+][-]
  1.   function StringInSet(UniChr:String; CharArray:array of String):Boolean;
  2.   var i:Integer;
  3.   begin
  4.     for i:=0 to High(CharArray) do
  5.       if CharArray[i] = UniChr then
  6.       begin
  7.         Result := True;
  8.         Exit;
  9.       end;
  10.     Result := False;
  11.   end;

Example of use :
Code: Pascal  [Select][+][-]
  1. var Ch : String;
  2. begin
  3. //Ch := 'é';
  4. Ch := 'å';
  5. if StringInSet(Ch,['å','ä','ö']) then writeln('char is in set');
  6. readln();    
  7. end;
  8.  
  :-X
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

lazie

  • New member
  • *
  • Posts: 9
Re: Lazarus 1.6 - 1st Release Candidate
« Reply #126 on: December 31, 2015, 09:16:19 am »
TDBGRID is not triggering all ONSELECTEDITOR-events

Got a problem with this new version. - I am using TDBGRID and its ONSELECTEDITOR-event to use TEDIT as a replacement for the grids cell-editor. - Its working fine with prior versions (The position of the editor-rect ist given from - DbGrid.SelectedFieldRect).

The NEW VERSION does NOT fire the ONSELECTEDITOR-event when entering a cell by KEYBOARD. But everything ist allright when entering a cell by MOUSE.
When a cell is entered by keyboard the onselecteditor event is ONLY triggered - after one has CHANGED the cell-text (thats not enough ;-)).

With Lazarus 1.4.4 its allright:
ONSELECTEDITOR is fired - EACH TIME when EDITORMODE is going to true (one is editing).

Where should the bug being reported ?

mantis.freepascal.org

I have the same problem with onSelectEditor. I send the problem to mantis.freepascal.org

The problem is in the file grids.pas, in line 7155 after MoveSelection, in previous version call always to SelectEditor. And New version of the file only call if option dgAlwaysShowEditor is set to true.

Yes, moving of "SelectEditor;" to directly after "MoveSelection;" (BEFORE if-statement) leads to calling ONSELECTEDITOR as before (when selecting a cell by keyboard).

(...I made a MISTAKE when I said with R1.4.4 (or before) - the event would be fired each time EDITORMODE was going to true. - SELECTING a cell with keyboard (or mouse) leads to ONSELECTEDITOR-Event with R1.4.4 (or before).)
« Last Edit: January 14, 2016, 04:19:26 am by lazie »

Ondrej Pokorny

  • Full Member
  • ***
  • Posts: 220
Re: Lazarus 1.6 - 1st Release Candidate
« Reply #127 on: December 31, 2015, 01:30:00 pm »
hello,
for this problem :
Quote
This works in at least XE7 and XE8: CharInSet(Ch,['å','ä','ö'])

Is it a bad idea to create this function  ? :
Code: Pascal  [Select][+][-]
  1.   function StringInSet(UniChr:String; CharArray:array of String):Boolean;
  2.   var i:Integer;
  3.   begin
  4.     for i:=0 to High(CharArray) do
  5.       if CharArray[i] = UniChr then
  6.       begin
  7.         Result := True;
  8.         Exit;
  9.       end;
  10.     Result := False;
  11.   end;

Example of use :
Code: Pascal  [Select][+][-]
  1. var Ch : String;
  2. begin
  3. //Ch := 'é';
  4. Ch := 'å';
  5. if StringInSet(Ch,['å','ä','ö']) then writeln('char is in set');
  6. readln();    
  7. end;
  8.  
  :-X

It's OK unless you need some performance from StringInSet. The string/array approach is very slow.

Robert W.B.

  • Sr. Member
  • ****
  • Posts: 328
  • Love my Wife, My Kids and Lazarus/Freepascal.
Re: Lazarus 1.6 - 1st Release Candidate
« Reply #128 on: December 31, 2015, 08:39:47 pm »
Happy New Year 2016 to the Devolpment team. O:-)
From robbanux
Rob

melwinek

  • Jr. Member
  • **
  • Posts: 60
Re: Lazarus 1.6 - 1st Release Candidate
« Reply #129 on: January 05, 2016, 08:26:31 pm »
When I connect to UTF8 database by SQLdb, international characters in DBGrid not shown correctly.
In 1.4.4 all is ok.

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 1228
Re: Lazarus 1.6 - 1st Release Candidate
« Reply #130 on: January 05, 2016, 10:50:45 pm »
hello,
melwinek 
1 - What is your O.S ?
2 - Database  DBMS (ie : Sqlite, mySQL, postgresql, firebird, mssql server ...) ?
3 - Components used ( ie : TSqlTransaction, TSqlQuery, TxxxConnection ...) ?
4 - If you use TxxxConnection , Charset parameter ?

with Lazarus version 1.6RC1 , i have no problem with a postgresql database 9.3, TSqlquery, TSqlTransaction, TPQconnection (charset empty) components.
Database definition :
Code: MySQL  [Select][+][-]
  1. CREATE DATABASE dvdrental
  2.   WITH OWNER = openpg
  3.        ENCODING = 'UTF8'
  4.        TABLESPACE = pg_default
  5.        LC_COLLATE = 'French_France.1252'
  6.        LC_CTYPE = 'French_France.1252'
  7.        CONNECTION LIMIT = -1;
  8.  

Friendly, J.P
« Last Edit: January 05, 2016, 11:05:29 pm by Jurassic Pork »
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

melwinek

  • Jr. Member
  • **
  • Posts: 60
Re: Lazarus 1.6 - 1st Release Candidate
« Reply #131 on: January 05, 2016, 10:53:18 pm »
1 - Windows 7
2 - PostgreSQL
3 - TSQL Transaction, TSQLQuery, TPQConnection
4 - PQConnection1.CharSet:='utf8';

IMHO, this is a problem with SQLdb, not with DBGrid. When i write to PostgresSQL, in database (i check by PgPHPAdmin) is only fragments. E.g "Naro" instead "Narożnik".
"ż" is Polish letter.
« Last Edit: January 05, 2016, 11:04:35 pm by melwinek »

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 1228
Re: Lazarus 1.6 - 1st Release Candidate
« Reply #132 on: January 05, 2016, 11:07:13 pm »
see my old message ( i have changed it) and try charset empty. Show me your database definition
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

melwinek

  • Jr. Member
  • **
  • Posts: 60
Re: Lazarus 1.6 - 1st Release Candidate
« Reply #133 on: January 05, 2016, 11:40:12 pm »
With charset empty it's the same.

My database (PostgreSQL 9.3.5) definition:
Code: MySQL  [Select][+][-]
  1.   WITH OWNER = postgres
  2.     ENCODING = 'UTF8'
  3.     TABLESPACE = pg_default
  4.     LC_COLLATE = 'pl_PL.UTF-8'
  5.     LC_CTYPE = 'pl_PL.UTF-8';
  6.  

I found the problem.
Property charset not working;
If I execute at the beginning

Code: Pascal  [Select][+][-]
  1. SQLQuery1.Active := False;
  2. SQLQuery1.SQL.Clear;
  3. SQLQuery1.SQL.Add('SET NAMES ''UTF8''');
  4. SQLQuery1.ExecSQL;
  5.  


Then it works.
I have already met with this problem a long time ago. In a very previous version of Lazarus.

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 1228
Re: Lazarus 1.6 - 1st Release Candidate
« Reply #134 on: January 06, 2016, 12:10:08 am »
the parameter client_encoding  of my postgresql server has actually for value Unicode (alias UTF8) . Maybe it's for that
i have no problem with no ascii characters. Check this parameter in your server.

There are changes between fpc 2.6.4 and fpc 3.0.0 in the file pqconnection.pp ( fpc\3.0.0\source\packages\fcl-db\src\sqldb\postgres )
check the function TPQConnection.StartImplicitTransaction  near

Code: Pascal  [Select][+][-]
  1.  PQsetClientEncoding(tr.PGConn, pchar(CharSet));
« Last Edit: January 06, 2016, 12:31:22 am by Jurassic Pork »
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

 

TinyPortal © 2005-2018