coll format: how to display float numbers and text?

Peter Ostry's icon

I don't find a description of the coll data format.

I want to display
1.0 kHz
in a message object but coll just gives me
1. kHz

Tried the following versions:
0, 1.0 kHz;
1, "1.0" kHz;
2, 1.0 "kHz";
3, "1.0 kHz";
But nothing works, I get always 1. kHz
Obviously coll treats the number as float and omits the zero. Other numbers like 1.2 are ok.

This coll is static, it loads a file. Is there a way to write the coll data properly for the 1.0 output or do I have to format the float number after the readout from coll?

AlexHarker's icon
Max Patch
Copy patch and select New From Clipboard in Max.

What's coming after your coll? The last of these works for me....

Alex

Peter Ostry's icon

Ah ok, this is what I got also. Then I guess it isn't a coll thing and I asked the wrong question.
-----
Your example prints
1.0 kHz
but in a message box it displays
"1.0 kHz" (with quotes)
-----
Without the quotes message boxes show
1. kHz
-----
But I need it for a user interface. How can I display 1.0 kHz without the quotes? I could use an inactive text button, this displays correctly. But I am not the only one making interfaces, there must be another, usual way, not?

-

Max Patch
Copy patch and select New From Clipboard in Max.

Luke Hall's icon

This is just the way max works with numbers. You could always try to [prepend set] it into a [comment] if you don't have to use a message box.

lh

Peter Ostry's icon

Yes this works, seems to be the normal way. Thank you.

But the problem had a good effect also. I found that a text button takes the float number as a string, with [prepend text]. And an advantage for this interface is, that text buttons can get aligned. Center or right is good for showing sound parameters.

seejayjames's icon
Max Patch
Copy patch and select New From Clipboard in Max.

I thought [sprintf] could do something here, like %.2f? Maybe it's not what you need though. I like the textbutton approach.

Peter Ostry's icon

No, sprintf does not help here. Values like 1.2 or 1.01 are no problem but once the quotes are gone, the message box sees the number as a float and 1.0 or 1.00 becomes 1. without the zero.

But thanks for trying!