if i have webContainerA inside WebContainerB, how i can rise an event on WebContainerB from A

hi
i create a webContainerA with a webTextBoxA
I create a property of webContainerA named ID

Now i create another webContainerB
in webContainerB i create a method named

  1. PopulatedB ( numberOfElements as int )
    that create at runtime numberOfElements of webContainerA in webContainerB by embeddedWithin system…
    and assign at every new WebContainerA.id an unique number
  2. an event called webContainerB.MouseOnTextbox
  3. a property called webContainerB.IDTextBox as int

then i wont that when mouse move on a webTextBoxA inside WebContainerA inside WebContainerB
and rise/cause the event MouseEnter of webTextBoxA
the code must rise the event of
webConatinerB.MouseOnTextBox and put webContainerA.id in webContainerB.IDTextBox

is it possible ??

If I understand you correctly, you have multiple WebContainerA controls embedded in WebContainerB. Is that correct?

Why not handle the event in WebContainerA? Each one should receive the MouseOver event. You can use the AddHandlerDirective to handle the event in whatever method you want as handling the event in the generic subclass of WebContainerA may not be able to reference properties or controls on the page, etc. So create methods on the page or in WebContainerB that are used as the event handlers.

If you need to raise an event in WebContainerB, then what I would do is in the WebContainerB subclass have a method that raises that event. Then call that method from WebContainerA.

If I understand you correctly, you have multiple WebContainerA controls embedded in WebContainerB. Is that correct?
YES

i would like that
when mouse enter on area of a WebTextBoxA inside the WebContainerA
the event of WebTextBoxA.MouseEnter rise other Event of WebContainerB
and put property of webContainerB.IDtextBox a number
but i don’t know how

i need to identificate on what textBox is mouse pointer

  • Add ewca event definition to WebContainerA
  • Add the TextField to WebContainerA
  • Add MouseEnter event handler to TextField
  • In MouseEnter, add
RaiseEvent ewca
  • Drag an instance of WebContainerA inside WebContainerB
  • Add ewcb event definition to WebContainerB
  • Add ewca event handler to the instance of WebContainerA
  • In the ewca event handler, add
RaiseEvent ewcb

Now place an instance of WebContainerB onto your webpage, add an event handler for ewcb. It will fire anytime the cursor gets inside the TextField.

OK. This is extremely doable.

So what you need to do then is in the MouseEnter event of WebContainerA, you need to call a method on WebContainerB that raises the event you want to raise.

So let’s say in WebContainerB, you have defined an event and let’s call it, ResponseToMouseEnterOnWebContainerA and let’s give it a parameter of say ID which is whatever ID from ContainerA that you want to pass into it.

Now in WebContainerB, create a method. Let’s call that method:

ResponseToMouseEnterOnWebContainerA(ID as integer)

In that method have one line:

[code]
RaiseEvent ResponseToMouseEnterOnWebContainerA(ID)

[code]

Now you need to have some reference to ContainerB inside ContainerA. You can do something like:

WebContainerA(self.Parent).ResponseToMouseEnterOnWebContainerA(ID)

Or you could pass in a reference to WebContainerB in the constructor for WebContainerA. Just make sure you store that as a WeakRef.

All very doable…

Make sense?

[quote=140093:@Michel Bujardet]- Add ewca event definition to WebContainerA

  • Add the TextField to WebContainerA
  • Add MouseEnter event handler to TextField
  • In MouseEnter, add
RaiseEvent ewca
  • Drag an instance of WebContainerA inside WebContainerB
  • Add ewcb event definition to WebContainerB
  • Add ewca event handler to the instance of WebContainerA
  • In the ewca event handler, add
RaiseEvent ewcb

Now place an instance of WebContainerB onto your webpage, add an event handler for ewcb. It will fire anytime the cursor gets inside the TextField.[/quote]

He’s using EmbedWithin to get multiple ContainerA objects inside ContainerB. So dragging it on won’t work.

but where i put this code ?
WebContainerA(self.Parent).ResponseToMouseEnterOnWebContainerA(ID)

in webContainerA.MouseEnter event ?
i have tried but i can’t see .ResponseToMouseEnterOnWebContainerA(ID) because
webContainerA doesn’t know that will be insert into webContainerB

From webContainerA, you can write code like

if me.Window IsA webContainerB then
    webContainerB(me.Window).DoSomeMethod
end

Or define an event on webContainerA the webContainerB implements (with AddHandler).

me.window or self.parent ?

ok with self.parent work fine
thanks tim,jon,michel
:smiley: