Scale factor and CallOutBox

Would it be possible to implement scale factor handling in CallOutBox like it is done in PopupMenu if there are no parentComponent ?
Still it would require some optional parameter to the init component it originate from while still be on the desktop

a myBox.setTransform(juce::AffineTransform::scale(getApproximateScaleFactor(this)));
where this is the component it originate from is not enough.
getApproximateScaleFactor impl from PopupMenu for example.

Thanks !

same goes for DialogWindow

Bump.
Even doing it manually like that is not enough.

juce::CallOutBox& myBox = juce::CallOutBox::launchAsynchronously(myWidget, parentComponent->getScreenBounds(), nullptr );
myBox.setTransform(juce::AffineTransform::scale(juce::Component::getApproximateScaleFactorForComponent(parentComponent)));

Any ideas ?

Thanks !

bump

Guys ?

Thanks !

is there anybody out there ?

Unlike PopupMenu there’s no concept of a targetComponent for CallOutBox (or DialogWindow either really) - you just pass it the area you want it to target. Would it make more sense if the CallOutBox scaled with the transform of its content? Then you would do something like this when launching:

auto* content = new ContentComponent();
content->setTransform (juce::AffineTransform::scale (someScaleFactor));

auto& box = juce::CallOutBox::launchAsynchronously (content,
                                                    targetArea,
                                                    nullptr);

I tried that already.
Unfortunately it doesn’t work.

Here is how it look with 200% scale

Sorry, yes I meant that it isn’t implemented at the moment but it’s something that we could do and might make more sense than adding a targetComponent or similar like in PopupMenu. What I was asking was whether that would work for your use case?

Yes sure.
Either changing the scale on the callout box or the content component is fine for me.

Thanks !

This has been added now on develop in 268ac3d.

Perfect.

Thanks !

Hi,

I’m currently facing the same issue with juce::DialogWindow

juce::DialogWindow::LaunchOptions o;
o.content.setOwned(widget);
o.content->setSize(dialogWidth, dialogHeight);
o.dialogTitle = dialogtitle;
o.dialogBackgroundColour = backgroundColour;
o.escapeKeyTriggersCloseButton = true ;
o.useNativeTitleBar = false ;
o.resizable = false ;
juce::DialogWindow *pWindow = o.launchAsync();

Trying to set
setTransform(juce::AffineTransform::scale(juce::Component::getApproximateScaleFactorForComponent( this )));

on the owned component asserts
and settings the same code on the DialogWindow itself lead to some weird mouse handling issue. (either after launchAsync or after create and before enterModalState)

Any idea how to support this ?

Thanks !

2021 bump.

Thanks !

I’ve just pushed this change:

To scale a DialogBox appropriately for a plugin, you should set LaunchOptions::componentToCentreAround to your plugin editor, or a child of your editor.

Please let me know if you run into any issues with this change.

Works fine.

Thanks !