* * *

Author Topic: Right-click on TDBGrid does not scroll database  (Read 556 times)

HatForCat

  • Sr. Member
  • ****
  • Posts: 260
Right-click on TDBGrid does not scroll database
« on: March 16, 2017, 07:47:51 pm »
With a right-click on a TDBGrid for my Popup menu, this same program-code in windows (Delphi) will first scroll the database to the Row under the mouse-cursor before the right-click.

This may be a Ubuntu thing, but Lazarus uses the current highlighted Row which may not be the Row under the cursor when the right-click was done.

Is there an option to make his work the same in Lazarus+SQLdb?

Thanks


Acer-i5, 2.6GHz, 6GB, 256-SSD, Ubuntu 14.04-LTS, Unity Desktop, Lazarus 1.6.2, SQLite3 -- Retired: Programming for my own use for Ubuntu.

Thaddy

  • Hero Member
  • *****
  • Posts: 3640
Re: Right-click on TDBGrid does not scroll database
« Reply #1 on: March 16, 2017, 08:51:40 pm »
This is not only on Windows and it is by design: A right click should not assume anything - and this is documented in e.g. the Windows design guidelines! -but the current state. So basically Delphi is misbehaving.
But there's no reason why you could not implement this behavior yourself and make the record beneath the mouse cursor current in one of the OnMouseXXX events.
Maybe a good time to study how other programs behave with a right mouseclick... there's a reason for that....
It is all about current state and current context, irrespectively of where you click the right mouse button in the focused control. A right click should not have a mind of its own and update the context.....
So if you want it, program it. Easy task. Not recommended in the light of the above. It confuses users.
If Delphi does it, then that's Delphi's mistake.
« Last Edit: March 16, 2017, 09:02:37 pm by Thaddy »
Why do the Danish always try to fuck up any programming language?

Zoran

  • Hero Member
  • *****
  • Posts: 1144
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: Right-click on TDBGrid does not scroll database
« Reply #2 on: March 16, 2017, 09:34:24 pm »
In DBGrid you can just set dgAnyButtonCanSelect in Options property.

Thaddy

  • Hero Member
  • *****
  • Posts: 3640
Re: Right-click on TDBGrid does not scroll database
« Reply #3 on: March 16, 2017, 10:00:03 pm »
That's actually a neat solution I didn't think about.
Still. It is a bad idea in the bigger picture: try to always mimic the user experience that is common on a platform. You can make people (oh well, normal users) really frustrated when a program doesn't behave like all other programs on the same platform. Some people (programmers)  think that is not important and they know better, well believe me, I used to make those mistakes 20 years ago.
If you want to improve on a platform, discuss on the platform...
Why do the Danish always try to fuck up any programming language?

HatForCat

  • Sr. Member
  • ****
  • Posts: 260
Re: Right-click on TDBGrid does not scroll database
« Reply #4 on: March 18, 2017, 11:07:12 pm »
In DBGrid you can just set dgAnyButtonCanSelect in Options property.

Awesome, thanks Zoran. I was pretty sure that Lazarus would have had the situation covered, just could not find out what term to search on to find it.

It works perfectly.

@Thaddy: I agree with you on the fundamental philosophy, but note that msoft wrote the book on mandatory methods for GUI behavior, then broke their own rules, thus legitimizing sloppy behavior by example.
Acer-i5, 2.6GHz, 6GB, 256-SSD, Ubuntu 14.04-LTS, Unity Desktop, Lazarus 1.6.2, SQLite3 -- Retired: Programming for my own use for Ubuntu.

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus