[Gambas-user] Problem on events

Fabien Bodard gambas.fr at gmail.com
Mon Feb 4 15:54:37 CET 2019


ok Found it... the problem was in fact in the form declaration

When I've created the DrawingArea for a menu element then I did it like :

hdaItem = New DrawingArea(HPanel) as "Item"

The proplem was it link it to the menu class from wich is called the
popup() function.

so in my case the basis one who have not Handle : Private $hMenuMode
As New MyMenu

So I've correct it in the popup function by doing :

    hdaItem = New DrawingArea(HPanel)
    Object.Attach(hdaItem, hMenu, "Item")

where hMenu is the children element created on the fly.

So now it Work :)

For Each hMenu In $aChildren
    If hMenu.Picture Then
       H = Max(hForm.Font.Height, hMenu.Picture.Height) + 2 * iPadding
       W = Max(hForm.Font.TextWidth(hMenu.Text) + hMenu.Picture.w + 2
* iPadding, W)
    Else
      H = hForm.Font.Height + 2 * iPadding
      W = Max(hForm.Font.TextWidth(hMenu.Text) + 2 * iPadding, W)
    Endif

    FH += H

    hdaItem = New DrawingArea(HPanel)
    Object.Attach(hdaItem, hMenu, "Item")
    hdaItem.Height = H
    hdaItem.Tag = hMenu
  Next

Le lun. 4 févr. 2019 à 15:37, Fabien Bodard <gambas.fr at gmail.com> a écrit :
>
> Well I've not well tested as I test on Last that return the Item
> parent... it's the menu.
>
> But if i Do
> Object.parent(ME) in the mymenu class it return nothing despite the
> fact I have given an event handler and the class have an event.
>
> So... what ?
>
> Le lun. 4 févr. 2019 à 11:02, Fabien Bodard <gambas.fr at gmail.com> a écrit :
> >
> > Is someone can explain me why the attached parent of MyMenu is a
> > mymenu and not FMain ?
> >
> > (result of (Object.Parent))
> >
> > I hate circular reference is it a way to help me to know wich variable
> > are in circular reference ?
> > and not freed
> >
> >
> > --
> > Fabien Bodard
>
>
>
> --
> Fabien Bodard



-- 
Fabien Bodard


More information about the User mailing list