[Solved] editorhost COnOffButton not working

Hello

I am new to this so I apologize if I am doing something wrong.

I created a blank plugin (no xml file). I then right click to enter the editor (I use the editorhost app provided). I added a text field (CTextLabel).

I then wanted to add a COnOffButton to represents a toggle with 2 values. I added a bitmap which is 50x100 big (contains the 2 state of the toggle) and it looks like this:
Control_AudioSwitch_50x100.png
But it doesn’t get rendered as can be seen on this screenshot:


If I click “Edit” and then click on the toggle, nothing really happens.

I looked at the source code for COnOffButton and it looks like it is expecting a bitmap with the 2 images…

What am I doing wrong?

Thanks for the help.
Yan

Hi,
please save the xml file first, then add the xml file to your cmake or Xcode project and rebuild. After that it hopefully should work.

Cheers
Arne

I followed your suggestion and it does not work. It is still the same issue.

When looking at the xml file, it does seem “right” to me:

...
 <view background-offset="0, 0" bitmap="Control_AudioSwitch_50x100" class="COnOffButton" control-tag="Root::Param_AudioSwitch" default-value="0" max-value="1" min-value="0" mouse-enabled="true" opacity="1" origin="130, 120" size="50, 50" transparent="false" wants-focus="true" wheel-inc-value="0.1"/>
...
 <bitmap name="Control_AudioSwitch_50x100" path="Control_AudioSwitch_50x100.png"/>
...

Yan

I think the bitmap have to be next to the xml file to be found.

It is. Both files are in the SAME folder. Exactly like in the again example…

Yan

Do you have the following output in the debugger console ?

*** Bitmap 'Control_AudioSwitch_50x100.png' not found.

No, it just get loaded fine. No error message.

Yan

Hmm, then I don’t know. It’s working here, just checked it without any problems.
What happens if you use another view type, another bitmap ?
As last resort, you have to use the debugger and see why it’s not drawing the bitmap.

I found out what the problem is: when looking at the helloworld_with_VSTGUI project now provided with SDK 3.6.9 I saw that there was the same file with different names: background.png, background_2x.png, background_3x.png which led me to believe that somehow the name of the bitmap contains the resolution…

Renaming my image from Control_AudioSwitch_50x100.png to Control_AudioSwitch.png fixed the problem…

I am very unclear how and when the _2x, _3x extension is being used and would definitely love to get some info on that…

Yan

Ah OK, you’ve found a bug.
The bitmap name should be checked for the pattern _?.??x.png. But the check is not strict enough. I’ll fix this.
The pattern is used to decode the scale factor of a bitmap for HiDPI usage.

Cheers
Arne