How to close a patch window


    Sep 05 2006 | 8:09 am
    Hi all,
    I'm making a kind of patch browser.
    I hope to open a patch and close it via messages.
    My first idea is "load" message to "pcontrol" object.
    But there's no way to close it. (without modifying target patches)
    Second idea is "openfile" and "closefile" messages to Max application.
    For example,
    ; max openfile mysymbol kazoo.pat
    then
    ; max closefile mysymbol
    But if user close the patch by himself, the messages doesn;t work any
    more.
    (I%(B error: closefile: no patcher associated with mysymbol
    (I%(B error: openfile: mysymbol: symbol in use
    Is it possible to clear symbol in use ?
    Or any other idea ?
    I'm glad if someone could help me....
    Thank you.
    Best,
    Masayuki Akamatsu

    • Sep 05 2006 | 12:35 pm
      there is the dispose message to the thispatcher object.
      for more advanced window management look at the wmangle external.
      cheers
      //yac
      > Hi all,
      >
      > I'm making a kind of patch browser.
      > I hope to open a patch and close it via messages.
      >
      > My first idea is "load" message to "pcontrol" object.
      > But there's no way to close it. (without modifying target patches)
      >
      > Second idea is "openfile" and "closefile" messages to Max application.
      >
      > For example,
      > ; max openfile mysymbol kazoo.pat
      > then
      > ; max closefile mysymbol
      >
      > But if user close the patch by himself, the messages doesn;t work any
      > more.
      >
      > (I%(B error: closefile: no patcher associated with mysymbol
      > (I%(B error: openfile: mysymbol: symbol in use
      >
      > Is it possible to clear symbol in use ?
      > Or any other idea ?
      >
      >
      > I'm glad if someone could help me....
      >
      >
      > Thank you.
      >
      > Best,
      > Masayuki Akamatsu
      >
      >
    • Sep 05 2006 | 2:41 pm
      Hi Yacine,
      Thank you for reply
      On 2006/09/05, at 21:35, Yacine Sebti wrote:
      > there is the dispose message to the thispatcher object.
      I don't want to change the target patches.
      I want to close the patch that is not mine.
      > for more advanced window management look at the wmangle external.
      wmangle is not stable (even in Max 4.5), isn't it?
      And it has no function to close the patch.
      Thank you.
      Best,
      Masayuki
    • Sep 05 2006 | 6:00 pm
      > I don't want to change the target patches.
      dispose is to close the patcher not to 'change the target patches'(?).
      > I want to close the patch that is not mine.
      why would you close other people's patches.
      > wmangle is not stable (even in Max 4.5), isn't it?
      > And it has no function to close the patch.
      there I can't say, I only used it once and I remember it handeled transparancy and other stuff.
      here is an example of how to close a patch using [pcontrol] or [thipatcher]
      I guess it's only a misundurstanding, it should work for you as it does for me.
      bye
      //yac
    • Sep 05 2006 | 6:57 pm
      sorry I forgot to post the example.
      here it is:
    • Sep 06 2006 | 12:20 am
      Thank you for your reply and example, Yacine.
      On 2006/09/06, at 3:00, Yacine Sebti wrote:
      > why would you close other people's patches.
      My explanation is not so good. Sorry.
      Here's a patch I'm working on (and it is not completed).
      This is an object browser (in Japanese).
      You can open a help patch on double-clicking on the right list.
      (The left is a product list and the middle is a category list.)
      I hope to close a help patch before another help is opened.
      I'm opening standard help patches (of course, they are not mine).
      Thus I don't want to modify them.
      In this browser, it is not too bad to open multiple help patches.
      But in another browser, it is important to keep only one patch open.
      Thank you.
      Best,
      Masayuki
    • Sep 07 2006 | 7:31 am
      Masayuki Akamatsu wrote:
      > But if user close the patch by himself, the messages doesn;t work any
      > more.
      If you keep track what is opened, you can close them with a closebang
      object in case the patcher which opened it is closed by the user...
      Stefan
      --
      Stefan Tiedje------------x-------
      --_____-----------|--------------
      --(_|_ ----|-----|-----()-------
      -- _|_)----|-----()--------------
      ----------()--------www.ccmix.com
    • Sep 07 2006 | 10:35 am
      the only solution I found is to dinamicly create a bpatcher with the help file in it.
      I also found a way to extract the size and position of the original window from the binary file to
      reproduce them.
      the problem is you can't edit the help file to copy some elements.
      otherwize this works well... have a look.
      best
      //yac
    • Sep 09 2006 | 9:15 am
      Hi Yacine,
      On 2006/09/07, at 19:35, Yacine Sebti wrote:
      > the only solution I found is to dinamicly create a bpatcher with
      > the help file in it.
      It looks so nice.
      > I also found a way to extract the size and position of the original
      > window from the binary file to
      > reproduce them.
      Great work!
      > the problem is you can't edit the help file to copy some elements.
      > otherwize this works well... have a look.
      Sure. But it might be useful for other purpose.
      Thank you again.
      Best,
      Masayuki
    • Sep 10 2006 | 8:50 am
      hello Masayuki,
      i found two solutions to your problem:
      - one is using the javascript object-model in max.
      access the frontwindow then iterate through all the open windows
      until you find the one that has the same title as the patcher you
      want to close. then send the "wclose" message to the window's
      this.patcher.
      - the other one is using the [; max openfile foo filename] message to
      open and the corresponding [; max closenfile foo] message to close
      the file.
      see attached patches and script.
      cheers
      /*j
      //////////////////////////////
      save as patcher_close.js
      //////////////////////////////
      /*
      * javascript to close remote patcher by name - jasch 20060909
      */
      function close(patchername)
      {
      var w = max.frontpatcher.wind;
      while(w){
      if(w.title == patchername){
      w.assoc.message("dispose");
      }
      w = w.next;
      }
      }
      //////////////////////////////
      save as helpbrowser.mxb
      //////////////////////////////
      max v2;
      //////////////////////////////
      save as helpbrowser2.mxb
      /////////////////////////////
      max v2;
      (the problem with this approach is that when you close the patcher in
      another way, the symbol __browse__ doesn't get freed, and therefore
      you can't assign a new file to that name. solution: incrementally
      number your symbols and keep track of the number $1_browse__ etc.)
    • Sep 10 2006 | 11:44 am
      Hi jasch,
      On 2006/09/10, at 17:50, /*j wrote:
      > - one is using the javascript object-model in max.
      Perfect !!
      It's suitable to my situation.
      Thank you very much.
      Best,
      Masayuki