Jump to content
Ricardo

Grid, listbox or listview responsive

Recommended Posts

Hello again.
Is there any way to show a grid with the resizeable columns?
I have tried TW3Grid adding columns and assigning their sizes.
In resize I have assigned a percentage to each column (colCode = 5, colName = 80, colState = 15, for example) and I change the width to each of the columns:
Grid1.Columns [n] .Width: = Grid.ClientWidth * colCode div 100, etc.
The new columns are displayed correctly but those that already exist do not (it seems that the rows are simple concatenations of text).
I do not know if it can be done with TW3CustomDBgrid, but I have not found examples.
It is also important that they respond to the onClick event (if it can be per cell better than per row, if possible). Maybe it is possible to use listview with several columns?

Share this post


Link to post
Share on other sites

It is not necessary, but it would be convenient. The idea is to show a list (code, customer or product name, etc. and have an onclick event to open the selected element), which is resized according to the size of the screen ... In short, make the user experience nicer. It would be fantastic!.
The possibilities are many: change the color of each cell, source, etc. But, as I say, the only essential thing is: responsive columns and the onclick event.
Can I expect it to be available for some date?

Very, very, thanks!!

Share this post


Link to post
Share on other sites

Yeah, the grid will be part of the RTL when it is finished. If you need to make a multi column list with an onclick event now, you can actually do it pretty easily with TW3ListBox.

First of all, make a custom component (TMyCustomerRow for example) for your line. It can be based on TW3CustomControl and contain child components for the customer, product etc. Just size the columns there as you want.

After that add a ListBox and set its ItemClass to TMyCustomerRow. Also set ListBox.OnShowItem to a procedure where you take care of filling the subcontrols of TMyCustomerRow according to the data you have.

In code, you add rows:
 

Item := ListBox.AdItem(Caption);
Item.TagValue := Some value you can use to know which row is being painted.
Item.TagObject := Some internal object you can use for the row painting. For example, your customer object

Those TagValue and TagObject you can use in the procedure where you fill your subcontrols. Aka: Paint the line.

Share this post


Link to post
Share on other sites

At the moment, I'm using the example of the "Tabs, Scrolling and ListBox" folder, to continue (I need to finish the application this summer). But as soon as the grid is, I update everything.
Thank you very much.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×