'@bgfillcolor', 0.3, 0.3, 0.3, 1 doesn't work for the [message] object

Martin.Jirsak's icon

Hi all,

I try to make a message object from Javascript. I have found, the bgfillcolor attribute doesn't work. I always get the default colour.

I have tried this way :
var message = this.patcher.newdefault(x, y , 'message',
'@bgfillcolor', 0.3, 0.3, 0.3, 1)

And also this way:

var message = this.patcher.newdefault(x, y, 'message');
 value.setattr('bgfillcolor', 0.3,0.3,0.3,1);
Ben Bracken's icon

Something like this should work:

var message = this.patcher.newdefault(x, y, 'message');
message.setattr('bgfillcolor', 1,0.3,0.3,1);
Martin.Jirsak's icon

Hi,

What is the difference comparison to my code, please?

Ben Bracken's icon

It looks like you were trying to use setattr() on something other than the message box, 'value'?

Martin.Jirsak's icon

Hi,

Oh sorry, it's just an error when rewriting the code here. My bar is named value. To make it clear, I changed the var to message here, but not in both cases. Sorry.

Ben Bracken's icon

Maybe send along the whole code, as it is working here.

Martin.Jirsak's icon

Hi,

The code is like this:
var message = this.patcher.newdefault(x, y, 'message',
'@varname', 'message',
'@presentation_rect', x, y + 40, 40, 20,
'@annotation', 'message',
'@textjustification', 1,
'@bgfillcolor', 0.3, 0.3, 0.3, 1,
'@presentation', 1);

And I have also tried this:
var message = this.patcher.newdefault(x, y, 'message');
message.setattr('bgfillcolor', 0.3,0.3,0.3,1);

None of them is working on my side here (Max 8.3).

Ben Bracken's icon

Hmm, not sure what could be going on. You could attach a project with all of your dependencies, I'd be happy to take a look.

Martin.Jirsak's icon

Hi,

OK, you are right. It works in the empty script. Then I have to do something wrong in the function before.

Thank you