[loadbang] within [bpatcher] within clipping: not working


    Jul 16 2011 | 3:21 pm
    Hello. I'd be really grateful for thoughts on/assistance with the following, if anyone has any ideas:
    I'm trying to make some clippings (VIZZIE-like) which are configurable upon load/import by means of user entry (via [dialog]) as per the code below.
    I have, as you'll see, contained a [loadbang] within a [bpatcher], again modelling on VIZZIE _but_ embedded within the patcher (i.e. the [bpatcher] doesn't refer to an external file (there is a good reason for this)). It works fine when loading as a normal file, but when dragging the clipping into the main file from the contextual menu the [loadbang] doesn't operate. Is there any particular reason for this? Or can anyone suggest a solution?
    It's a bit complicated to explain and probably seems a bit pointless, but, again, there's a good reason for all of this!
    pete
    { "boxes" : [ { "box" : { "maxclass" : "bpatcher", "embed" : 1, "numinlets" : 0, "numoutlets" : 0, "args" : [ ], "patching_rect" : [ 418.0, 177.0, 148.0, 94.0 ], "id" : "obj-6", "patcher" : { "fileversion" : 1, "rect" : [ 418.0, 177.0, 148.0, 94.0 ], "bgcolor" : [ 1.0, 1.0, 1.0, 0.0 ], "bglocked" : 0, "defrect" : [ 418.0, 177.0, 148.0, 94.0 ], "openrect" : [ 0.0, 0.0, 0.0, 0.0 ], "openinpresentation" : 0, "default_fontsize" : 12.0, "default_fontface" : 0, "default_fontname" : "Arial", "gridonopen" : 0, "gridsize" : [ 15.0, 15.0 ], "gridsnaponopen" : 0, "toolbarvisible" : 1, "boxanimatetime" : 200, "imprint" : 0, "enablehscroll" : 1, "enablevscroll" : 1, "devicewidth" : 0.0, "boxes" : [ { "box" : { "maxclass" : "newobj", "text" : "loadbang", "fontsize" : 12.0, "numinlets" : 1, "numoutlets" : 1, "patching_rect" : [ 11.0, 8.0, 60.0, 20.0 ], "id" : "obj-4", "fontname" : "Arial", "outlettype" : [ "bang" ] }
    } , { "box" : { "maxclass" : "number", "fontsize" : 12.0, "numinlets" : 1, "numoutlets" : 2, "patching_rect" : [ 79.0, 57.0, 50.0, 20.0 ], "id" : "obj-12", "fontname" : "Arial", "outlettype" : [ "int", "bang" ] }
    } , { "box" : { "maxclass" : "newobj", "text" : "sprintf %s", "fontsize" : 12.0, "numinlets" : 1, "numoutlets" : 1, "patching_rect" : [ 11.0, 56.0, 63.0, 20.0 ], "id" : "obj-8", "fontname" : "Arial", "outlettype" : [ "" ] }
    } , { "box" : { "maxclass" : "newobj", "text" : "dialog enter number", "fontsize" : 12.0, "numinlets" : 2, "numoutlets" : 2, "patching_rect" : [ 11.0, 32.0, 117.0, 20.0 ], "id" : "obj-2", "fontname" : "Arial", "outlettype" : [ "", "bang" ] }
    } ], "lines" : [ { "patchline" : { "source" : [ "obj-8", 0 ], "destination" : [ "obj-12", 0 ], "hidden" : 0, "midpoints" : [ ] }
    } , { "patchline" : { "source" : [ "obj-4", 0 ], "destination" : [ "obj-2", 0 ], "hidden" : 0, "midpoints" : [ ] }
    } , { "patchline" : { "source" : [ "obj-2", 0 ], "destination" : [ "obj-8", 0 ], "hidden" : 0, "midpoints" : [ ] }
    } ] }
    }
    } ] }

    • Jul 17 2011 | 3:06 am
      Standard Max behaviour. You only get a loadbang when a patch is loaded from a file on disk.
    • Jul 17 2011 | 9:28 am
      Here's a tip - in all of your subpatches, abstractions, bpatches, connect [r init] to all of your [loadbang] & [loadmess] objects. In your parent patcher, hook up a bang button to [s init]. That way you can duplicate them all to your heart's content and initialise them all with one bang.
      Steve
    • Jul 19 2011 | 11:38 am
      Thanks to you both for your replies. I want to be able to initialise a patch's behaviour upon load from a clipping, so the 'universal bang' route isn't quite what I want (again, thanks though). :)
    • Jul 19 2011 | 10:34 pm
      [active] might work.
    • Jul 21 2011 | 8:58 pm
      Once again thanks, John. Actually in my fumblings I had tried that but it wasn't quite what I was after either. I've found a workaround via js now (using an abstraction (i.e. non-embedded) —[loadbang]s _will_ work in these— and then embedding subsequently. Seems to work fine. Now onto the next problem, which is retrieving the enclosing [bpatcher]'s varname from within... Always challenges...! Thanks again. :)
    • Jul 21 2011 | 10:23 pm
      Another possibility that occurs to me is for your clipping to contain a small abstraction containing a loadbang. Then the loadbang *does* get loaded from disk.
    • Jul 22 2011 | 6:22 am
      Aha! Excellent idea! Raises possibilities elsewhere too. Brilliant! Thank you. :)