Excellent, works like a charm. Many thanks.
(The doc says that a .Point object can be used as input to hitTestInfo,
this is not the whole truth then I guess.)
Staffan
On Fri, Sep 28, 2012 at 8:30 PM, Mark Miesfeld <miesf...@gmail.com> wrote:
> On Fri, Sep 28, 2012 at 11:16 AM, Staffan Tylen
> <staffan.ty...@gmail.com>wrote:
>
>> Correction: as I added the ::method and expose lines afterwards while
>> composing my note I forgot to include the arg statement, so the sample code
>> I use is therefore:
>>
>> :method onTreeviewContext unguarded
>> expose tree cmenu
>> use arg hwnd, x, y
>>
>>
>> pos = .Point~new(x, y)
>> say tree~hitTestInfo(pos)~hItem tree~hitTestInfo(pos)~location
>> if tree~hitTestInfo(pos)~hItem <> 0 then cmenu~show(pos)
>>
>
> The x and y sent here are in screen co-ordinates. hitTestInfo() takes
> client co-ordinates. So you need to map the screen co-ordinates to the
> tree-view client co-ordinates to use with hitTestInfo().
>
> Use the screen2client() method to map the point. That will change the x
> and y value of pos. So, if you need to retain those values, use the copy()
> method of the Point class to do that.
>
> In pseudo code it goes something like this
>
> treeView = newTreeView
>
> clientPos = pos~copy
> treeView~screen2client(clientPos)
>
> d = treeView~hitTestInfo(clientPos)
>
> I believe that is the problem and solution. If you still can't get it to
> work, then post again.
>
> --
> Mark Miesfeld
>
>
> ------------------------------------------------------------------------------
> Got visibility?
> Most devs has no idea what their production app looks like.
> Find out how fast your code is with AppDynamics Lite.
> http://ad.doubleclick.net/clk;262219671;13503038;y?
> http://info.appdynamics.com/FreeJavaPerformanceDownload.html
> _______________________________________________
> Oorexx-users mailing list
> Oorexx-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/oorexx-users
>
>
------------------------------------------------------------------------------
Got visibility?
Most devs has no idea what their production app looks like.
Find out how fast your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219671;13503038;y?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
Oorexx-users mailing list
Oorexx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-users