Jump to content


Photo

Scrolling with Hidden rows


  • Please log in to reply
39 replies to this topic

#21 deonvn

deonvn

    Senior Member

  • Honorable Members
  • PipPip
  • 313 posts

Posted 09 September 2007 - 03:30 PM

OK. I can't release without this fix, so I will delay my release until then.

Regards,
Deon

#22 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,196 posts
  • Gender:Male

Posted 09 September 2007 - 03:33 PM

Hello Deon,

I need now to solve problem with PageUp/PageDown and I am not sure if this will be done in one day and what may go to bad sad.gif

But, I am thinking that I am on right track.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#23 deonvn

deonvn

    Senior Member

  • Honorable Members
  • PipPip
  • 313 posts

Posted 12 September 2007 - 09:10 AM

Hi Boki

I got the pre-release you sent me - thanks.

Unfortunately there are still so many code gaps that I can't test anything (the grid always loads only the first row - nothing else).

I will wait a few more days until you have a working version for me to test.

Regards,
Deon

#24 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,196 posts
  • Gender:Male

Posted 12 September 2007 - 10:40 AM

Hello Deon,

Can you please modify this sample which I use to help me with finding this gaps:
Attached File  Select_Hidden_Rows.zip   2.37KB   5 downloads

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#25 deonvn

deonvn

    Senior Member

  • Honorable Members
  • PipPip
  • 313 posts

Posted 12 September 2007 - 07:58 PM

Hi Boki

After applying the FLastAddedRow fix you sent me, the loading of the grid is fine now. The scrolling also seems to be working very well now smile.gif

There is still one (specific) situation where I noticed that the scrolling does not work. I will try to find the steps to recreate it now, and will let you know.

Regards,
Deon

#26 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,196 posts
  • Gender:Male

Posted 12 September 2007 - 08:00 PM

Hello Deon,

I am glad that things go better smile.gif

I hope that everything will be done untill September 14-15.

If you can reproduce this situation this will be great.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#27 deonvn

deonvn

    Senior Member

  • Honorable Members
  • PipPip
  • 313 posts

Posted 12 September 2007 - 08:20 PM

Hi Boki

It is very hard to pinpoint. It looks like the problem occurs only if you set a filter (hide some rows) before the grid was ever clicked.

On the attached demo:

1. Run the program.
Click on any row in the grid.
Click on Set Filter.
Now scroll the grid --> Everything is fine.

2. Run the program.
Don't click on the grid --> just go straight to Set Filter.
Now scroll the grid --> you will see the problem.

Like I said, it is hard to poinpoint, but if you don't click on the grid first, it seems to happen (more or less) every time...

Regards,

Attached Files



#28 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,196 posts
  • Gender:Male

Posted 12 September 2007 - 10:08 PM

Hello Deon,

I didn't find a difference, but I see now that line

CODE
RowVisible[5] := False;


Didn't scroll grid correcltly. I will see now why this happen.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#29 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,196 posts
  • Gender:Male

Posted 12 September 2007 - 10:14 PM

Hello Deon,

Please try to change this procedure (NxGrid.pas):

CODE
var
  ARowHeight: Integer;
begin
  if RowVisible[Index] <> Value then
  begin
    FCells.ShowRow(Index, Value);
    case GridStyle of
      gsReport: ARowHeight := GetRowHeight(Index);
      else ARowHeight := SlideSize;
    end;
    ShowRow(Index, ARowHeight, Value, False);
    if Index = FFirstRow then Dec(FFirstRow);
    inherited;
  end;
end;


You may send me more reports and I will work on them.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#30 deonvn

deonvn

    Senior Member

  • Honorable Members
  • PipPip
  • 313 posts

Posted 13 September 2007 - 08:53 AM

Hi Boki

The new fix causes List Index Out of Bounds errors. Try to sort any column and you will see.

What is the difference between FFirstRow and FFirstVisibleRow?

Regards,

#31 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,196 posts
  • Gender:Male

Posted 13 September 2007 - 10:32 AM

Hello Deon,

Change this procedure too (NxGrid.pas):

CODE
procedure TNextGrid.SortColumn(AColumn: TNxCustomColumn; Asending: Boolean);
var
    ASortKind: TSortKind;
  ASelectedRow: TRow;
begin
  inherited;
  ASelectedRow := nil;
  if coCanSort in AColumn.Options then
  begin
    FFirstVisibleRow := GetFirstVisible(0);
    FLastVisibleRow := GetLastVisible(Pred(RowCount));

    { TODO 3 -oBoki -cMedium Bug : Update FirstRow after InverseSort. }
      if Asending then ASortKind := skAscending else ASortKind := skDescending;
    { Remember selected row }
    if RowExist(SelectedRow) then ASelectedRow := FCells.Row[SelectedRow];
    FCells.SortColumn(AColumn.Index, AColumn.SortType, ASortKind);
    { Find old selected row (after sorting) and set it active }
    if Assigned(ASelectedRow) then SetSelectedCell(SelectedColumn, FCells.GetRowIndex(ASelectedRow));
    if SelectedRow > -1 then ScrollToRow(SelectedRow);
    RefreshArea(gaBody);
    if goIndicator in Options then
      RefreshArea(gaIndicator);
    DoAfterSort(AColumn.Index);
  end;
