Lister Comp, difficulty making a Toggle

Hey Guy’s and Gal’s,

 Going through the Lister comp in the pallet and looking over the WiKI [docs.derivative.ca/index.php?ti ... tte:lister](https://docs.derivative.ca/index.php?title=Palette:lister) I see sugestions on how to set up a toggle button value for a row, but I can't seem to sort it out. I am making a video playlist and I need a [b]loop[/b] and [b]link[/b] toggle button. I see this

And I change the colDefine as indicated, just don’t see where to go from there…

Any help is appreciated.

thx
deadsound

I need to make a nice example of this in the wiki, but hopefully the following will get you by for now:

In the attached tox, look at the column definitions, the btnImage TOPs, and the callbacks.

Relevant parts of lister wiki:

sourceDataMode: the type of data stored in the column cells. In addition to formatting, this mode defines the way sorts are performed. Anything besides the following values will result in str().
int, float or string fetches values via sourceData.
constant uses the literal sourceData string in the colDefine table.
color uses sourceData and takes a list of [r, g, b, a] or [r, g, b, a, “text”] (anything else will be treated as text with no color)
repr displays repr(sourceData)
eval treats sourceData as an expression to evaluate, with the row object available as “object”. For example, to get the objects class name, you could set sourceData to object.class.name.
blank does not display any text, no matter what the value is, but keeps the value in the lister’s Data list. This can be useful with the * mode below.

topPath: path to top with graphic to display in cells. Paths are relative to this config comp. To make a top that changes on roll and press, create tops with names Roll and Press. If the path ends with *, the text value of the cell will be added to the path. This is useful for buttons with different states, such as toggles. For example, a topPath of switch would look for switchTrue or switchFalse if the cell held a bool value. Roll and Press will then be appended to those names for roll and press states.
listerToggles.tox (27.8 KB)

Hi Ivan, I am attempting to use this example, but for some reason the lister is not updating when the input dat changes values. Is there an updated approach that I need to take? Only when I click the refresh button the values update properly.

2021.16410

Thank you!

Ah yeah looks like there were some underlying changes that broke that example. Here is a working version.
listerToggles.5.toe (7.6 KB)

Thanks Ivan, this is perfect!