Recent

Author Topic: ANN: KGrid 1.4  (Read 33318 times)

tk

  • Sr. Member
  • ****
  • Posts: 388
ANN: KGrid 1.4
« on: October 02, 2009, 11:54:46 am »
Hi,
I've released a major update for KGrid. Some new features:
-it has now full Lazarus support - all official and beta state widget sets, tested in Win32, GTK, GTK2, QT, others not tested yet (please help)
-it has new data aware TKDBGrid control
-versatile cell merging and splitting
-smooth scrolling
-extended TKGrid demo, new TKDBGrid demo (ADO connection in Delphi, ODBC connection in Lazarus)
-it remains FWS

You can see new screenshots and download the archive from:
http://www.tkweb.eu/en/delphicomp/kgrid.html

Please read the readme file before using it.

DRIGUS

  • Jr. Member
  • **
  • Posts: 62
Re: ANN: KGrid 1.4
« Reply #1 on: October 02, 2009, 03:34:05 pm »
Hi.

  I tested KGrid on an ARM Windows CE 6 device (not Windows Mobile). Lazarus version info:

  Lazarus 0.9.29 r21694  / FPC 2.2.4


  There was no problem installing the package in lazarus, but I had to modify the source in order to compile the demo:

Code: [Select]
...\kgrid\source\kfunctions.pas(328,11) Error: Function is already declared Public/Forward "Exchange(var Double,var Double);"
...\kgrid\source\kfunctions.pas(388,10) Error: Function is already declared Public/Forward "MinMax(Double, Double, Double):Double;"

  Seems to be a problem with overloaded functions - or are double and extended the same data type? I just commented them out. The next few errors where because of missing declarations regarding the Win CE WidgetSet.

Code: [Select]
...\kgrid\source\kfunctions.pas(454,28) Error: Identifier not found "TME_LEAVE"
...\kgrid\source\kfunctions.pas(456,36) Error: Identifier not found "HOVER_DEFAULT"
...\kgrid\source\kfunctions.pas(457,20) Error: Identifier not found "TrackMouseEvent"

...\kgrid\source\kgraphics.pas(683,22) Error: Identifier not found "GetViewPortOrgEx"
...\kgrid\source\kgraphics.pas(1257,41) Error: Identifier not found "WS_EX_LAYERED"
...\kgrid\source\kgraphics.pas(1329,29) Error: Identifier not found "AC_SRC_OVER"
...\kgrid\source\kgraphics.pas(1334,7) Error: Identifier not found "AC_SRC_ALPHA"
...\kgrid\source\kgraphics.pas(1388,77) Error: Identifier not found "ULW_ALPHA"

  GetViewPortOrgEx should be supportet in Windows CE 5 and higher, about the rest I got no further information. Just commented them out, too.

  After this few changes I could compile kgriddemolaz but run into some problems while executing it on the mentioned device: First the grid cells were empty, there was no text unless I started editing a cell. This could be an API related problem since Windows CE uses WideChar only.
 Second there was a memory problem when I press the button labeled "Add 5000 rows" - the application consumed to much program memory and crashed.
  And third the grid reacted very though on the device (Samsung ARM9 with 400 MHz).


  I really searching an flexible alternative to VirtualTrees under Delphi, since both conversions on the Lazarus Code and Component Repository aren't working on Windows CE (I tried latest SVN this week) without changes. So don't hesitate to contact me if I should test it again.


Greets,
  Björn
« Last Edit: October 02, 2009, 03:46:51 pm by DRIGUS »
DRIGUS GmbH

tk

  • Sr. Member
  • ****
  • Posts: 388
Re: ANN: KGrid 1.4
« Reply #2 on: October 02, 2009, 05:17:04 pm »
Thanks DRIGUS very much for testing on a WinCE device.

Because I have no real WinCE device, all I'm capable to do is to compile on Win32 for the WinCE target. If I compile with the minimum supported Lazarus snapshot (as stated in the readme) and FPC 2.2.4 I get no such error messages. I recently downloaded the WinCE emulator but I cannot run the compiled WinCE executable here, it shows some message that says some library is missing. Question: What I'm missing? Another question: The WinCE emulator is terribly SLOW. Is there a faster emulator for Windows or Linux? I would like to test under my old good Windows XP.

