I’m having a problem moving data from text field to a another text field in a containercontrol.
Following is code to load a containercontrol to pagepanels"
// panel 0
ccCGMain1 = New ccCGMain ’ left top
ccCGMain1.EmbedWithinPanel(ppCGGeneral,0,ccCGMenu1.Width,0)
// panel 1
ccCGName1 = New ccCGName
ccCGName1.EmbedWithinPanel(ppCGGeneral,1,139+ccCGMenu1.Width,0)
CCCGMain has a text field with a Text Change event, which has the code to move "me.Text
to tfName.text in the other panel.
I have tried different combation and I always get “This item does not exist”
You need to propagate the TextChange event out to the window so you can put the code into the proper scope. Add an Event Definition to ccCGMain called TextChange, with a parameter “text as string”. Add a private method to ccCGMain named TextChange with the same parameter.
Sub TextChange(text as string)
RaiseEvent TextChange(text)
End Sub
In the TextChange event of the TextField, call the TextChange method of the container.
TextChange(me.Text)
Finally, you need to use AddHandler when you embed ccCGMain1 to tie the event to a method on the window, where you can set the text of the other container.
You’re welcome. AddHandler takes some getting used to. It needs a handle to the object that is firing the event, so Xojo adds that automatically as the first parameter to the method call, followed by the normal parameters of the event. So your method has to accommodate that by adding in a parameter that matches the type of object you are “handling”.