I have a property within my web page called CurrentContainer. It’s type is webcontainer.
I use embedwithin to add a container to the page and assign it to the currentcontainer property.
I am using an external library which fires events when a control looses focus. This library needs to send events to the webpage. I have tried using addhandler to add an event handler and I have also tried subclassing the container as a type with the events defined. In either case the events defined within the container do not show up.
Is this actually possible or am I taking the wrong approach?
Sub Opening() Handles Opening
Var c As New CC
CC1 = c
CC1.EmbedWithin(Self,0,0,c.Width,c.Height)
AddHandler CC1.Hello, AddressOf Hello
End Sub
Public Sub Hello(c As CC)
MessageBox "Hello"
End Sub
Public Property CC1 as CC
ContainerControl Named CC
event definition
Event Hello()
Button Click
Sub Pressed() Handles Pressed
RaiseEvent Hello
End Sub
Is Dashboard the control you’re embedding or the parent control you’re embedding within? Generally, I’m used to the dashboard being the container holding a number of controls. You would want to add the handler to the dynamic instance you create.
Where is this code located?
What are the names of your parent control, and the control you’re embedding?
Hi Tim,
Dashboard is the container. It is a sequence of buttons to navigate the user to the correct location within the app.
The web page is named MainWebPage.
Dashboard, Details, Customers are all containers, which can be embeded within the Mainwebpage. Only one at a time and they are assigned to the variable CurrentContainer.
I have just put together this sample which demonstrates the issue.
Public Sub DisplayContainer()
if currentContainer <> nil then
currentContainer.Close
end if
var con as WebContainer
select case index
case 0
var dash as new dashboard
AddHandler con. <------ event isn’t available. It is defined in dashboard.
con = new Dashboard
case 1
var det as new Details
AddHandler det. <----- event isn’t available. It is defined in Details.
con = det
case 2
con = new Customers
case else
MessageBox (“Display Container: Index not yet handled”)
index = index - 1 // reset back to previous value
return
end select