[Gambas-user] popup Menu question

Benoit Minisini gambas at ...1...
Wed May 24 13:13:37 CEST 2006


On Wednesday 24 May 2006 03:38, ron wrote:
> Hello
>
> I have implemented a drag and drop function.
> At the moment of drop I need an answer on a popup menu.
> So I made a menu of 2 choises and use .pop
>
> PUBLIC SUB grdDrop2()
>   DIM hMenu AS Menu
>   IF NOT hMenus THEN hMenus = NEW Menu(ME)
>   ME.hMenus.Children.Clear
>   hmenu = NEW menu(hMenus) AS "grdAction2"
>   hmenu.Caption = "Move"
>   hmenu.tag = FALSE
>   hmenu = NEW menu(hMenus) AS "grdAction2"
>   hmenu.Caption = "Swap"
>   hmenu.tag = TRUE
>   hmenus.Popup
> END
> PUBLIC SUB grdAction2_Click()
>  bMove = LAST.tag
> END
>
> in the drop sub
>
> if drag.source=a then
>  ...
> endif
> if drag.source=b then
>   grdDrop2
>   if bMove then
>     'do move
>   else
>     'do swap
>   endif
> endif
>
> Now I found when I use move several times it moves
> When I use then swap it does move and on repeat the swap again
> it does the swap.
> The chosen menu entry is delayed 1 drop/click, it's not direct
> used but the next time I do the drop.
> Using
> ..move1,swap2,move3,swap4,swap5,swap6  does
> ..swap0,move1,swap2,move3,swap4,swap5
>
> Ron
>

OK, I understand... The menu click events are posted, they are delivered one 
event loop cycle later, and so after the Popup method returns.

As a workaround, you can add a WAIT instruction after Popup. I will try anyway 
to fix that problem.

Regards,

-- 
Benoit Minisini





More information about the User mailing list