Xojo Design Assistance with Container Controls

Hey everyone,

I am trying to not hack around this design issue I have where I have multiple subclassed container controls with custom controls --> I then have a class.method that I am passing the reference to specific container control (with its super as a container control) --> I want the method’s parameter to be generic to support any other subclassed container controls. It obviously doesn’t work since I have to specify the exact subclassed container type I want to pass. Hopefully this makes sense and is there a design pattern to accomplish this?

Here is a pic of the container (its embedded to the window under the tabCanvas.Height: This for example is the generalTab_Container with it’s super as a ContainerControl.

Same with the other container control: securityTab_Container with its super as a ContainerControl:

I want to do it the right way this time as I probably will open source my tab project since the one open project by Alex Restrepo is way aged and clunky looking. This tab project im using for our paid software is based on the Bootstrap nav control.

FWIW this is how I have structured the code to create a new tab for example:

Me.backColor = kEditProfileGrayBackColor
Me.borderColor = &c979797
Me.mouseOverTabBorderColor = &cC7C7C7
Me.borderWidthDbl = 1.0
Me.tabFixedWidthDbl = 86
Me.tabFixedHeightDbl = Me.Height
Me.displayModeInt = 0
Me.firstTabIndentInt = 20

Var genTabItem As New tabClass("General")
genTabItem.tabActiveColor = &cFFFFFF
genTabItem.tabColor = &cF7F7F7
genTabItem.tabTextActiveColor = &c857C7D
genTabItem.tabTextColor = &c6388B0
genTabItem.tabHoverTextColor = &c534D4E
genTabItem.tabTextFontSizeInt = 15
genTabItem.tabTextFontStr = "Heiti TC"
Var attachGenTabX As Double = 0
Var attachGenTabY As Double =  Me.Top + Me.Height
Var myGentabParentWindow As Window = Self
genTabItem.attachContainer(generalTabContainer, Self, attachGenTabX, attachGenTabY)

Thanks in advance!

1 Like

classinterface ?

1 Like

Sounds like it.

I very much presume that you are familiar with interfaces, but in case not here is an example:

I agree, class interfaces sound like the best strategy.

I have used Class interfaces enough to know how to use them but sometimes not knowing when to use them if that makes sense. I’m on it and thank you @JeanYves, @MarkusWinter and @bkeeney!

1 Like