lost track with containercontrols

The module that calls the window is part of a class
I added a property to this class
http://screencast.com/t/emgdIH8Ib
and in the modul I put
w = new window1

=> same result

[quote=238895:@roland brouwers]I don’t know how system.DebugLog works or where I can see the output
So I put the code in my app and a stop at system.DebugLog and got this:

http://screencast.com/t/ZWRVqgG6n3mg
http://screencast.com/t/swYEwW5SW
http://screencast.com/t/OaWRRRtXkOS
http://screencast.com/t/GGpI9vTLTk[/quote]

The output of System.debuglog appears in the Messages pane you get to by clicking on the third icon at the bottom of the central pane of the IDE. Alternatively, if you cannot figure that simple way, you can go :

Dim Message as String for i as integer = 0 to w.ccCtr.ControlCount-1 Message = Message + w.ccCtr.Control(i).Name + EndofLine next Msgbox Message

It’s probably something incredibly simple but without seeing more of the source we’re grasping at straws.

My advice is to break it out into a smaller project to demonstrate the issue. In that process you’ll either figure it out and if not there’s something smaller for us to look at.

This is what I got
http://screencast.com/t/YeBB64oM

In one of your screen shots the container control instance is called myCcCtrs.
So maybe it should be:

w.myCcCtrs.TextField(3).BackColor = &cFFDBB700

As Bob said, difficult to say without seeing more of the code.

[quote=238903:@roland brouwers]This is what I got
http://screencast.com/t/YeBB64oM[/quote]

It means you do get your TextField1 controlset and PushButton1.

You may want to try this :

for i as integer = 0 to w.ccCtr.ControlCount-1 system.DebugLog w.ccCtr.Control(i).Name If w.ccCtr.Control(i) isa TextField then system.DebugLog "TextField text : "+w.ccCtr.Control(i).Text w.ccCtr.Control(i).Text = "Changed" end if next

This way you see if you can actually read and write all the TextField Text properties.

If that works, then I believe you should be able to go

w.ccCtr.TextField1(0) = "This is OK"

w.ccCtr.Control(i).Text doesn’t do it
after control(i).
you only have
http://screencast.com/t/AeDddjrY7

You will notice that I changed ccCtr into myCcCtrs
just to be more clear

for i as integer = 0 to w.ccCtr.ControlCount-1 system.DebugLog w.ccCtr.Control(i).Name If w.ccCtr.Control(i) isa TextField then system.DebugLog "TextField text : "+TextField(w.ccCtr.Control(i)).Text TextField(w.ccCtr.Control(i)).Text = "Changed" end if next

I did
http://screencast.com/t/uZyuBcUMcL
and all the textfields changed there text in “changed”
But still
w.myCcCtrs.Textfield1(0).text = “This is a text”
did not work
There is no Textfield… after w.myCcCtrs. …

The module that creates the window
http://screencast.com/t/ntBFGYxyXYNr

Here ccCtr…
will show the PushButton and the Textfield1 (6 times)
but
wCcCtrs… doesn’t show them

You keep giving screenshots of individual portions. It’s not helpful. You can continue down the path your going or follow my advice. Up to you, but I can’t help any more on this path.

I will try to make a simulation in a smaller version of the one I got.
I will do this tomorrow because in Belgium we have 11 pm and my head feels like to small.
Tomorrow everything will be, let us hope, more clear.
Thanks for your time.

I located the problem
When the ContainerControl should be adressed from different places, other then the method that embedded it, the ContainerControl should be remembered as a property(MyCcCtrs) of the window that contains it.
So
myCcCtrs(ContainerControl property of window1) = ccCtrs (the new instance of the ContainerControl)
Here I mixed up the names
http://screencast.com/t/IgSqBeMq9
I set type = ContainerControl , where it should be ccCounters (the name of the containerclass I created)

To put my finger on the error I wrote a small app, which you find here under.

https://www.dropbox.com/s/bt9mmmc2xw3u69i/testContcontrMembers.xojo_binary_project?oref=e&preview=testContcontrMembers.xojo_binary_project

I wonder if anyone could look at it and give me some remarks on the way I did it, or advise me on any improvements.
Maybe some things can be done much more simpler.

Nevertheless I thank you all very much

If myCcCtrs can address various ContainerControl then is a good idea to let it as ContainerControl
But in this case you can’t address directly the subclass, you have to check it before:
//set Textfield1(0) to “This is a text”
if (myCcCtrs isA ccCounters) then
ccCounters(myCcCtrs).Textfield1(0).text = “This is a text”
end if

Otherwise a ContainerControl class doesn’t know anything about the content of ccCounters class.

If you window property myCcCtrs will be always a ccCounters then is ok to dim it as ccCounters and so you can directly access to its props or methods.

This window will only contain ccCounters, so this should not be a problem.
Grazie per la tua risposta.

Pff. 37 posts later …