byRef to container controls

Foo was here :wink:

Drops the mic and we hear “Foo has left the building”

foo yoo too :slight_smile:

i think the real problem start with the = assignment, sometimes it make a copy and sometimes not.

this docu at ByVal is partly wrong.
example

objects are not copied or represent a value direct.

obj = no value (with the meaning of my data)
obj.Value = value (as integer) property

this should be named as ByRef = reference

replaceing a ref parameter with a new object in the method is something what should be default.

i know the behaviour of xojo but for me it seems this get messed up and then the guide was written.

Okay, guys now that you have all left for coffee and I’m byRefed out let’s see if I can get back on track. Tim, you’re up to speed on what I’m up to so you may know what’s coming next. All is well creating 7 control containers, one for each day of the week. I’m now doing fine with all that excellent advice on passing an array(,) around and to the control containers. Values from the sliders are being captured, saved to the drive and back to the original array. As the last step, I need the open event of the sliders in the control containers to set themselves when they open to the values in the cloned array that was passed to the containers. The open events in the sliders are not going to cut it. The data is available since I can place the same code in the mouse enter event for the slider and it will set the slider after the control container is open. Before I make a workaround I’m sure someone might have the solution.

you could use the define event in a cc “RequestData” with a return value then use RaiseEvent at Open.
the event come in the window where the cc are placed.
without event return value you could also use Me.SetData in the event method.

or if you open the new window with the 7 cc you could call a method .SetData

[quote=494660:@Markus Rauch]you could use the define event in a cc “RequestData” with a return value then use RaiseEvent at Open.
the event come in the window where the cc are placed.
without event return value you could also use Me.SetData in the event method.
Or if you open the new window with the 7 cc you could call a method .SetData[/quote]

For simplicity can .setdata be made to trigger a slider event. How does a .setdata method know when to fire to make the sliders respond or what would trigger the method?

In the window’s open event you read the data into your array and then call SetData on each container. SetData loads the values into each slider.

setting a controls value have the side effect that it cause a change event.
if you set a textfield.value = “abc” it raise a event. often unwanted.
after you set the slider value his gui update self.

As usual, I have to beat things into submission before they will work but when I look back at the suggestions sent in I realize although I had tried several ways all I need to do was place the setData call in the action event of the day of the week selector buttons in the parent window and call the setData method in the containerConrol. So easy when you finally get there. And if you do not open one of the containerControls and its values are still set to 0 before saving it’s not a problem, the change event in the slider never fires to update the clone array, no foul no harm. Thanks Markus and Tim.

ok, its difficult to well-advised just by text description. i think the possibilities gave you some puzzle pieces.