creating a message box

Robin Price's icon

i can create a message box but how do i set it's contents ? i can send it a set message but how do i do it during its creation ala newdefault.

when i set with a set message i get double quotes, how do i get rid of these?

robin xx

Robin Price's icon

I got rid of the quotes, still wondering how to set a message box's contents on creation.

Emmanuel Jourdan's icon

Please post an example of what you're currently doing.

Luke Hall's icon

Try something like these examples, the first one is like sending a message to [thispatcher] and the other uses newdefault

var myobj = this.patcher.message("script","newobject","message","@text","hello");
var myobj = this.patcher.newdefault(300,400,"message","@text","hello");

lh

Robin Price's icon

cheers lh, that's what i was looking for

lut lei's icon

I'm having a hard time figuring out how do make messages like "rate $1".

Obviously, these don't work for me:

function makemess(){
var mess1 = this.patcher.newdefault(50,150,"message", "@text", "rate $1");
var mess1 = this.patcher.newdefault(50,200,"message", "@text", "rate", "$1");

Help will be appreciated.

Luke Hall's icon

var myobj = this.patcher.message("script", "newobject", "message", "@text", "rate $1"); should work for you.

lh

lut lei's icon

Yes, it does, thank you. Wonder why the newdefault method doesn't work like this, though. I know I had it working that way also, at one point, but then I broke it when I rewrote some code yesterday.

Robin Price's icon

@lut lei I had that problem with new default too. Thanks lh

lut lei's icon

I guess using newdefault have few advantages over newobject, when it comes to messageboxes, anyway.