Jump to content


Photo

MoveSelectionDown is improperly restricted by erroneous LastVisibleRow setting


  • Please log in to reply
13 replies to this topic

#1 BelangerC

BelangerC

    Senior Member

  • Members
  • PipPip
  • 221 posts
  • Location:Richmond, CA USA
  • Interests:Alternative medicine, programming for

Posted 03 February 2015 - 03:49 PM

Hi, Boki:

 

Got an intermittent problem which has literally taken months for me to get a repeatable example of this misbehavior. I am hoping you can help without sending you all the files (over 1.5  GB!) to recreate it at your end.

 

Observation:

After adding rows to a NextGrid by the user, apparently the LastVisibleRow shows in the example I am looking at is 55 when it should be 58. In the KeyDown event, MoveSelectionDown the line:

If SelectedRow >= GetLastVisibleRow

causes an exit which means the arrow key does not fire the MoveByRow call. In this example the SelectedRow = 55.

 

From the user's point of view, he cannot arrow down when there are visible rows below the row his is working on. It appears that the arrow key is stuck.

 

When I am adding rows, is there something I can do to make sure the LastVisibleRow is correct?

 

Thank you!

 

Chuck Belanger



#2 BelangerC

BelangerC

    Senior Member

  • Members
  • PipPip
  • 221 posts
  • Location:Richmond, CA USA
  • Interests:Alternative medicine, programming for

Posted 03 February 2015 - 04:23 PM

Oh, BTW, Boki, this is a Treed column grid with children, if that should make a difference.

Chuck



#3 BelangerC

BelangerC

    Senior Member

  • Members
  • PipPip
  • 221 posts
  • Location:Richmond, CA USA
  • Interests:Alternative medicine, programming for

Posted 04 February 2015 - 10:15 AM

OK, I have what is going on here and my fix:

1. This grid is loaded from a SQL query from a table of user added rows.

2. The table itself has some fixed rows and user added rows.

3. It is a treed column grid, so some user rows are children to existing rows and some appended to the bottom of the grid.

 

The user added rows were being added in the order they were created, but that allowed for adding rows added to the bottom of the grid (crLast) first and any rows added a child rows to a treed row up in the grid added last. This adding of rows in this order completely messed up LastVisibleRow value. The result was that when a user was trying to arrow down (OnKey: VK_DOWN: MoveSelectionDown) no movement took place because the row index >=LastVisibleRow, which was set too low because of the way the rows were added.

 

I fixed this by changing the SQL query to differentiate rows added to a parent row and those added without a parent, merely appended to the grid. Specifically, the rows appended need to be processed last so that LastVisibleRow is correctly set higher. I made this change and voila, it is possible to arrow down properly through all rows.

 

Not sure this should be considered a bug that you (Boki) should fix. But recreating a grid with user added rows to a treed column mixed between adding child rows and appending rows can cause this issue of making the arrow keys not work properly. I suspect this is a pretty rare problem. I just started seeing this maybe 6 months ago and then only by a single power user.

 

Chuck



#4 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 04 February 2015 - 03:56 PM

Hello Chuck,

 

Please sorry for delay. I will fix this issue as soon as possible.


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.

#5 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 05 February 2015 - 09:59 PM

Hi Chuck,

 

I think that I have fixed it. Please tell me in next release if all work fine. Next release will be out after the weekend.


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.

#6 BelangerC

BelangerC

    Senior Member

  • Members
  • PipPip
  • 221 posts
  • Location:Richmond, CA USA
  • Interests:Alternative medicine, programming for

Posted 18 February 2015 - 10:27 AM

Hi, Boki:

 

I downloaded and installed the exe update, 5.9.55, but getting error about use of TStyleElements. I am using XE2 and that does not have this class in Controls.

Can you fix this or give me instructions to work around?

Thanks,

Chuck



#7 BelangerC

BelangerC

    Senior Member

  • Members
  • PipPip
  • 221 posts
  • Location:Richmond, CA USA
  • Interests:Alternative medicine, programming for

Posted 18 February 2015 - 10:31 AM

p.s. Looks like in the previous version CUSTOM_STYLES compiler directive is not defined for XE2, but in this last release it is.

Chuck



#8 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 18 February 2015 - 12:17 PM

Hi Chuck,

 

Please open NxSuite.inc and locate next code:

 

{ Delphi XE2 }
{$IFDEF VER230}
  {$DEFINE DELPHI2010UP}
  {$DEFINE DELPHI2009UP}
  {$DEFINE D2006UP}
  {$DEFINE D2005UP}
  {$DEFINE XE2}
  {$DEFINE CUSTOM_STYLES} // <-------- delete this line
{$ENDIF}

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.

#9 BelangerC

BelangerC

    Senior Member

  • Members
  • PipPip
  • 221 posts
  • Location:Richmond, CA USA
  • Interests:Alternative medicine, programming for

Posted 19 May 2015 - 12:41 PM

Hi, Boki:

 

Well, it looks like this issue was not fixed after all.

 

In my previous discovery a user found that if he appended rows to a treed grid, then moved back up the tree to add child rows the LastVisibleRow gets off so that it can become less than the actual row count. This causes the MoveSelectionDown to exit on an arrow key down which makes it so the user cannot arrow down through the grid beyond some row less than the bottom of the actual grid.

 

In the current example the user was adding 31 rows as children to various rows in the grid, no appended rows, to a 600 row grid. His order of adding the rows was not top down, but he would move up and down the treed grid as he added rows. So he might add rows around the 10th row then about the 200th, then back up to the 100th and so on.

 

He found that in the resulting 614 row table he could not get past the 610th row in an arrow down key movement.

 

Can you please try again to fix this?

 

Thanks,

Chuck Belanger



#10 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 20 May 2015 - 10:04 PM

Hi Chuck,

 

I will look at it and fix it in couple of days (I hope that it is not urgent).


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.

#11 BelangerC

BelangerC

    Senior Member

  • Members
  • PipPip
  • 221 posts
  • Location:Richmond, CA USA
  • Interests:Alternative medicine, programming for

Posted 30 May 2015 - 10:31 AM

Hi, Boki:

 

Any progress on this issue? We are about to release an update and it would be nice to include this fix. Can you give me a time estimate on when you might be able to work on this?

 

Thank you,

Chuck Belanger



#12 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 30 May 2015 - 01:35 PM

Hi Chuck,

 

Sorry for delay, I will do my best to finish it for tomorrow.


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.

#13 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 31 May 2015 - 02:46 PM

Hi Chuck,

 

Please try next code in NxCustomGridControl.pas:

 

procedure TNxCustomGridControl.MoveSelectionDown(Shift: TShiftState;
  NextControl: Boolean; SelectFirst: Boolean);
begin
  if RowCount = 0 then Exit;
  if InputSelected then InputSelected := False else
  begin
    if SelectedRow <= -1 then Exit;
//    if SelectedRow >= GetLastVisibleRow then
    if SelectedRow >= GetLastVisible(RowCount - 1) then
    begin
      if NextControl then SelectNextControl;
      if SelectFirst then SelectFirstRow;
      Exit;
    end;
  end;
  MoveByRow(True, Shift);
end;

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.

#14 BelangerC

BelangerC

    Senior Member

  • Members
  • PipPip
  • 221 posts
  • Location:Richmond, CA USA
  • Interests:Alternative medicine, programming for

Posted 02 June 2015 - 10:08 AM

Thank you, Boki!

 

That did it. Tomorrow we will release the now complete program update.

Chuck






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users