sketchucation logo sketchucation
    • Login
    πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Cross linking two web dialogs

    Scheduled Pinned Locked Moved Developers' Forum
    10 Posts 4 Posters 1.1k 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.
    • chrisglasierC Offline
      chrisglasier
      last edited by

      Probably dead obvious but could any kind member tell me how should I refer to the web console elements from the machine's scripts in this example situation:
      Convert text to array.png
      (I will also want to change the textareas and menus from the machine)

      Thanks

      Chris

      With TBA interfaces we can analyse what is to be achieved so that IT can help with automation to achieve it.

      1 Reply Last reply Reply Quote 0
      • thomthomT Offline
        thomthom
        last edited by

        You'd have to pass the commands/data from the sender to ruby, then ruby must forward it to the other one. No way they can communicate directly.

        Think Martin has been looking into the same thing.

        Thomas Thomassen β€” SketchUp Monkey & Coding addict
        List of my plugins and link to the CookieWare fund

        1 Reply Last reply Reply Quote 0
        • chrisglasierC Offline
          chrisglasier
          last edited by

          Yes I remember that thread but somehow it seemed more exercise in technical prowess rather than real problem solving and I got lost (as you may have realised I'm a reluctant coder). Maybe Jim will want to enter the debate when he wakes up - it's his webconsole I'm (ab)using after all.

          With TBA interfaces we can analyse what is to be achieved so that IT can help with automation to achieve it.

          1 Reply Last reply Reply Quote 0
          • J Offline
            Jim
            last edited by

            Something like this maybe (not tried) Add your own instance methods to handle and simplify specific operations.

            I'll try to get a working example, unless someone else wants to help.

            
            class CgDialog < UI;;WebDialog
              def initialize(*args)
                super
                # add_action_callback("some_callback) { |d, a| nil }
                add_callbacks
                @others = []
              end
              def add_callbacks
                add_action_callback("some_callback") { |d, a| 
                   call_on_others( "some_method", arg1, arg2 ) # from inside a callback
               }
              end
              def add_other(o)
                @others.push(o)
              end
              def call_on_others(meth, *args)
                @others.each { |o| o.call(meth, args) }
              end
              def some_method(arg1, arg2)
                # ...
              end
            end
            
            dialog1 = CgDialog.new
            dialog2 = CgDialog.new
            dialog1.add_other(dialog2)
            dialog1.call_on_others("set_size", 250, 250) # from outside a callback
            
            
            

            Hi

            1 Reply Last reply Reply Quote 0
            • M Offline
              MartinRinehart
              last edited by

              @thomthom said:

              You'd have to pass the commands/data from the sender to ruby, then ruby must forward it to the other one. No way they can communicate directly.

              Think Martin has been looking into the same thing.

              VisMap Pro shows two WebDialogs, but it uses the simplest case: All "dialog" is done in one, the second simply displays data (updated as required from Ruby). I've tried two dialogs that both chat with Ruby, but that quickly runs into multi-threading issues: the Ruby is possibly running on its own thread and on the threads of its callbacks.

              Author, Edges to Rubies - The Complete SketchUp Tutorial at http://www.MartinRinehart.com/models/tutorial.

              1 Reply Last reply Reply Quote 0
              • chrisglasierC Offline
                chrisglasier
                last edited by

                @martinrinehart said:

                VisMap Pro shows two WebDialogs ...

                This is about two separate applications interacting, which, in the light of Thomas' comment is why I think Jim's coding is worth pursuing.

                But thanks for the info on VisMap PRO.

                With TBA interfaces we can analyse what is to be achieved so that IT can help with automation to achieve it.

                1 Reply Last reply Reply Quote 0
                • J Offline
                  Jim
                  last edited by

                  @chrisglasier said:

                  This is about two separate applications interacting, which, in the light of Thomas' comment is why I think Jim's coding is worth pursuing.

                  My misunderstanding - my example is not 2 applications. I assumed a single plugin using 2 webdialogs.

                  Hi

                  1 Reply Last reply Reply Quote 0
                  • chrisglasierC Offline
                    chrisglasier
                    last edited by

                    @jim said:

                    My misunderstanding - my example is not 2 applications. I assumed a single plugin using 2 webdialogs.

                    It could be one plugin with two dialogs or even one dialog but that would make it one-off rather than one module in a series of applications that can work interactively. Let me finish the API machine to explain better. In the meantime here are some stray thoughts:

                    The lowest common denominator is the plain text record.
                    Every device (like the console) can open it and draw from it both instructions and content.*
                    Each device just needs to be nudged to refresh to perform a required task.

                    Can you see any problem with any of this?

                    Chris

                    Edit *e g to transform into a different display

                    With TBA interfaces we can analyse what is to be achieved so that IT can help with automation to achieve it.

                    1 Reply Last reply Reply Quote 0
                    • chrisglasierC Offline
                      chrisglasier
                      last edited by

                      Meanwhile I have been working on the lists:

                      apimAnimated.gif

                      Commands in the menu are for manually converting Alex's raw data into a key/value based comma separated string and for checking the resultant array. These will be removed once I can pick up the data automatically directly or via the console.

                      The first column is both for display and console data exchange options, so I would welcome any suggestions for these ... or anything else really.

                      With TBA interfaces we can analyse what is to be achieved so that IT can help with automation to achieve it.

                      1 Reply Last reply Reply Quote 0
                      • chrisglasierC Offline
                        chrisglasier
                        last edited by

                        Cross linked thanks to Jim!


                        OneTwoAnimated.gif

                        With TBA interfaces we can analyse what is to be achieved so that IT can help with automation to achieve it.

                        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