[Gambas-user] Buttons again not working
Benoît Minisini
gambas at ...1...
Wed Dec 9 17:43:49 CET 2009
> I don't understand why is the handling of dynamically created forms so
> complicated!
> I've barely managed to shut a modal dialog, I'm encountering a new problem:
>
> when I invoke the procedure Messenger:
>
> PUBLIC SUB Messenger(tekst AS String, slika AS String)
> DIM imge AS PictureBox
> DIM conti AS TextLabel
> DIM butty AS Button
> DIM i AS Integer
> keret = NEW Form
> keret.Width = 500
> keret.Height = 300
> keret.Border = FALSE
> imge = NEW PictureBox(keret)
> imge.x = 10
> imge.y = 10
> imge.Width = 280
> imge.Height = 280
> imge.Border = TRUE
> imge.Picture = Picture[slika]
> conti = NEW TextLabel(keret)
> conti.x = 300
> conti.y = 20
> conti.Width = 190
> conti.Height = 230
> conti.Text = tekst
> butty = NEW Button(keret)
> butty.x = 340
> butty.y = 250
> butty.Width = 120
> butty.Height = 25
> butty.Text = "OK"
> keret.Center
> Object.Attach(butty, ME, "Ops")
You should write:
butty = NEW Button(keret) AS "Ops"
to have the same effect.
You should use the Move() method instead of setting the X, Y, Width and Height
properties individually.
> keret.ShowModal()
> END
>
> PUBLIC SUB Ops_Click()
> keret.Close()
> END
>
> from within the
> PUBLIC SUB _new()
> ...
> Messenger("blabla.txt","blabla.jpg")
> ...
> END
>
> procedure,
>
> I cannot communicate with the button "butty".
What do you mean exactly by "communicate"? Can you provide the full source
code in a project, we will better understand what you want to do.
Beware that an object is locked during its _new() so it cannot receive events.
Regards,
--
Benoît Minisini
More information about the User
mailing list