The thing with overloaded functions seems to be a fpc/rtl/wince problem (I'm not 'accomodating' to this). Maybe I use newer rtl revision.
The missing identifiers for older Lazarus versions can be solved by adapting the USE_WINAPI directive in kcontrols.inc. Just delete the entry 'Defined(LCLWinCE)'.
If the grid cells are empty it might be due to the clipping or TextOut bugs in WinCE widget set. Some deeper testing is required. E.g. try to comment out all SelectClipRgn calls and the SetWindowRgn call. Or replace TextOut with Canvas.TextOut etc.
I don't know how much memory there is on your WinCE device, on Win32 5000 rows consume some 23MB and 10000 some 40MB.

Slow painting is generous problem. Now the grid paints fast on Win32 and GTK. GTK2 is little bit slower but it is still acceptable (at least for me). QT is sometimes very slow but I've tested on QT4Win only. I don't know why this happens. It all seems to be a problem with the respective widget set or target (RTL/LCL). Maybe also it is the problem because double buffering is turned on in every demo. Try turning it off.

Also keep in mind that WinCE etc. are still beta state widget sets. While porting to Lazarus I reported some 8 bugs mainly widget set oriented (even for the "stable" GTK) and they were even not all I've discovered.


DRIGUS

  • Jr. Member
  • **
  • Posts: 62
Re: ANN: KGrid 1.4
« Reply #3 on: October 02, 2009, 05:54:36 pm »
Hi tk.

  (Btw, DRIGUS is the name of the firm I'm working for :D).

  Thanks for your answer. And just take my first post as it is - some useful information - and not as criticism :). I can only imagine how much effort you put in this nice piece of work.


I recently downloaded the WinCE emulator but I cannot run the compiled WinCE executable here, it shows some message that says some library is missing.

  Which emulator, which library?
  My local installed Windows CE 5 emulator from Microsoft emulates an i486, AFAIK Lazarus is not capable to generate suitable executables without modifying the environment.


Quote
The WinCE emulator is terribly SLOW. Is there a faster emulator for Windows or Linux? I would like to test under my old good Windows XP.

  There are some Pocket PC and Smartphone emulators from Microsoft which emulates an ARM chip, but I don't know if they are available without the Visual Studio IDE, sorry. And these devices aren't comparable.


Quote
The missing identifiers for older Lazarus versions can be solved by adapting the USE_WINAPI directive in kcontrols.inc. Just delete the entry 'Defined(LCLWinCE)'.
If the grid cells are empty it might be due to the clipping or TextOut bugs in WinCE widget set. Some deeper testing is required. E.g. try to comment out all SelectClipRgn calls and the SetWindowRgn call. Or replace TextOut with Canvas.TextOut etc.

  I'll give it a try next week and let you know the results.


Quote
I don't know how much memory there is on your WinCE device, on Win32 5000 rows consume some 23MB and 10000 some 40MB.

  The device has about 42 MB system RAM, but program memory is only 21 MB. So this explain the crash. I didn't take a look at the demo source, but I didn't thought it consumes so much memory in a normal way :).


Greets,
  Björn
DRIGUS GmbH

tk

  • Sr. Member
  • ****
  • Posts: 388
Re: ANN: KGrid 1.4
« Reply #4 on: October 02, 2009, 06:27:29 pm »
Sorry Björn, that's funny with the drigus I first thought it is your nickname:D
Of course I took it as a valuable feedback from you :).
However it is quite bad situation with the emulation, I thank you for giving another try testing it. I think some tiny patches would make it ready for wince. Please let's discuss this on my web then.

tk

  • Sr. Member
  • ****
  • Posts: 388
Re: ANN: KGrid 1.4
« Reply #5 on: October 04, 2009, 07:27:45 pm »
Hi, I made a hotfix that boosts the overall painting performance. Applies mainly to QT and GTK2.

TK

DRIGUS

  • Jr. Member
  • **
  • Posts: 62
Re: ANN: KGrid 1.4
« Reply #6 on: October 05, 2009, 10:21:19 am »
Hi.

I tried to update Lazarus to latest snapshot, but the WinCE snapshot (Lazarus-0.9.29-22029-fpc-2.2.4-20091005-cross-arm-wince-win32) seems to be broken again. The file is only the half size of my last download and there are units missing. Happily I renamed the old lazarus directory ;).

  So I will test KGrid again later this week.


Greets,
  Björn
DRIGUS GmbH

tk

  • Sr. Member
  • ****
  • Posts: 388
Re: ANN: KGrid 1.4
« Reply #7 on: October 05, 2009, 10:59:37 am »
Thanks a lot! Pls. download the latest hotfix from my web for that case.

TK

DRIGUS

  • Jr. Member
  • **
  • Posts: 62
Re: ANN: KGrid 1.4
« Reply #8 on: October 06, 2009, 01:07:32 pm »
Hi.

  Second test with

    Lazarus 0.9.29 r22050
    FPC 2.2.4

  and a fresh copy of 7_kgrid_1.4.zip.

  There were no missing identifiers this time but still some errors with two overloaded functions in kfunctions (Exchange and MinMax) which can be traced back to the ARM cross compiler. It seems to me that it doesn't support Extended and handle it like Double. I used $IFDEF SUPPORT_EXTENDED to get rid of it (perhaps $IFNDEF CUPARM is a better idea).

  I could solve the problem with the text output, too: A short look in winceapih.inc showed, that TWinCEWidgetSet.TextOut isn't implemented yet. So I modified kgraphics.FmtTextOut like you suggested:

