Discussion:
TStringGrid and TInplaceEdit
(too old to reply)
KKF
2004-01-16 09:05:23 UTC
Permalink
I need to create my own component - kinda data grid and I have to do it on
my own due to some specific functionality that I surely won't find at
Torry's.
I tried to embed ComboBox in StringGrid cell but it doesn't look satisfying,
the combo likes to "jump-out" of its cell into another when scrolling the
grid.
I'd best build it based on TStringGrid and use class TInplaceEdit - just
alike in TDBGrid. The problem is that I don'k know how. I analysed code of
some free components and it was there, but unfortunately I couldn't
understand it.
I cannot modify TDBGrid because it's too much data-aware and I need
something much more autonomic and transactional in terms of if I modify, add
or delete something, appropriate SQL code will be generated.

If anybody of you folks has something like this and doesn't mind sharing
(and briefly explaining) it, I'll be grateful.

I attach my favorite unit - by Alexander Halser. Dropdowns work pretty nice
there. Maybe anybody would like to tell me what's going on there.

Best regards,
Kris
Bruce Roberts
2004-01-16 23:55:18 UTC
Permalink
Post by KKF
I need to create my own component - kinda data grid and I have to do it on
my own due to some specific functionality that I surely won't find at
Torry's.
Have you looked at tVirtualTree
(http://www.lischke-online.de/VirtualTreeview/VT.php). While it is a tree
control, its real easy to make it look and work like a grid. It also has the
easiest way of introducing custom cell editors that I've ever worked with.
I've written a couple of data bound grid controls using this open source
tool and simply love it.
KKF
2004-01-19 13:33:07 UTC
Permalink
Thanks, I downloaded the VT - it's very useful, but all in all I need the
idea of dropdown cells in terms of:
- how do I draw the ellypsis button,
- how to handle a click event from it,
- how to display a popup listbox (standard TInplaceEdit from Grids unit)

Looks I still need your help

Regards,
Kris
Post by Bruce Roberts
Post by KKF
I need to create my own component - kinda data grid and I have to do it on
my own due to some specific functionality that I surely won't find at
Torry's.
Have you looked at tVirtualTree
(http://www.lischke-online.de/VirtualTreeview/VT.php). While it is a tree
control, its real easy to make it look and work like a grid. It also has the
easiest way of introducing custom cell editors that I've ever worked with.
I've written a couple of data bound grid controls using this open source
tool and simply love it.
Bruce Roberts
2004-01-19 20:09:57 UTC
Permalink
Post by KKF
Thanks, I downloaded the VT - it's very useful, but all in all I need the
- how do I draw the ellypsis button,
- how to handle a click event from it,
- how to display a popup listbox (standard TInplaceEdit from Grids unit)
I abandoned the vcl grid some time ago, so I'm not sure how appropriate
these comments will be (although the approach will work with VT and other
grid/tree controls - like TurboPower's Orpheus Table).

Instead of drawing an ellipsis button and detecting a click on it, it is
much simpler to use an existing control. If one wants a drop-down box, i.e.
a combobox, then (in the case of a vcl grid) descend from tInPlaceEdit and
override its creation of a simple text edit, replacing it with a
tCustomComboBox. If you need a text edit with an ellipsis button on the
right, create both a tCustomEdit and a tButton (or tSpeedButton, or
tBitBtn).

Depending on your needs, you might find that you can achieve your goals by
simply overriding the CreateParams method in your custom tInPlaceEdit.
Checkout the CreateWindow and CreateWindowEx help entries in the Win SDK
help for various options that can be set in CreateParams.
KKF
2004-01-20 17:47:17 UTC
Permalink
Hi there,
Just look what I have just found:
http://www.elists.org/pipermail/delphi/2002-December/022409.html

Thanks again,
Kris
Post by Bruce Roberts
Post by KKF
Thanks, I downloaded the VT - it's very useful, but all in all I need the
- how do I draw the ellypsis button,
- how to handle a click event from it,
- how to display a popup listbox (standard TInplaceEdit from Grids unit)
I abandoned the vcl grid some time ago, so I'm not sure how appropriate
these comments will be (although the approach will work with VT and other
grid/tree controls - like TurboPower's Orpheus Table).
Instead of drawing an ellipsis button and detecting a click on it, it is
much simpler to use an existing control. If one wants a drop-down box, i.e.
a combobox, then (in the case of a vcl grid) descend from tInPlaceEdit and
override its creation of a simple text edit, replacing it with a
tCustomComboBox. If you need a text edit with an ellipsis button on the
right, create both a tCustomEdit and a tButton (or tSpeedButton, or
tBitBtn).
Depending on your needs, you might find that you can achieve your goals by
simply overriding the CreateParams method in your custom tInPlaceEdit.
Checkout the CreateWindow and CreateWindowEx help entries in the Win SDK
help for various options that can be set in CreateParams.
Loading...