• Login
sketchucation logo sketchucation
  • Login
🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

@Jim and other coders

Scheduled Pinned Locked Moved Developers' Forum
6 Posts 4 Posters 621 Views 4 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    Didier Bur
    last edited by 16 Sept 2008, 17:30

    Hi Jim and all,

    I just discovered that the method "OnTransactionEnd" of the ModelObserver class doesn't work or doesn't exist.
    It tried a logic name "OntransactionCommit" and it worked as expected 🎉

    DB

    1 Reply Last reply Reply Quote 0
    • A Offline
      AdamB
      last edited by 16 Sept 2008, 18:56

      Hi Didier,

      With a language like Ruby that supports reflection you can always query objects to see what they actually do respond to:

      Sketchup::ModelObserver.new.methods - Object.methods

      gives:

      ["onDeleteModel", "onTransactionAbort", "onSaveModel", "onTransactionRedo", "onTransactionStart", "onTransactionUndo", "onTransactionEmpty", "onEraseAll", "onTransactionCommit"]

      So perhaps its called "onTransactionCommit"

      Developer of LightUp Click for website

      1 Reply Last reply Reply Quote 0
      • J Offline
        Jim
        last edited by 16 Sept 2008, 20:30

        Check the method index also. It has methods that have are not listed on the individual pages - even if they lack documentation.

        Hi

        1 Reply Last reply Reply Quote 0
        • A Offline
          AdamB
          last edited by 17 Sept 2008, 10:45

          @jim said:

          Check the method index also. It has methods that have are not listed on the individual pages - even if they lack documentation.

          Totally agree. However using the methods() method is 'straight from the horses mouth' as it were. No worrying whether the docs are right / up to date etc. If it reports there is a method called "blah", it is 100% certain there is a method called that.

          Adam

          Developer of LightUp Click for website

          1 Reply Last reply Reply Quote 0
          • J Offline
            Jim
            last edited by 25 Sept 2008, 01:07

            @adamb said:

            @jim said:

            Check the method index also. It has methods that have are not listed on the individual pages - even if they lack documentation.

            Totally agree. However using the methods() method is 'straight from the horses mouth' as it were. No worrying whether the docs are right / up to date etc. If it reports there is a method called "blah", it is 100% certain there is a method called that.

            Adam

            That right, even if the method is not part of the API and was created by another plugin.

            Hi

            1 Reply Last reply Reply Quote 0
            • A Offline
              azuby
              last edited by 25 Sept 2008, 07:46

              Using Object#respond_to? should also be possible. And if you really want to use "OnTransactionEnd", set an alias on "OntransactionCommit"

              azuby

              *error initus :: Blocks | CurrentDate | d/Code | extensionmanager | FFlipper | HideEdges | MeasuredArea | ModelHistory | PluginsHelp | PronButton | SAWSO | SCP | SU²CATT

              Bad English? PM me, correct me. :smile:**

              1 Reply Last reply Reply Quote 0
              • 1 / 1
              • First post
                Last post
              Buy SketchPlus
              Buy SUbD
              Buy WrapR
              Buy eBook
              Buy Modelur
              Buy Vertex Tools
              Buy SketchCuisine
              Buy FormFonts

              Advertisement