Embedding a container control within multiple pagePanel pages

Embedding a containercontrol that has a label (to hold a question and textarea to hold the answer on each page of a pagepanel
I have a list of questions so each pagepanel should end up showing a different question and each textarea will receive a different answer.

Let’s say I have Window1 with a pagepanel on it. Below the page panel on Window 1 I’ll put a button to move forward through the pagepanel

At run time I want to add 7 pages to the page panel.
And I also want to add my containercontrol to each page.
At some point I want to add the questions, let’s say they are in an array, to the appropriate page. The array index and the pagepanel.value would match.

My problem is I don’t completely understand how to get the references. Also in the Language reference for ContainerControl.EmbedWithinPanel there is a note that states “An instance of a ContainerControl can only be embedded into one page.”

So how do I create a dynamic control based on my containercontrol.

This is a learning exercise for me. I know how to do it from the IDE but I’m trying to clean up the navigator by using dynamic controls.

You create an instance using the New keyword.

e.g.

Dim myinstance As New MyContainer myinstance.QuestionLabel.Text = "What is the airspeed velocity of an unladen European swallow?" myinstance.EmbedWithinPanel(thepagepanel, 0)

Thanks that helps. Now I’m stuck on how to access the containercontrol label and text area on each of the pages. I have a feeling I need to create a new instance of my containercontrol for each page, and I’m not quite sure how to do that.

Add a Window property MyInstance (or other name) As MyContainer() -is an array- and change:

[code] Dim myinstance As New MyContainer
myinstance.QuestionLabel.Text = “What is the airspeed velocity of an unladen European swallow?”
myinstance.EmbedWithinPanel(thepagepanel, 0)

Me.MyInstance.Append myinstance[/code]

Now you can access to containercontrol label and text area, you can make a relation with thepagepanel.Value for the index of Window property MyInstance like:

[code]If Me.MyInstance.Ubound= -1 Then Return

// just an example, not real value. This work only if num panels= num MyContainer(s)
Dim cControl As MyContainer= Me.MyInstance(thepagepanel.Value)

cControl.QuestionLabel.Text = “What is the airspeed velocity of an unladen European sparrow?”[/code]

Thanks. More good information. Appreciate the quick response and the insights. Thank you all.

These may also help:

Thanks. I thought I had tracked down all the documentation but you continue to surprise me in a good way:)

I like to print out things and read them, so how do I print that web page? Unfortunately, the right click menu print only outputs the first of multiple pages. Any suggestions?

Click the tool button on the top right (left of the search field) and select “Save As PDF”.

Thanks. This is an interesting user experience issue. I am a fairly sophisticated user of the web and browsers and yet it did not occur to me that one of the basic “words” of a browser is to look to the upper right for these little icons. The chrome browser I use has 3 vertical dots at the right and if I put my cursor on it, it shows a tooltip explaining what’s on it. In the case of the Xojo page, you change the cursor to a hand. So this is one of those, “I wasn’t paying attention moments.”

This type of problem was much more prominent in software design when I was active in the field and neither Windows, nor the Web and it’s visual interface were invented. The whole point of Windows was to stop all of us designing our own “unique” visual interface and create a standard user experience. I still remember when F1 became the standard for help. :slight_smile:

I want to thank everyone for their prompt and insightful answers.

I also want to give a shout out to Paul Lefebvre who works so hard to make everything understandable, from writing documentation, to doing webinars, to designing sample apps, (for all I know he’s busy writing working apps) and of course taking the time and effort to respond to a newbie like me on this forum.

Again thank you all

Lawrence