Cross linking two web dialogs
-
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:
(I will also want to change the textareas and menus from the machine)Thanks
Chris
-
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.
-
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.
-
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
-
@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.
-
@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.
-
@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.
-
@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
-
Meanwhile I have been working on the lists:
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.
-
Cross linked thanks to Jim!
Advertisement