PolyGrid pgContentTypeOfColumn

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Lance
Posts: 23
Joined: Sat Sep 05, 2020 2:36 pm
Location: Anchorage, Alaska

PolyGrid pgContentTypeOfColumn

Post by Lance » Sun Dec 25, 2022 9:30 pm

I have sample PolyGrid with 6 columns and this code returns the correct column type for columns 1,2, &3. But returns blank for column's 4 thru 6. Perhaps this is a know issue getting past column #3?

on mouseup
ask "Which column do you want to know the type?"
put it into tColumnNumber
set the pgInternalPointer of widget "polygrid1" to tColumnNumber
put the pgContentTypeofColumn of widget "polygrid1" into tTypeOfColumn
answer tTypeOfColumn
end mouseup

thanks
Lance

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4003
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: PolyGrid pgContentTypeOfColumn

Post by bn » Wed Dec 28, 2022 7:16 pm

Hi Lance,

I cannot get the sample code from the documentation to work if the number of rows is smaller than the number of columns.

Code: Select all

on mouseUp
    local tTypeOfColumn

    # The following code shows how to get the content type of column number 5.
    set the pgInternalPointer of widget"PolyGrid" to "5" --> Column 5
    put the pgContentTypeofColumn of widget"PolyGrid" into tTypeOfColumn --> text, svg-lcname,...
end mouseUp
That means if I ask for the "contentType" of a column 5 in a polygrid with 6 columns but only 2 rows it returns empty. But for column 1 and 2 it returns "text" which is correct.
In other words if you want to know the "pgContentTypeofColumn" for column 5 your Polygrid has to have at least five rows.

I consider this a bug.

However this code works for any number of rows.

Code: Select all

on mouseup
   ask "Which column do you want to know the type?"
   put it into tColumnNumber
   
   put the pgColumns of widget "PolyGrid1" into tColumnsInfo
   put tColumnsInfo[tColumnNumber]["contenttype"] into tTypeOfColumn
   
   answer tTypeOfColumn
end mouseup
Kind regards
Bernd

Lance
Posts: 23
Joined: Sat Sep 05, 2020 2:36 pm
Location: Anchorage, Alaska

Re: PolyGrid pgContentTypeOfColumn

Post by Lance » Thu Dec 29, 2022 4:48 pm

Hello Bernd,

Thanks for confirming what I was getting and your approach worked perfectly and solved the issue.

Much appreciated.
Lance

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”