Scroll bars for a component bigger than the screen Resolution or component containing it

Time for another beginner-post from me!

For a university project, an audio application should be developed, that should run fullscreen in kiosk-mode on a dedicated Linux computer for demonstration purposes once the work is finished. As the exact hardware specifications of the target system are known and fixed (especially screen resolution and the audio interface used), I started designing a “fullScreenComponent” with a fixed size that completely fits the targeted screen resolution.

As development of the application is done by me (working on a Mac) and a second student (working on Windows) and the development machines will have a different screen resolution (possibly less pixels than the target hardware) and audio interfaces, the fullScreenComponent should be wrapped as a child component into a resizable native window among an audio interface selector component and a fullscreen button, setting the fullScreenComponent into kiosk-mode. In case the window in case of non-kiosk-mode or the screen resolution in case of kiosk-mode is smaller than the fullScreenComponent, there should appear scroll bars around the fullScreenComponent. And as a last thing, the kiosk-mode should be quit when hitting the Escape key.
The final build configuration should enable the fullscreen mode at startup and choose a fixed, hardcoded audio interface through a preprocessor macro.

As I said above, I’m still a JUCE beginner and only programmed some really simple applications only using the default mainContentComponent until now and I’m not really sure how to do it right.

What I know:

  • I’m able to add the fullScreenComponent (which is a private member of the mainContentComponent at this moment) to the mainContentComponent through a call to addAndMakeVisible (fullScreenComponent) in the mainContentComponents constructor
  • The fullScreenComponent can be set to kiosk-mode through a call to Desktop::getInstance().setKioskModeComponent(&fullScreenComponent);

What I don’t know:

  • How to wrap the component into scroll-bars if there is not enough space for the complete component?
  • How to quit the kiosk-mode through the Escape key (although I think that this one probably won’t be that difficult to find out :relaxed:)

Thanks in advance for your help!

Check out the ViewPort class


1 Like

Great, I think that’s exactly what I was looking for!

Now I’m in trouble getting the kiosk-mode working.

On clicking a button, I call

Desktop::getInstance().setKioskModeComponent (&myViewport);

But this runs into an assert when clicking. The source-code comment tells me

// Only components that are already on the desktop can be put into kiosk mode!

What does this mean exactly? What is the meaning of a component that is on the desktop? What should I do before to get this working?

A Component is on the desktop when it is intended to be shown as a “floating” component without any JUCE Component as parent.
For example, that is the typical behavior of top level windows or dialog windows that don’t need to be constrained within others.
The method you need is Component::addToDesktop()