Polygrid questions...
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- VIP Livecode Opensource Backer
- Posts: 137
- Joined: Wed Aug 26, 2009 7:42 pm
- Location: Randolph, MA USA
- Contact:
Polygrid questions...
I see I have the properties of a polygrid for:
pgColumns -- an array of all column properties
and
pgColumnWidths -- a comma delimited list of widths
There does not seem to be a distinct property just for alignments, such as pgColumnAlignments
What I need to do is change the width and/or alignment of a specific column (that can change which column based on data). I can se no way of doing this other than repopulating the pgColumns array
If I try
set the pgColumnWidths of widget "rwTableview" to "300,75,75,75,75,75,75,75,75"
for example, that seems to have no effect.
If I try to just change one element of the column array, such as
put "300" into tArray[1]["width"]; set the pgColumns of widget "rwTableview" to tArray, it replaces all the other column information (names, etc.) with defaults (as I would expect)
Am I missing some syntax that will allow changing the name, label, width, alignment, or whatever property desired of a single column without touching any of the other column data already set?
Also, polygrid supports the "fixedFirstCol" (true|false) property for a while now. With this set to true, the first column can contain row labels that your want always visible while the grid is scrolled horizontally. Has anyone layered a control on top of the polygrid to act as a resizer for this fixed column? Somehting to (I imagine) change the column width of the first column as the control is move left or right. Does anyone know if your need to turn fixedFirstCol off (false) first and then back on after changing the column width? If someone has build a first column resizer, would you be willing to share it?
pgColumns -- an array of all column properties
and
pgColumnWidths -- a comma delimited list of widths
There does not seem to be a distinct property just for alignments, such as pgColumnAlignments
What I need to do is change the width and/or alignment of a specific column (that can change which column based on data). I can se no way of doing this other than repopulating the pgColumns array
If I try
set the pgColumnWidths of widget "rwTableview" to "300,75,75,75,75,75,75,75,75"
for example, that seems to have no effect.
If I try to just change one element of the column array, such as
put "300" into tArray[1]["width"]; set the pgColumns of widget "rwTableview" to tArray, it replaces all the other column information (names, etc.) with defaults (as I would expect)
Am I missing some syntax that will allow changing the name, label, width, alignment, or whatever property desired of a single column without touching any of the other column data already set?
Also, polygrid supports the "fixedFirstCol" (true|false) property for a while now. With this set to true, the first column can contain row labels that your want always visible while the grid is scrolled horizontally. Has anyone layered a control on top of the polygrid to act as a resizer for this fixed column? Somehting to (I imagine) change the column width of the first column as the control is move left or right. Does anyone know if your need to turn fixedFirstCol off (false) first and then back on after changing the column width? If someone has build a first column resizer, would you be willing to share it?
Paul Dupuis
Researchware, Inc.
Researchware, Inc.
-
- VIP Livecode Opensource Backer
- Posts: 9731
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Polygrid questions...
Hi.
I have never used a polyGrid, but your comment:
Craig
I have never used a polyGrid, but your comment:
looks a lot like what one might do with a table field. My point is this: is it possible that your string of widths needs to be in array form, as opposed to a simple string of items?set the pgColumnWidths of widget "rwTableview" to "300,75,75,75,75,75,75,75,75"
Craig
-
- Posts: 40
- Joined: Sun Dec 13, 2015 6:05 pm
Re: Polygrid questions...
The syntax
is the right one, it works for me
Also you can use property 'tabStops', is a synonym for 'pgColumnWidths '
set the pgColumnWidths of widget "rwTableview" to "300,75,75,75,75,75,75,75,75"
is the right one, it works for me
Also you can use property 'tabStops', is a synonym for 'pgColumnWidths '
Last edited by prometheus on Wed Aug 23, 2023 2:18 pm, edited 1 time in total.
-
- Posts: 40
- Joined: Sun Dec 13, 2015 6:05 pm
Re: Polygrid questions...
Regarding the alignment you could get the pgColumns, iterate over each key modifying the contentAlignment, something like this:
Code: Select all
on mouseup
setColumnAlignment "right,left,right,right"
end mouseup
command setColumnAlignment pAlignments
local tColumns
local tColCount
put the pgColumns of widget "PolyGrid" into tColumns
put the numberOfColumns of widget "PolyGrid" into tColCount
local tItemCounter
repeat for each item tItem in pAlignments
add 1 to tItemCounter
if tItemCounter > tColCount then
exit repeat
end if
put item tItemCounter of pAlignments into tColumns[tItemCounter]["contentAlignment"]
end repeat
set the pgColumns of widget "PolyGrid" to tColumns
end setColumnAlignment
-
- VIP Livecode Opensource Backer
- Posts: 137
- Joined: Wed Aug 26, 2009 7:42 pm
- Location: Randolph, MA USA
- Contact:
Re: Polygrid questions...
That is what I was essentially asking. The only way to set column alignments (for example) is to get the entire pgColumns array from the widget, modify the alignment you want and then set the pgColumns of the widget to the modified array, which is what your setColumnAlignment handler does.
That's fine by me if that is the way to do it. I am a little concerned about performance, but before I write a bunch of code around a Polygrid, I just wanted to check if I was missing some hidden (to me at least) syntax that allowed setting of specific properties for specific columns.
I was imagining a syntax like:
set the pgAlignment of column "Delta" of widget "X" to "left"
OR
set the pgAlignment["Delta"] of widget "X" to "left"
Regardless of the syntax, it would be "nice" to be able to set labels, widths, alignments, etc. for a specific column without gaving to get the whole pgColumns array and then just modify the element desired and then set the whole array.
That's fine by me if that is the way to do it. I am a little concerned about performance, but before I write a bunch of code around a Polygrid, I just wanted to check if I was missing some hidden (to me at least) syntax that allowed setting of specific properties for specific columns.
I was imagining a syntax like:
set the pgAlignment of column "Delta" of widget "X" to "left"
OR
set the pgAlignment["Delta"] of widget "X" to "left"
Regardless of the syntax, it would be "nice" to be able to set labels, widths, alignments, etc. for a specific column without gaving to get the whole pgColumns array and then just modify the element desired and then set the whole array.
Paul Dupuis
Researchware, Inc.
Researchware, Inc.
-
- Posts: 40
- Joined: Sun Dec 13, 2015 6:05 pm
Re: Polygrid questions...
Totally agree, that would be very useful to have