Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2013-12

Vertical String Grid

6 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Graeme Geldenhuys

Hi Richard,

Richard Mace wrote 7 lines
I've found the String Grid which looks great with all it's functionailty in, however, is there a way where it can be changed to vertical, effectively so that the columns are rows down the left, like the value list?

The StringGrid is a often overlooked component, as is indeed very flexible. For the "vertical look", simply implement custom cell painting. You can then make the stringgrid look like anything you want. It's also easier than it sounds.

Regards,
Graeme

Reply by email

Richard Mace
to Graeme Geldenhuys

Thanks for your response and I'm sure it is easy but i wouldn't know where to start. Could you give me any hints or example code? Richard

"Graeme Geldenhuys" wrote 30 lines
Hi Richard, On Tuesday 03/12/2013 at 12:06, Richard Mace wrote: > > > I've found the String Grid which looks great with all it's functionailty > in, however, is there a way where it can be changed to vertical, > effectively so that the columns are rows down the left, like the value list? > > The StringGrid is a often overlooked component, as is indeed very flexible. For the "vertical look", simply implement custom cell painting. You can then make the stringgrid look like anything you want. It's also easier than it sounds. Regards, Graeme -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20131203/a23a4ca6/attachment.html>

Reply by email

Graeme Geldenhuys
to Richard Mace
Richard Mace wrote
Could you give me any hints or example code?

You can do whatever painting you want in the OnDrawCell. Combine that with hiding the column titles and grid lines, and pretty much have a blank canvas to paint anything. Google TStringGrid and OnDrawCell.

Here are some results:

http://forum.lazarus.freepascal.org/index.php?topic=7529.0

http://docwiki.embarcadero.com/CodeExamples/XE4/en/OnDrawCell_%28Delphi%29

http://stackoverflow.com/questions/3540570/delphi-how-to-make-cells-texts-in-tstringgrid-center-aligned

Here are some of my own results:
http://geldenhuys.co.uk/~graemeg/stringgrid1.png
http://geldenhuys.co.uk/~graemeg/stringgrid2.png

Regards,
Graeme

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/

Reply by email

Richard Mace
to Graeme Geldenhuys

Hi Graeme,
Sounds very interesting, however, I think it is a bit higher than my current coding knowledge. Also, your application looks amazing, what components are you using that aren't installed with the defaul Lazarus install?

Also, how long do you think it would take to set a new property onthe StringGrid to have "orinetaion: Horizontal or Vertical" to make things really easy?

Richard

Graeme Geldenhuys wrote 37 lines
On 2013-12-03 15:12, Richard Mace wrote: > Could you give me any hints or example code? You can do whatever painting you want in the OnDrawCell. Combine that with hiding the column titles and grid lines, and pretty much have a blank canvas to paint anything. Google TStringGrid and OnDrawCell. Here are some results: http://forum.lazarus.freepascal.org/index.php?topic=7529.0 http://docwiki.embarcadero.com/CodeExamples/XE4/en/OnDrawCell_%28Delphi%29 http://stackoverflow.com/questions/3540570/delphi-how-to-make-cells-texts-in-tstringgrid-center-aligned Here are some of my own results: http://geldenhuys.co.uk/~graemeg/stringgrid1.png http://geldenhuys.co.uk/~graemeg/stringgrid2.png Regards, Graeme -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20131209/ded14042/attachment.html>

Reply by email

Graeme Geldenhuys
to Richard Mace
Richard Mace wrote
Sounds very interesting, however, I think it is a bit higher than my current coding knowledge.

It's not that hook into the custom paint events of TStringGrid. Then use whatever Canvas paint methods to paint the look you want.

Also, your application looks amazing, what components are you using that aren't installed with the defaul Lazarus install?

The screenshots I posted was done in Delphi using a few standard TStringGrid components flush against each other. Scrolling was synchronised between grid instances.

The standard LCL TStringGrid should be able to do exactly the same.

For the last few years I have been using fpGUI Toolkit as my GUI toolkit of choice - as it is 100% custom drawn. Thus gives me full control to customise my apps as I need, and guaranteed to work and look identical on all platforms.

Also, how long do you think it would take to set a new property onthe StringGrid to have "orinetaion: Horizontal or Vertical" to make things really easy?

No idea as I don't know the internals of the LCL TStringGrid design.

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/

Reply by email