Forum > General

Buttons in stringgrid always visible?

(1/2) > >>


I'm using a stringgrid with 8 rows and three columns. In the last column I want to display 8 buttons.
All the 8 buttons are always visble. (= not only visible when the cell is selected).

I looked at this thread to fit the buttons in the cells but it doesn't work.


The button appears only in the selected cell. The option ' alwaysshoweditor' doesn't do anything.

Does anybody has a solution for this?

Thanks in advance

if you want to have 8 buttons in each cell of las column that makes 64 independent buttons. I think grids internal editor support will not help you in this case because they were designed to show the editor only on selected cell, the exception is cbsCheckboxColumn which shows a checkbox always, but that is custom drawn

if the grid is not scrollable, I guess you can do it pretty much by just caculating the coords of the 64 buttons and put them on the grid, if grid it's scrollable you have to take in count some events in order to reposition them.

other way doing is like the case of checkboxcolumn, drawing the buttons your self, using themes support you can draw the buttons to look much like ordinary buttons, in this case you have to handle mouse events on buttons your self too, but you only have to draw the 1 button eight times at different position using OnDrawCell, in this method scrollable or not doesn't matter.

Hello JesusR,

I only want 1 button per row. The grid has 8 rows so 8 buttons in a column.
The grid is not scrollable so calculating the position for a button control array is indeed possible.
I'm going to look into that.

In Delphi there are grids (like the Advanced Stringgrid) which already have all this functionallity. I was also wondering if there are that kind of grids available for Lazarus.

Oh so I misunderstood, instead of 8 buttons per cell is just one, for standard grid the options do not change too much.

I have seen some people talk about kgrid and orpheus grids. Some developers had converted some thirdparty grids like adv? grids or something but I have not used any of them, lets wait they pronounce them selves if those grids can make the job.

Just for curiosity, in the grid you know which can use buttons, the button occupy the whole cell area?, just a part and is aligned?, the button has caption?

I don't want to use ported grids from Delphi which aren't free. TMS grids aren't free.
I used to work with Delphi for my former employer and choose Lazarus because it's free. Now (as a hobby) I'm making commercial software so it has to be legal. Don't have the money (yet) to buy a Delphi licence and I probably never will buy one because Lazarus can do everything I want.

The buttons occupy the whole cell (in column 3). When clicked a list pops up. From this list 1 item can be selected which is then shown is column 2. See the attachment

I tried the 'draw and place your own' method and it works ! It's a lot of coding works


[0] Message Index

[#] Next page

Go to full version