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
On 01/07/16 11:07, Vojtěch Čihák wrote:
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.
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus-ide.org/listinfo/lazarus