Code: [Select]
    {$IFDEF STRING_IS_UNICODE}
      {$IFDEF WINCE}
        Canvas.TextOut(X, Y, AText);
      {$ELSE}
        TextOut(DC, X, Y, AText, ALen);
      {$ENDIF}
    {$ELSE}
      ...

  Of course it would be a better idea to modify TWinCEWidgetSet.TextOut, but I don't know how to manage it.

  After this few changes I run a short test on the Windows CE 6 device. So far I found no further problems. The handling is still a little though, but I think this is because of the complexity of the control and the overall slowness of the device.

  I found only one little glitch regarding the little arrows you use to display the sort order: The background is black and not transparent. I had this problem with TSpeedButton and an older snapshot, too. But is has gone for a while now.

  BTW: Great work :).


Greets,
  Björn
DRIGUS GmbH

tk

  • Sr. Member
  • ****
  • Posts: 388
Re: ANN: KGrid 1.4
« Reply #9 on: October 06, 2009, 02:14:52 pm »
Thanks Björn for testing it again.
I'll implement your modifications in the next version (with printing support) I'm currently working on.

I've considered using Canvas.TextOut for all Lazarus widget sets but finally I had no problems with Textout (after Zeljan modified the QT little bit) in widget sets I've tested on and thus I chose Textout. Because it is supposed to be little faster. I'll consider to switch back to Canvas.Textout for Lazarus because it is more "secure".

The problem with arrows seems to be a bug in TLazIntfImage for WinCE. I'll introduce a property to chose a different style of sorting indicators and column/row moving indicators in the next version to avoid this problem.

However, both issues are worth to be tested without KGrid and added to the bugtracker.

I know there is a painting performance problem if the inplace editor position changes, as I experience this on GTK2 now (because GTK2 painting is quite slow too, at least on my Gnome). This can be widely avoided by using the rsMS_Excel as RangeSelectStyle. Otherwise the performance is comparable with standard stringgrid, despite the complexity. Of course the fastest painting you get on Windows :)

TK

DRIGUS

  • Jr. Member
  • **
  • Posts: 62
Re: ANN: KGrid 1.4
« Reply #10 on: October 07, 2009, 12:31:26 pm »
Hi.

Quote
This can be widely avoided by using the rsMS_Excel as RangeSelectStyle.

  This makes no visible difference.

  
  I implemented TWinCEWidgetSet.TextOut by using Windows.ExtTextOut, because the Windows CE API doesn't support TextOut.
  I can't see any difference in painting speed. But I will make a bugtracker entry with the modified source, so perhaps there will be no need for you to change the source regarding TWidgetSet.TextOut.

  I also plan to take a short look at TLazIntfImage.

  Edit: reported as issue 0014738
  Edit²: fixed in revision 22246

Greets,
  Björn
« Last Edit: October 21, 2009, 09:55:02 am by DRIGUS »
DRIGUS GmbH

DRIGUS

  • Jr. Member
  • **
  • Posts: 62
Re: ANN: KGrid 1.4
« Reply #11 on: October 07, 2009, 03:05:33 pm »
  As mentioned I take a short look at the image display problem. It was related to TWinCEWidgetSet.StretchBlt called by TKAlphaBitmap.Draw which is slightly different to TWin32WidgetSet.StretchMaskBlt by not handling blending.

  Again it was very easy to correct. I will make another bugtracker entry for this.

  Edit: reported as issue 0014742.
  Edit²: fixed in revision 22237.


Greets,
  Björn

« Last Edit: October 20, 2009, 11:25:25 am by DRIGUS »
DRIGUS GmbH

tk

  • Sr. Member
  • ****
  • Posts: 388
Re: ANN: KGrid 1.4
« Reply #12 on: October 07, 2009, 05:33:45 pm »
Hi Björn,
thank you very much for fixing the issues on WinCE and reporting the fixes in bugtracker. I already stepped back to Canvas.Textout but I'll make a conditional directive now, because I think the normal Textout is still little bit faster. And I'll keep the alphablended arrows unchanged (unless somebody reports a problem on Carbon).

One question yet about the performance on WinCE: Does it paint slow even without the inplace editor (goEditing inactive)?

I proposed the Rangeselectstyle workaround only to minimize the inplace editor position changes - but yep it helps only if goRangeselect is active. I'll make an option that avoids the inplace editor's position change in MouseMove and perhaps yet another option to hide it while resizing a column or row with ssUpdate style. Under GTK2 or QT selection painting/updating is very slow if goIndicateSelection is active (should be turned off) because the grid invalidates a complex region.

TK
« Last Edit: October 07, 2009, 05:38:44 pm by tk »

zeljko

  • Hero Member
  • *****
  • Posts: 1942
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: ANN: KGrid 1.4
« Reply #13 on: October 07, 2009, 09:13:12 pm »
tk: Is "hotfix" for Qt & GTK painting inside KGrid zip on your web page ?

tk

  • Sr. Member
  • ****
  • Posts: 388
Re: ANN: KGrid 1.4
« Reply #14 on: October 07, 2009, 11:49:59 pm »
Yes I replaced the current version archive.

 

TinyPortal © 2005-2018