[Solved] editorhost COnOffButton not working

A user interface toolkit mainly for audio plug-ins (VST, AudioUnit, etc).
pongasoft
Posts: 54
Joined: Sun Mar 11, 2018 5:57 pm

[Solved] editorhost COnOffButton not working

Postby pongasoft » Mon Mar 12, 2018 6:39 pm

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:

Screen Shot 2018-03-12 at 11.31.43.png


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
You do not have the required permissions to view the files attached to this post.

Arne Scheffler
Posts: 216
Joined: Mon Jun 20, 2016 7:53 am

Re: editorhost COnOffButton not working

Postby Arne Scheffler » Tue Mar 13, 2018 11:25 am

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

pongasoft
Posts: 54
Joined: Sun Mar 11, 2018 5:57 pm

Re: editorhost COnOffButton not working

Postby pongasoft » Tue Mar 13, 2018 2:03 pm

Arne Scheffler wrote: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:

Code: Select all

...
 <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

Arne Scheffler
Posts: 216
Joined: Mon Jun 20, 2016 7:53 am

Re: editorhost COnOffButton not working

Postby Arne Scheffler » Tue Mar 13, 2018 2:07 pm

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

pongasoft
Posts: 54
Joined: Sun Mar 11, 2018 5:57 pm

Re: editorhost COnOffButton not working

Postby pongasoft » Tue Mar 13, 2018 2:24 pm

Arne Scheffler wrote: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

Arne Scheffler
Posts: 216
Joined: Mon Jun 20, 2016 7:53 am

Re: editorhost COnOffButton not working

Postby Arne Scheffler » Tue Mar 13, 2018 2:44 pm

Do you have the following output in the debugger console ?

Code: Select all

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

pongasoft
Posts: 54
Joined: Sun Mar 11, 2018 5:57 pm

Re: editorhost COnOffButton not working

Postby pongasoft » Tue Mar 13, 2018 6:21 pm

Arne Scheffler wrote:Do you have the following output in the debugger console ?

Code: Select all

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


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

Yan

Arne Scheffler
Posts: 216
Joined: Mon Jun 20, 2016 7:53 am

Re: editorhost COnOffButton not working

Postby Arne Scheffler » Wed Mar 14, 2018 2:26 pm

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.

pongasoft
Posts: 54
Joined: Sun Mar 11, 2018 5:57 pm

Re: editorhost COnOffButton not working

Postby pongasoft » Wed Mar 14, 2018 6:03 pm

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

Arne Scheffler
Posts: 216
Joined: Mon Jun 20, 2016 7:53 am

Re: editorhost COnOffButton not working

Postby Arne Scheffler » Wed Mar 14, 2018 8:28 pm

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


Return to “VSTGUI”

Who is online

Users browsing this forum: No registered users and 1 guest