UI - open views on button clicks

Have been researching the net but not making much headway…

I would like to have a user interface that starts with a front page (view of a container likely).
Then when I click on buttons inside that top level view I can open other views and hence interact with other parts of my project.

Kind of like this:

def onClick(panelValue):
    op('target_container').openViewer()
return

How would you folks go about doing this?

Many thanks
Alan

Hello,
I do that using select comp inside main container.
with other containers as different parts UI
With python you can write inside chop execute chop:

def onvaluechange(channel, sampleindex, val, prev):
    if(val == 0):
        op('mainUI').par.selectpanel = op('part0_UI')
    elif(val == 1):
        op('mainUI').par.selectpanel = op('part1_UI')

etc.

Thank you Jacque for your reply - that set me off on the right road.
In the end I created a hierarchy of contains and buttons to lay out my UI.

Inside a button - which I changed Button Type to Momentary - I added a Panel Execute DAT.
Left Panel Value to be select
made sure Off to On toggle was ON and Active ON
Then edited the first function to be:

def onOffToOn(panelValue):
	op('/project1/ui/videoChannelSelectScreen').openViewer()
	print("open videoChannelSelectScreen")
	return

A lot simpler than I thought it was going to be.

The full path to my container(s) may or may not be the right approach but it works.

This TouchDesigner is just amazing! Although I have become a bit obsessed with it!!

Hi @awcraig,

great to hear you are enjoying your time with the software.
Regarding full paths: indeed this can become a bit an issue when having full path names in scripts and then being faced with moving operators around or trying to modularize a project. Have a look at custom parameters, relative paths, and Parent Shortcuts - all of this together can simplify your life later on quite a bit.

cheers
Markus