Window Position

Is it possible to open a window in a set position inside another window.

Thanks.

What do you mean “inside” another window?
The only type of window which can be opened inside another, is a sheet window - and that is always centered.

Probably a better way of putting it, is can you place a window in a certain position when it opens.

Thanks

Get the .Top and .Left of the base window, then position the top window where you want adding the base window’s .Top and .Left

Thanks Tim, not sure how to go about that.

Cheers Shane

I’m going to have to ask why? AFAIK this is unusual and there may be a better way to accomplish what you’re trying to do… Then again there may not :slight_smile:

I wish to open multiple windows in the same fashion as a Tabpanel, the reason why I am not using a tabpanel is there doesn’t seem to be a way to add a background Color or picture to a Tabpanel.

It is a windows app I am writing.

Thanks

You can either change the background image for the window, or place a canvas inside the tab panel (on OS X you can place one behind). And use the canvas for the background image.

Alternatively you could use Container controls on top of a tab panel.

Why don’t use use a pagepanel? There you can do any coloring that you like. You just need to have your own tabpanels. See for instance http://www.mothsoftware.com/content/xojo/ .

Dim TopOffset, LeftOffset as integer

MyWindowToOpen.Top = Self.Top + TopOffset
MyWindowToOpen.Left = Self.Left + LeftOffset

Lennox

[quote=121816:@Shane Rampling]I wish to open multiple windows in the same fashion as a Tabpanel, the reason why I am not using a tabpanel is there doesn’t seem to be a way to add a background Color or picture to a Tabpanel.

It is a windows app I am writing.[/quote]

With multiple windows you cannot really do the same as a TabPanel, and may get the user confused. Besides, programming over multiples windows may prove challenging for you.

A better option is to use ContainerControls you manage through a SegmentedControl. All is needed is to make the ContainerControls visible when a particular segment is clicked, and the others invisible. In terms of design, a ContainerControl works pretty much like a window.

Thanks Michel, I have never used container controls and have no idea on using them.

Thanks Shane.

[quote=121985:@Shane Rampling] I have never used container controls and have no idea on using them.
[/quote]

Read http://documentation.xojo.com/index.php/ContainerControl

You can think of a ContainerControl as sort of a window you stick inside another one. Here is a very quick example :

  • Drag a ContainerControl on the left of the IDE, like you would do a window. It will be named ContainerControl1 as default.
  • Set its size, background color, backdrop picture, like you would do a window
  • Place onto it controls and stuff
  • When you are finished, drag it over a window

Now the ContainerControl instance with all the stuff into it and its background will show on the window. Note that the color will only display when you run the program.

By setting the instance ContainerControl1.visible true or false, you can show or hide the container control at will, enabling you to have as many of them as needed, just like a TabPanel would. To switch between them you can use a SegmentedControl, and it can look just like a TabPanel.

Thanks Michel, got the idea, will have a play and see what I come up with.

Shane.

I don’t understand where to put this code or how to use it to enable multiple tab panels,

[code]MainTab.Append(“New Tab”)
Dim tabNum As Integer
tabNum = MainTab.PanelCount-1

Dim cc As New MyContainer
cc.EmbedWithinPanel(MainTab, tabNum)[/code]

[quote=122011:@Shane Rampling]I don’t understand where to put this code or how to use it to enable multiple tab panels,

[code]MainTab.Append(“New Tab”)
Dim tabNum As Integer
tabNum = MainTab.PanelCount-1

Dim cc As New MyContainer
cc.EmbedWithinPanel(MainTab, tabNum)[/code][/quote]

I never suggested to embed the container controls in tab panels, just to use them instead. You place all your ContainerControls on the same window, and make visible only the one you want at a given time, the others invisible. It works just the same.

If you have trouble understanding the concept, you can still have a background color ina tabpannel by placing a rectangle as background for color, or a canvas for a picture, if that is easier for you…

The Rectangle did the trick, thank Michel.