Recent

Author Topic: [SOLVED] TStringgrid.AutoAdvance won't tab or shift/tab  (Read 4072 times)

Gary Randall

  • Jr. Member
  • **
  • Posts: 70
[SOLVED] TStringgrid.AutoAdvance won't tab or shift/tab
« on: December 17, 2014, 04:41:39 am »
Tab or Shift/Tab don't work at all on my stringgrid with AutoAdvance and/or TabAdvance set to aaRightDown, or anything else.  Enter and Shift/Enter work just the way they should.  I should be able to work around this problem with an OnKeyDown event if there's a bug in the compiler.  However, I've found no indication on this forum or other forums that there's a bug.  It did this this with the previous Lazarus version I used.  I'm pretty sure I'm overlooking some property setting.  Can somebody steer me in the right direction?

Gary
« Last Edit: December 19, 2014, 04:26:35 pm by Gary Randall »
Windows 7 Home Premium 64 bit - SP 1
Lazarus Version #: 1.8.0; FPC Version: 3.0.4
SVN Revision 56594
i386-win32-win32/win64

Bart

  • Hero Member
  • *****
  • Posts: 5275
    • Bart en Mariska's Webstek
Re: TStringgrid.AutoAdvance won't tab or shift/tab
« Reply #1 on: December 17, 2014, 11:24:09 am »
Works for me in trunk (Win7-64, 32-bit fpc).
Tested wit attached stringgrid testsuite.
Tested with and without goEditing, goAlwaysShoweditor.

Bart

Gary Randall

  • Jr. Member
  • **
  • Posts: 70
Re: TStringgrid.AutoAdvance won't tab or shift/tab
« Reply #2 on: December 18, 2014, 05:48:12 am »
Thanks Bart.  I downloaded the test program and it worked fine so I was really encouraged.  By the way, thanks for the great lesson in unit testing.  I haven't gotten to that lesson in Howard Page-Clark's book yet.  After checking the properties thoroughly my grid still didn't work.  I dropped another stringgrid on my form and that worked OK.  I then compared and duplicated every property between the two.  Still no luck with the original string grid.  Thought it might be several events in the original grid so bypassed them.  No luck.  Then noticed the grid tab sometimes jumped to tab-stopped buttons so set all tab-stops to false.  No luck..

Since my original grid was created with a previous Lazarus version I'm thinking of creating another Git branch and replacing the original grid.  Maybe it was fixed in the new version.  Since it's rather large I'll try that tomorrow. 

Gary
Windows 7 Home Premium 64 bit - SP 1
Lazarus Version #: 1.8.0; FPC Version: 3.0.4
SVN Revision 56594
i386-win32-win32/win64

Gary Randall

  • Jr. Member
  • **
  • Posts: 70
Re: [SOLVED] TStringgrid.AutoAdvance won't tab or shift/tab
« Reply #3 on: December 19, 2014, 04:22:47 pm »
After thinking about this problem off-and-on for a couple of days I realized that all the design information affecting the grid's settings were initially in the form's .lfm file, which any Lazarus version uses to initialize the grid.  Therefore, deleting and re-designing the grid wouldn't fix things as long as the .lfm file grid settings were the same.  I checked the .lfm file and the settings controlling my original grid and the new test grid  on the same form were the same. This had to mean that the tab settings of the original grid were getting changed after design.  Sure enough, I had modified the form's OnCreate procedure to track down a bug in early development and had omitted the goTabs option setting.  Once I set that the tabs worked as advertised.  A hard lesson learned that I won't forget.

Thanks again Bart for proving that the feature worked when properly configured.

Gary
Windows 7 Home Premium 64 bit - SP 1
Lazarus Version #: 1.8.0; FPC Version: 3.0.4
SVN Revision 56594
i386-win32-win32/win64

Bart

  • Hero Member
  • *****
  • Posts: 5275
    • Bart en Mariska's Webstek
Re: [SOLVED] TStringgrid.AutoAdvance won't tab or shift/tab
« Reply #4 on: December 19, 2014, 09:56:19 pm »
Yep, always go back to the basics, if that works and your program does not, chances are you broke it yourself.
We've all been there.

Bart

Gary Randall

  • Jr. Member
  • **
  • Posts: 70
Re: [SOLVED] TStringgrid.AutoAdvance won't tab or shift/tab
« Reply #5 on: December 19, 2014, 11:41:26 pm »
Right on, Bart!  I've been programming, or I should say humiliated, for 50 years now.  In the early days it was fairly common to find a bug in the compiler, after we moved beyond machine languages.  I usually  start with the last change I made.  When I didn't find it immediately I remembered the recent upgrade.  Humiliated again!  But you quickly put me on the right track.

I try to keep the proper perspective by recalling that an engineering geometry program of mine ran for nine years every working day until it finally hit one line of code that caused a divide by zero overflow.  It makes me shudder when I think of computers running flight and military ordnance software.

Gary
Windows 7 Home Premium 64 bit - SP 1
Lazarus Version #: 1.8.0; FPC Version: 3.0.4
SVN Revision 56594
i386-win32-win32/win64

 

TinyPortal © 2005-2018