Maximum component size


What’s the biggest size a component can have?

I am asking because I made a Piano Roll Editor which uses a very big component as surface for the notes and it is contained in a Viewport. I found out that setting the width to 0x7fffffff makes JUCE crash but 0x7ffffff is still fine. 0x7ffffff equals more or less 100000 screens in width, so that should be enough for the biggest piano roll :slight_smile:


No, you really shouldn’t use values as high as that. It might seem to work ok but as soon as you do a maths operation on it, there’s bound to be an overflow that breaks something. And converting that number to a float to do some of the drawing operations will cause an overflow too.


Ok, good, so what would be the biggest possible size for components you’d recommend using?
The question is rather important for me, because depending on what size you tell me, I’ll have to possibly rewrite my code.


32768 is, i think, a standard “max value”


Oh, if that’s true I’m in a bad situation. Jules, what do you reckon?


Personally, I wouldn’t use a big component at all, but would shift its subcomponents along when you scroll left and right.

Apart from the overflow issues, that’d mean that you only need to have components for items that are currently on-screen. Otherwise you’d also run into performance and memory issues if you had thousands of subcomponents all the time.