Recent

Author Topic: RX library  (Read 40408 times)

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: RX library
« Reply #30 on: January 01, 2014, 01:04:33 pm »
Quote
You could include [...] the .lrs
I'll try that. But I don't know how to create the lrs out of the res. Any idea?
Wasn't it posted here already?
http://forum.lazarus.freepascal.org/index.php/topic,22463.msg137366.html#msg137366
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

wp

  • Hero Member
  • *****
  • Posts: 6320
Re: RX library
« Reply #31 on: January 01, 2014, 07:37:33 pm »
Here is a solution that I am happier with. I'll post the modifications as a patch to bugtracker, but for a short-term modification copy the files in the attached zip to the source files of your rxnew installation.

Some details (nothing to change - everything is included already in the zip):
  • I cannot compile rxnew with the default defines in rx.inc. Deactivating the define "RX_USE_LCL_DEVEL" fixes this.
  • Using XN Resource Editor, I extracted the picDateEdit image from "tooledit.res" (it's only this one), and recreated the "tooledit.lrs".
  • If you had applied kjteng's patch from above, it has to be undone by removing the line "{$I picDateEdit.lrs}" at the end of rxdbgrid.pas.
  • In "tooledit.pas", the line "{$R tooledit.res}" has to be removed, and immediately before the final "end." the following lines have to be added
Code: [Select]
initialization
  {$I tooledit.lrs}
  • Unfortunately I had lots of trouble getting this solution to run. Finally I found out that the virtual procedure "GetDefaultGlyph" introduced by TCustomEditButton (in lcl/EditBtn.pas) is not overridden by TCustomRxDateButton and still returns nil. To fix this, add the following procedure to unit "tooledit.pas":
Code: [Select]
function TCustomRxDateEdit.GetDefaultGlyph: TBitmap;
var
  ResName: String;
begin
  NumGlyphs := 2;  // the picDateEdit file contains two glyphs
  ResName := GetDefaultGlyphName;
  if ResName = '' then
    Exit(nil);
  Result := LoadBitmapFromLazarusResource(Resname);
end;
  • In testing other rx components, I saw that TRxCustomDBLookupEdit (in rxlookup.pas) has the same issue. To get it fixed add the following code to rxlookup.pas:
Code: [Select]
function TRxCustomDBLookupEdit.GetDefaultGlyph: TBitmap;
begin
  Result := CreateArrowBitmap;
end;
    With all these modifications done, I was able to compile and use the rx components in all of my Lazaraus versions available, (1.0.14, trunk, Win and Ubuntu (trunk) ). There is still a crash for TPageManager that I did not fix. My overall impression is that there's still a lot to be done to get these components to the qualitity level of the standard LCL components.
    Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

    freeman35

    • Jr. Member
    • **
    • Posts: 92
    Re: RX library
    « Reply #32 on: January 12, 2014, 03:20:36 pm »
    I attached my patch. This patch had 2 events:
    Code: [Select]
    +//Freeman35 added
    +  TRxTitleClickEvent = procedure(Sender: TObject; Column: TRxColumn; Shift: TShiftState) of object;
    +  TDrawRxColumnCellEvent =
    +    procedure(Sender: TObject; ACanvas: TCanvas; const Rect: TRect;
    +              DataCol: Integer; Column: TColumn; State: TGridDrawState; var AText :String) of object;

    OnRxTitleClick : I added just Shift: TShiftState parameter, So can handle easy shift or ctrl click and set multi column sort

    OnDrawRxColumnCell : This is Column's event.  Column.OnDrawColumnCell same event name with rxgrid, this example explain better then me :)
    Code: [Select]
    procedure TFRM_X.GRD_Columns2DrawRxColumnCell(Sender: TObject; ACanvas: TCanvas; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState; var AText: String);
    begin
      if(Column.Field<>nil)and(Column.Field.AsInteger<0)then begin
       ACanvas.Brush.Color := ClRed;
       ACanvas.Font.Style := [fsBold];
       AText := 'Negative Value';
      end;
    // This code for need Editor position, maybe add in Column class, and maybe add TWincontrol property too, we will see :)
     if (gdFocused in State)then FGridCellRect := Rect;
    end;

    This patch just add code, not change any code or properties name

    Thank you BigChimp, can follow from this link
    http://bugs.freepascal.org/view.php?id=25524
    « Last Edit: January 13, 2014, 09:46:59 am by freeman35 »

    BigChimp

    • Hero Member
    • *****
    • Posts: 5740
    • Add to the wiki - it's free ;)
      • FPCUp, PaperTiger scanning and other open source projects
    Re: RX library
    « Reply #33 on: January 13, 2014, 09:03:21 am »
    @freeman, please submit patches to the bugtracker so the rx developers have a chance to notice it (not all developers read the forum). (I suspect wp has uploaded

    See
    http://wiki.lazarus.freepascal.org/Lazarus_Faq#I_have_fixed.2Fimproved_Lazarus._How_can_I_add_my_changes_to_the_official_Lazarus_source.3F
    and
    http://wiki.lazarus.freepascal.org/Creating_A_Patch

    For example: wp did the same with his patch, see:
    http://bugs.freepascal.org/view.php?id=0025465

    Thanks for your contribution!
    Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

    Open source including papertiger OCR/PDF scanning:
    https://bitbucket.org/reiniero

    Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

    krzynio

    • Jr. Member
    • **
    • Posts: 73
    RX library - error creating component trxdbgrid
    « Reply #34 on: January 20, 2014, 09:16:41 am »
    Hello!
    I was looking for DBGrid component for Lazarus with filter and sum options like in SMDBGrid for Delphi.
    I found RX library then downloaded and installed from svn:

    Code: [Select]
    svn co https://lazarus-ccr.svn.sourceforge.net/svnroot/lazarus-ccr/components/rx
    I compiled and installed comp. without problems but when I am trying to put TRXDBGrid component on a form I notice the error: Error creating component: TRxDBGrid. Access violation.

    I was trying with trunk and with version but result is the same in both cases.
    I work on Debian with Lazarus 1.1.99pre-release from svn and FPC 2.6.2 from Debian Jessie repositories.

    I noticed this behavior with several RX components also.

    Please help.
    Lazarus version: trunk. FPC version: 3.0.4. OS: Linux Debian Testing x64 with XFCE 4.12 and Windows 10 x64 version: 1709

    wp

    • Hero Member
    • *****
    • Posts: 6320
    Re: RX library
    « Reply #35 on: January 20, 2014, 09:58:59 am »
    Did you try my fix a few postings above?
    Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

    krzynio

    • Jr. Member
    • **
    • Posts: 73
    Re: RX library
    « Reply #36 on: January 20, 2014, 10:40:50 am »
    Thank you very much!
    I replaced original files with files from your fix and now works fine.
    Regards,
    Krzysztof
    Lazarus version: trunk. FPC version: 3.0.4. OS: Linux Debian Testing x64 with XFCE 4.12 and Windows 10 x64 version: 1709

    krzynio

    • Jr. Member
    • **
    • Posts: 73
    Re: RX library
    « Reply #37 on: January 21, 2014, 12:21:20 pm »
    Hi again!
    I am trying to display SortMarks.

    OnTitleClick is as follows:

    Code: [Select]
        with (g.DataSource.DataSet as TZQuery) do begin
          if SortType = stAscending then begin
          SortedFields := '"'+Column.Field.FieldName+'"';
            SortType := stDescending;
          end
          else begin
          SortedFields := '"'+Column.Field.FieldName+'"';
            SortType := stAscending;
          end;
        end;


    GetButtoParams looks like this:

    Code: [Select]
      if pos(Field.DisplayName, (g.DataSource.DataSet as TZQuery).IndexFieldNames )>0 then begin
        if (g.DataSource.DataSet as TZQuery).SortType=stAscending then begin
        SortMarker := smDown;
        end
        else
        SortMarker := smUp;
      end
      else
      SortMarker := smNone;   

    The SortMark is drawn correctly only for smDown and only when option dgHeaderPushedLook is True. But with this option the table is sorted correctly only when I press the column header first time. Next time the table is sorted with any different column.

    When I set dgHeaderPushedLook to False table is sorted correctly in both directions and for correct column but SortMark is not drawn.

    Do I do something wrong or is it a bug? How to fix it?

    And one more bug? When I set option dgIndicator to False, Lazarus displays dialog box with any error and closes automatically so fast that I cannot even read the error message.
    « Last Edit: January 21, 2014, 12:26:43 pm by krzynio »
    Lazarus version: trunk. FPC version: 3.0.4. OS: Linux Debian Testing x64 with XFCE 4.12 and Windows 10 x64 version: 1709

    r_1gm

    • New Member
    • *
    • Posts: 26
    Re: RX library
    « Reply #38 on: February 24, 2014, 03:48:04 pm »
    Hi all,

    i found a problem in CurrencyEdit when i using FormatOnEditing feature, the CurrencyEdit cursor always move to left when text is formated, when i look to the source i find that the code that move the cursor to the right position is remarked, i doing small modification so the code is can be compiled and running, if this patch is right please report it to the bug tracker i can't find a way to post it(i already logged but cannot find a way to post it)  :( . thank you


    Best Regards,
    Rody
    « Last Edit: February 24, 2014, 03:49:42 pm by r_1gm »

    BigChimp

    • Hero Member
    • *****
    • Posts: 5740
    • Add to the wiki - it's free ;)
      • FPCUp, PaperTiger scanning and other open source projects
    Re: RX library
    « Reply #39 on: February 24, 2014, 03:56:46 pm »
    Quote
    the bug tracker i can't find a way to post it(i already logged but cannot find a way to post it)

    In the bugtracker, log in, create a new issue, and attach the zip file with your patch via Upload File /select file/browse...

    For more details, please see:
    http://wiki.lazarus.freepascal.org/How_do_I_create_a_bug_report#Attachments
    more background:
    http://wiki.lazarus.freepascal.org/Creating_A_Patch
    http://wiki.lazarus.freepascal.org/Tips_on_writing_bug_reports

    Thanks.
    Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

    Open source including papertiger OCR/PDF scanning:
    https://bitbucket.org/reiniero

    Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

    alexs75

    • Full Member
    • ***
    • Posts: 104
    Re: RX library
    « Reply #40 on: March 06, 2014, 12:15:59 pm »
    Hi again!
    I am trying to display SortMarks.

    OnTitleClick is as follows:


    For sort data in RxDBGrid from Zeos query:
    Set:
    RxDBGrid.AutoSort = true
    RxDBGrid.TitleButtons = true

    and
    put component TRxSortZeos on the any form of you project