polygrid formatted column width

Paul Dupuis paul at researchware.com
Tue Feb 20 16:49:15 EST 2024


You have the dataWidth of the polygrid for the formattedWidth of the 
widget (to be wide enough to display all data), but what I think you 
want is some equivalent of the fomattedWidth of each column. I don't 
believe any such property exists in the polygrid. It would be like 
setting the columnWidth of a column to 'auto' or something like that, 
which would be a nice feature enhancement, but doesn't exists currently. 
You're welcome to file a feature enhancement. I'd definitely +1 it.

You would have to roll your own, probably using the 
"measureText(text,objectReference,[mode])" function. You would need to 
iterate through all the rows of data and find the longest string (in px) 
for each column via measureText and then set the columnWidths of the 
polygrid to that set of column widths. I am also not sure if measureText 
can use a widget as an object reference, so, if not, you may need a 
hidden field/button as teh object reference set to the same font and 
size as the polygrid.

Anyway, that's how I would try to solve this :-)

Paul Dupuis
Researchware

On 2/20/2024 3:49 PM, Mike Kerner via use-livecode wrote:
> alrighty, then
> i've got a polygrid. now, i want to set the column widths to the equivalent
> maximum formatted widths, because...this is being used as part of an ad hoc
> query tool.
> did i miss something? i don't see an equivalent property
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode




More information about the use-livecode mailing list