end;


FFirstRow indicate first visible row in view, and FFirstVisibleRow indicate first visible row in whole grid.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#32 deonvn

deonvn

    Senior Member

  • Honorable Members
  • PipPip
  • 313 posts

Posted 13 September 2007 - 12:25 PM

Hi Boki

I changed the SortRow procedure, but I now I get a List index error in GetRowTop(). It is using FFirstRow in a loop that check RowVisible[I], but FFirstRow is -1.

So then I changed the previous fix in SetRowVisible to...

CODE
    ShowRow(Index, ARowHeight, Value, False);
    if (Index = FFirstRow) and (FFirstRow > 0) then Dec(FFirstRow);
    inherited;


...but then it is really messed up. (I can send you a demo if you want).


I think the problem may be with FFirstRow. It is decremented by a few procedures, but it's not really incremented very often.

The only places I could find is:

ShowRow:
This procedure increments FFirstRow, but only if (Index = FFirstRow).

GetVertOffset:
This procedure increments FFirstRow, but the procedure is never called from any code?


I will try to trace it some more.

Regards,
Deon

#33 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,196 posts
  • Gender:Male

Posted 13 September 2007 - 12:32 PM

Hello Deon,

If you can, please send it to me. I may send you complete my version agai too (can't track differences anymore smile.gif )

PS. Maybe you need to use FirstVisibleRow instead FirstVisible row while you loop trough visible rows?

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#34 deonvn

deonvn

    Senior Member

  • Honorable Members
  • PipPip
  • 313 posts

Posted 13 September 2007 - 12:43 PM

Hi Boki

Yes. Please send me latest version again.

Thanks

#35 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,196 posts
  • Gender:Male

Posted 13 September 2007 - 06:05 PM

Hello Deon,

I have sent it to you again. But I am not sure why you read FirstRow row in loop smile.gif This is a first row in visible portion of grid.

But I will see why is -1 anyway. It doesn't need to be -1.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#36 deonvn

deonvn

    Senior Member

  • Honorable Members
  • PipPip
  • 313 posts

Posted 13 September 2007 - 08:33 PM

Hi Boki

I have installed the latest version again, and it is still the same.

Run the attached demo, then click on "Do Filter" (2 or 3 times) until you get the error.


It is not me who is using FFirstRow in the loop I was talking about - it is you wink.gif

Look at the Line#2 and Line#5 of the GetRowTop() function below:

CODE
function TNxCustomGridControl.GetRowTop(Index: Integer): Integer;
var
  i, Delta: Integer;
begin
  Result := GetBodyRect.Top + GridSpace[lpTop];
  for i := FFirstRow to Index - 1 do  <--------
  begin
    if i < RowCount then begin
      if GetRowVisible(i) then Delta := GetRowHeight(i) else Delta := 0;  <--------
    end else Delta := RowSize;
    if Delta > 0 then begin
      Inc(Result, Delta);
      Inc(Result, GridSpace[lpTopBottom]);
    end;
  end;
end;


GetRowVisible will cause a List Index error if FFirstRow is -1. The problem is that when you call Dec(FFirstRow) in SetRowVisible procedure, you are not checking if FFirstRow is already zero.

That is what I meant....

Regards,
Deon

Attached Files



#37 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,196 posts
  • Gender:Male

Posted 13 September 2007 - 08:45 PM

Hello Deon,

Thank you. I will check it now again.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#38 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,196 posts
  • Gender:Male

Posted 13 September 2007 - 09:49 PM

Hello Deon,

Try to comment this line in TNextGrid.SetRowVisible:

CODE
    if (Index = FFirstRow) and (FFirstRow > 0) then Dec(FFirstRow);


I hope that now we are closer to the solution smile.gif

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#39 deonvn

deonvn

    Senior Member

  • Honorable Members
  • PipPip
  • 313 posts

Posted 19 September 2007 - 08:37 AM

Hi Boki

On the latest version you sent me, it actually seems to be working fine now smile.gif

I will let you know if I run into any "funnies", but for now it seems to be sorted out. Thanks again for all the long hours you spent trying to sort this out - I really appreciate it.

Regards,
Deon

#40 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,196 posts
  • Gender:Male

Posted 19 September 2007 - 02:08 PM

Hello Deon,

Thank you too smile.gif for great help with solving this bug. I will continue to test it.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users