Managing Windows

Hi everyone!

I’m interested in learning how to connect two or more windows together. I was looking at the Managing Windows chapter, in the introduction to Xojo book, and I worked the example in the chapter. In the example, two windows were created, but they were completely separate of one another. Is there a way to connect one window to another, by perhaps a Next button, and not have it pop out separately? Rather stay in the same frame as window 1? Any ideas?

Thanks! <3

Kayla,
If you are on OS X, make Window2 a sheet window, and have a button in Window1, with the following code:

Window2.ShowModalWithin(Window1)

This will cause Window2 to slide down from within Window1.
Hope that helps :slight_smile:

Thanks @Richard Summers ! I’ll give it a try. :slight_smile:

Here are 4 useful links:

ShowModalWithin Link

ShowModal Link

ShowWithin Link

Window Events / Methods / Properties Link

:slight_smile:

It sounds like you might be meaning to replace the contents of window1 with the contents of window2? If so, take a look at pagePanel

Jim has also offered another option - using a PagePanel.

Basic Steps here:

  1. Drag a PagePanel into Window1.
  2. Put the required controls into each separate panel (by clicking on the numbers at the bottom of the PagePanel control).
  3. Put the following code into a button’s action event, in order to make the PagePanel change to the appropriate Panel:

// The code below causes the PagePanel to change to Panel 1 PagePanel1.value=1

or

// The code below causes the PagePanel to change to Panel 2 PagePanel1.value=2

Bear in mind that PagePanels are 0 based - meaning that the first Panel is number 0, (not number 1).

Hope this also helps.

Also look at container controls. You can encapsulate your UI(s) in the container controls and then place one per page of your page panel.

[quote=192009:@Richard Summers]Jim has also offered another option - using a PagePanel.

Basic Steps here:

  1. Drag a PagePanel into Window1.
  2. Put the required controls into each separate panel (by clicking on the numbers at the bottom of the PagePanel control).
  3. Put the following code into a button’s action event, in order to make the PagePanel change to the appropriate Panel:

// The code below causes the PagePanel to change to Panel 1 PagePanel1.value=1

or

// The code below causes the PagePanel to change to Panel 2 PagePanel1.value=2

Bear in mind that PagePanels are 0 based - meaning that the first Panel is number 0, (not number 1).

Hope this also helps.[/quote]
@Richard Summers Thanks for your help! Question though. For step 2, any advice on what controls to add? Would this involve an Event or Method?

@Peter Fargo, thanks for bringing that to my attention. I hadn’t used container controls before. I’m researching it now.

Kayla,
regarding step 2:

Basically, Window1 needs a way to link to your other panels (this could be via buttons, PopupMenu etc. etc.)
Then in each panel, you put whatever you want, as these are the pages of your software which display your information.

You can simply drag whatever controls you like, from the Library on the right hand side of the IDE, into your window (simple as that) :wink:

Did that explanation help?

@Richard Summers
Thank you so much for your help. I sincerely appreciate your patience with me.

For some reason I’m missing something. I’ve been looking at it for the past couple of hours. Here’s what I’ve done. I’ve inserted a pagepanel into one window (call it Window1). I created two Container Controls with buttons, labels, etc. For page 0 of the pagepanel I inserted Container Control1. I then clicked the pagepanel to go to page 1. Page 1 of the pagepanel was identical to page 0 of the pagepanel. The same Container Control1 was present for page 1 of the pagepanel as it is for page 0 of the pagepanel. Then I thought, since I’m one page 1 now, I’ll remove the Container Control 1 (which is placed identically from page 0) and insert Container Control 2. When I click the pagepanel to return to page 0, now I only see Container Control 2.

My thoughts: I think I’m supposed to assign some kind of action for the pagepanel, so new pages are created as the page number increases (relative to the assigned number of pages).

I was looking at an example from one of the Xojo webinars. It has the same thing as me…two Container Controls and a pagepanel. The difference is, the example works. I downloaded it and tried to inspect the pagepanel but I don’t see any options. Here’s the link if you’re interested. Container Control example file

Thanks again for your help! I’m moving toward the direction I want to go. :slight_smile: :slight_smile:

If it helps, I’m using Microsoft OS.

You want to ensure that your containerControls are fully contained within the bounds of each panel. A visual cue is that when the containerControl is selected, the pagePanel boundaries will have a red highlight.

This red highlight also applies to any control that may contain a child control. Red indicates parent.

(Just noticed you’re using Windows. I’ve haven’t used the IDE there very much, but I imagine it’s the same)

Kayla,
I have made you 2 VERY simple example projects.

Project using label controls

Project using Container Controls

After you click on the PagePanel in Window1, look at the inspector on the right hand side, and you will see an area saying “Appearance”. Click on the button there which says “Edit”. From there you can add additional panels.

Hopefully this example project will make it much easier for you to understand.

@Richard Summers Thank you so much for your example!

I finally got it!! I found my solution. I feel silly about it, because it was so simple. This was my problem. When I selected the pagepanel and placed it in the window, I was making the box smaller so it only surrounded the counter. I didn’t think to make it bigger, filling the window, thus including the rest of the text to make the pagepanel work. Ah, I feel so dumb, but happy at the same. Thanks Richard! :smiley: :smiley:

I sent you 2 example projects above. Did you see the second example, as I edited it after you started writing your post :slight_smile:

Yes, I found them. Thank you!! :slight_smile:

Oho! I’ll look at it now.

@Richard Summers
Nice! I can see the red outline that @Tanner Lee mentioned around the ContainerControl.

If this problem is now solved, you can click on the bottom right of the post , and this thread will then be displayed as answered, so that other members know it has been solved.