How to catch drag & drop views?

About Monkey 2 Forums Monkey 2 Programming Help How to catch drag & drop views?

This topic contains 4 replies, has 2 voices, and was last updated by  nerobot 2 years, 7 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #3511

    nerobot
    Participant

    I need to catch MouseDown on one view (1) and MouseUp on other view (2).

    Then decide – what to do (or nothing) according with view1 and view2.

    Have ideas – How ?

    #3513

    Mark Sibly
    Keymaster

    You currently can’t (easily) – MouseDown ‘captures’ a view so that all successive mouse events until the next MouseDown are sent to the same view.

    There’s a hidden method in View called ‘FindViewAtWindowPoint’ that could be used to help here – you’d need to transform the mouse location to ‘null’ (ie: window coords) and then pass this to ‘FindViewAt…’ – but there really needs to be a better way to do this.

    #3514

    Mark Sibly
    Keymaster

    Something like this might work:

    Like I say, FindViewAtWindowPoint is technically ‘hidden’ right now, but we need some way to do this so have a play and let me know what you need!

    #3537

    nerobot
    Participant

    I tried it, and dropView isn’t null, but how to check type of this view to debug? and type of any variable?

    If I up mouse at TextVew and check it with

    then ‘tv’ is null.

    And what about App.MouseView property?

     

    UPD: I can’t catch MouseUp for MainWindow because event was eaten by some child.

    Thanks for App.MouseEventFilter += OnMouseEventFilter.

    #3546

    nerobot
    Participant

    So,

    1.

    Local point:=TransformPointToView( event.Location,Null )

    and event.Location is the same position.

    Also, this position is relative to view which mouse is over.

    2.

    dropView := FindViewAtWindowPoint(point) – isn’t null, but I don’t know what is it. I press mouse on TreeView, then get that^ dropView and check it via

    Probably, FindViewAtWindowPoint expecting of global position but we put local. Don’t know how to make it global.

    3.

    event.View property – not null but not my TreeView. when it assigning?

    4.

    When I drag mouse to TextField and up it – don’t see MouseUp event inside TextField.

    5.

    MouseEnter / MouseLeave – doesn’t works.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.