[Gambas-user] Catching events from dynamic control form
Jake Stookey
jstookey at ...43...
Tue Dec 9 01:37:00 CET 2003
Mandrake Linux 9.2
Gambas Version 0.72 built from source
Hello,
I recently started playing with Gambas and it's
really wonderful (from a VB 6 user).
I have one question. I would like to be able to
capture an event raised by a control form that I have
dynamically added to my main form (using NEW).
I was able to dynamically add a button control to
the main form and capture events from the button by
declaring the button -- AS "MyButton" -- and captuting
the event in -- SUB MyButton_Click --. However, I was
unable to recreate this functionality in a control
form that I created myself.
Here are the few lines of code that demonstrate my
problem.
My main form starts out completely blank, so that I
can add my control to it:
' ---------- Fmain form -------------
PRIVATE FormControl AS Fsub
PUBLIC SUB Form_Open()
' Add control form Fsub as a control on form Fmain
at run-time
FormControl = NEW Fsub(ME) AS "SubForm"
FormControl.Left = 0
FormControl.Top = 0
END
PUBLIC SUB SubForm_MyEvent()
Message("Hello!")
END
The Fsub form has a single button on it called button1
' ---------- Fsub control form -------------
' Fsub form
EVENT MyEvent()
PUBLIC SUB Button1_Click()
RAISE MyEvent()
END
The problem is that Fmain never captures the MyEvent.
Can someone tell me what I am doing wrong?
Thank you,
Jake Stookey
PS: You can download my small project from here if
that's easier:
http://www.jstookey.com/eventtest.tar.gz
__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/
More information about the User
mailing list