-
Topic
-
Hi,
I was wondering how to call an event for a dynamically created component. I have created a new form called “MyTestForm” using the forms designer. This form contains a single panel called “pnlTest”.
Then inside my solution code I have:
Dim gTestDlg
Sub Main(Client, GWEvent)
' Initialize a new dialog from my test form
gTestDlg = MyTestForm
' Create a dynamic component at run time
Set testEdit = TEdit.Create(gTestDlg.pnlTest)
with testEdit
.Parent = gTestDlg.pnlTest
.left = 50
.top = 10
.height = 21
.width = 160
.name = "edtTest"
.text = ""
.visible = true
.onClick = "testSub"
end with
' Show the form
gTestDlg.ShowModal
End Sub
Sub testSub(Sender)
MsgBox("Called testSub")
End Sub
The edit box is created successfully, however the on click event does not get called. I have also tried a number of variations to the .onClick value attempting to pass in the sender variable, but I have not be able to get this event to be called.
Any thoughts on what I am doing wrong would be greatly appreciated.
Kind Regards,
Jason Child
[This message was edited by jasonchild on January 29, 2012 at 07:52 PM.]
Viewing 4 replies - 1 through 4 (of 4 total)
- You must be logged in to reply to this topic.