Overflow issue : scrolling embedded controls into a containerControl

Hello all!

I have a containerControl (Parent) that has to display a list of another containerControl embedded instances (Children).

The parent has a fixed height and sometimes I have to display more children than the Parent can show. So I put a scrollbar into the Parent in order to scroll my embedded elements.

I implemented the function that makes my embedded elements scrolling on mousewheel event, and that works, but…

My issue is that the overflow content of the parent is shown, over my window instead of being hidden. As soon as an element is scrolled higher than the parent top, it is still displayed.

Here is my example :


I had this problem when I tried embedding child containers within a groupbox in the parent. I found that when changed that approach to embedding within a canvas, rather than the groupbox, it works as expected.

What type of object are you embedding within?

I’m embedding ControlContainers into a ControlContainer… I tried to put a canvas in the main controlContainer and embed the children into it but it does not wok too…

Embedding using a Canvas ought to work. For an example of this, watch the Desktop Container Controls webinar and look at the DownloadContainer example that I cover.

http://documentation.xojo.com/index.php/Videos

Hmmm… Ok… So now I have to figure out why your code is working very well and mine, similar, not…

The good point is that now, I have a source code that works, so I know that what I want to do can work as well :slight_smile:

Thanks

Is this a Windows only issue? I’m not able to reproduce it, ContainerControl in ContainerControl clips correctly on my Mac, but maybe my test is missing it.

From the screenshot it looks as if you embed in the window, not the. Canvas. Or are you sure of where your canvas is? Might be larger than you think.

Oh, I see the ‘mac’ in the screenshot now. I’ve never had this issue with ContainerControls, nor need to use a Canvas workaround. So this concerns me a bit.

For more explainations, here is the structure of my window :

I’m still figuring out why my code won’t work while the code of Paul works…

Ok, I think this issue comes from my structure…

I did another try, I replaced my main ContainerControl by a window, and there is no overflow… :slight_smile:

I’m on the good way!

There is something I don’t understand… In my project, if I use a window instead of a controlContainer (the parent one), it works if the window has the composite property at false. If this property is true, I have an overflow.

In the example of Paul, in both cases, it works…

I have to tell you that my main window has to be composite.

New try : I added Paul’s example into my project… Here is the result…

:’(

How do you expect people to help? You need to post the code you are using. As I wrote I think you might embed in the wrong control. A wrong “self” or “parent” is enough.

Also try making a new project - I had weird things happen in corrupted projects.

You’re right Markus, here is my code.

In the main Window, I have a pagePanel with my main ControlContainer, and a loading function :

dim i As Integer for i=0 to MyBlocs.ubound MainContainer.appendBloc(MyBlocs(i)) next

My main ControlContainer contains a canvas and a scrollbar and has this function:

function appendBloc(b As Bloc) { b.EmbedWithin(canvas, 0, heightPos) heightPos = heightPos + b.height updateScroll() }

The structure of the main Window is :

Window -- PagePanel ---- ControlContainer

The structure of the main ControlContainer is :

ControlContainer -- Canvas ---- Blocs ControlContainers -- Scrollbar

That can’t be the actual code, eg

b.EmbedWithin( canvas, 0, heightPos )

or are you really calling your canvas “canvas”? Seems like a bad idea if you did, and if you didn’t: if you don’t post the ACTUAL code then how is anyone supposed to find the bug?

Why not make a simple demo project with the relevant code, and if it still shows the problem then people can have a look at it and help.

The problem is that I tried to make a demo, with exactly the same code but in the demo, it works…

I’m starting to believe that the issue is due to my project that is probably corrupted by something… If I have to restart building my whole project, I’m gonna loose a lot of time… thanks XOJO :frowning:

Are you building for Carbon or Cocoa? If you are building for Carbon you might want to try Cocoa. Carbon apps have issues with controls not respecting the bounds of containers.

Yeaaaaaah victory! I was almost sure I was building my app for Cocoa, while I was still using Carbon…

Thanks for the clue!

No problem. It was the one question that no one had asked yet. :wink: