It's me again. It works well, thank you very much for your help !

Le lundi 27 janvier 2014 09:24:29 UTC+1, Chris Coat a écrit :
>
> If you can please just confirm me that the api.ExtensionContext you were 
> talking about is the context that can be found in the perform methods. 
> Didn't find the ExtensionContext in org.netlogo.api.
>
> Thanks
>
> Le dimanche 26 janvier 2014 18:28:11 UTC+1, Chris Coat a écrit :
>>
>> Thanks for those informations Seth, I'll try it soon.
>> My goal is actually to add control netlogo with multitouch gestures using 
>> the TUIO protocol. Aim to that TUIO need to know wich part of the screen 
>> should be touchable.
>>
>> Le vendredi 24 janvier 2014 17:30:20 UTC+1, Seth Tisue a écrit :
>>>
>>> >>>>> "Christopher" == Christopher Coat <[email protected]> writes: 
>>>
>>>  Christopher> I just need to find the position of the view (part of the 
>>>  Christopher> frame where patches and turtles are shown) on the frame or 
>>>  Christopher> else on the total screen coordinate. (like the getX() and 
>>>  Christopher> getY() of the appFrame but only for that component.  Hope 
>>>  Christopher> it's more clear. 
>>>
>>> GUIWorkspace has a public member field called `view`, which contains an 
>>> instance of View, which is a subclass of JComponent.  Once you have the 
>>> View, you can use standard Swing calls to find out where it is on the 
>>> screen (see e.g. http://stackoverflow.com/q/2192291/86485). 
>>>
>>> You could get to the GUIWorkspace through 
>>> `org.nlogo.app.App.app().workspace()`.  That's fine for quick-and-dirty 
>>> code, but only works if unless the user is actually running the desktop 
>>> app; it won't work in an applet or embedded InterfaceComponent.  So the 
>>> more correct method would be to take your api.ExtensionContext, cast it 
>>> to nvm.ExtensionContext, call its workspace() method, and then cast the 
>>> result to GUIWorkspace.  (If the cast fails, then the model is running 
>>> headless; if you care about handling that case, you'll need some logic 
>>> that handles the failure.) 
>>>
>>> It might help us help you if you described the actual problem you are 
>>> ultimately trying to solve.  For example, it turned out that AppFrame, 
>>> which you initially asked about, was actually irrelevant.  It leads to 
>>> me wonder whether "find the position of the view" might similarly turn 
>>> out to actually be irrelevant too, if we knew what your actual ultimate 
>>> goal was. 
>>>
>>> Hope this helps, 
>>>
>>> -- 
>>> Seth Tisue | Northwestern University | http://tisue.net 
>>> developer, NetLogo: http://ccl.northwestern.edu/netlogo/ 
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"netlogo-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to