Embedded cc talk to window

I have a window with a cc ( C1 ) and a listbox.
C1 is dynamically embedded with a custom container control ( could be invoice, item or customer info ), that works fine.
Now, sometimes I may change some data in C1 and need to pass some values to the window, to display selected data in listbox depending on changes in C1.
if it’s possible , how can I do it, OR is there an easier / other way to do that ?

Add a custom event to c1, embed this event in the window. Raise the event in c1 then data changes. in the window you get the event firing and update some data.

what do you mean exactly by saying ‘embed this event in the
window’

Create Event Definition in C1 named DataChanged
Create a method named “containerChanged” in the Window.
After embedding the container, user AddHandler:
AddHandler C1.DataChanged, WeakAddressOf container Changed
When you raise the event inside C1, inside the window, the method will be called.

1 Like

thanks Marius, I will try

I tried it:

  • added an EventDefinition to InfoObject
    but got compile error, saying ‘type mismatch error’
    what’s wrong ?

wf_ccChanged must take an infoObject as its first parameter.

I added a parameter of info object to wf_ccChanged, than it needed a return value, but still not working …

Wait a minute. Why are you calling AddHandler on InfoObject? Shouldn’t you be calling AddHandler on the instance you just created?

cc = new InfoObject
AddHandler cc.ueCCchanged, WeakAdressOf wf_ccChanged

the infoObject is already part of the window, see above

I think I forget AddHandler, passing a pointer of the window works perfectly and is easier to understand ( for me at least )
Except somebody knows an easy to understand solution !

many thanks

Then why do you need AddHandler?

I would like to see it working one day !

OK, looking back through the thread, trying to pick up the trail, I see in post #6 you have an image of fwwListboxEditDw, which appears to be a window. Is that right?

Under the Controls, it shows InfoObject. What kind of control is it? And what is it’s Super?

Under InfoObject there is an event named euCCchanged. That is an event handler, not an event definition. That already is AddHandlered to it. You can put code in there.

I also see an event definition of the same name on fwwListboxEditDW, which has nothing to do with InfoObject.

What exactly are you trying to do?

What is the code that embeds the cc on the fly?

copy passed info object to a variable first and than embed it strait into the window after the window header, no cc C1 any more.
because there can be various info objects passed, I have to check which one it is before passing the window pointer (self).

What variable type is ccInfoObject?

that marked in red is a containerControl which can have carious data and different size depending usage
I want the popup selection passed to the window!

I’d like more info.

iccInfoObject is a containerControl