Hello,
I use TStringGrid with my own cell editors and I would like to implement following feature: Column of edited cell will be automaticaly enlarged when cell editor appears (and auto-shrinked afterwards).
But I do not use goAlwaysShowEditor and grid triggers OnSelectEditor events even if it actually is not going to show editor. (the first click selects cell, triggers OnSelectEditor but no editor is shown yet, the second click on the selected cell triggers OnSelectEditor again and now editor appears).
I need to detect in OnSelectEditor whether the grid is really going to show the editor.
So far I have this:
TStrGridAccess = class(TStringGrid); {for access to protected properties}
if (TStrGridAccess(Sender).FGridState=gsSelecting) and not TStringGrid(Sender).EditorMode and not (gfNeedsSelectActive in TStrGridAccess(Sender).GridFlags) then writeln('Now!');
It seems to be reliable but of course, it's a hack. Is there a better way?
Thanks, V.
Mailing lists / lazarus / 2016-07
Grid Cell Editors
4 messages · 3 people · –
- VVojtěch Čihák 2
- JJesus Reyes A. 1
- TTony Whyman 1
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
Now I see I did a bugreport about it in 2012 :-)
http://bugs.freepascal.org/view.php?id=23173
I use TStringGrid with my own cell editors and I would like to implement following…
Vojtěch,
The protected virtual method TCustomGrid.DoEditorShow is a good place to put any actions you want to take place just before the editor is shown - but you need to override the method to do this and add your code before the inherited method is called. This is how I created a DBGrid that changed the row height before showing the editor.
You probably need to create your own custom component to do this properly.
Regards
Tony Whyman
MWA
Vojtěch Čihák wrote 21 lines
Now I see I did a bugreport about it in 2012 :-) …
En Fri, 01 Jul 2016 05:11:10 -0500, Vojtěch Čihák
Show quoted text 7 lines
Sorry for that.
Please attach a sample project with a specific problem to be resolved, which can't be resolved because the current implementation make it impossible.
As it's deduced on the linked report, perhaps we have to change the inner working of the grid and there will be no remedy but to break some code (er.. breaking is also theoretically), if it has the due merits, of course we will do it.
Jesus Reyes A.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20160703/b34ca2c2/attachment.html>
