custom switch control - feedback

Hi Everyone,

Made a simple iOS switch for Mac/Win/Linux like in Xojo. Please check it out and provide me short feedback.
Thanks.
switch control

[quote=181190:@Rob Egal]Hi Everyone,

Made a simple iOS switch for Mac/Win/Linux like in Xojo. Please check it out and provide me short feedback.
Thanks.
switch control

[/quote]

On Windows, GDI+ needs to be switched on. And for some reason, the “ON” white text does not show.

Also, since labels are not transparent as default but simply have the color of the window, “left” and “right” go slightly over the top of the textfields below.

On Mac OS, very smooth. Thanks :slight_smile:

Looks nice! If I drag to “on” and the mouse is past the edge of the control, the state reverts to “off” and vice-versa.

[quote=181195:@Michel Bujardet]On Windows, GDI+ needs to be switched on. And for some reason, the “ON” white text does not show.

Also, since labels are not transparent as default but simply have the color of the window, “left” and “right” go slightly over the top of the textfields below.

On Mac OS, very smooth. Thanks :)[/quote]

Can you show me a screenshot ? Addmittedly, I have no windows rig and omitted the canvas tweak for.

Thanks! Will fix that.

Here :

As you can see, the two labels above the textfields “eat” them. You can make them transparent, or just move them up a pixel or two.

The GDI+ thing can be avoided simply by adding it in the Open event of the app ;
http://documentation.xojo.com/index.php/Application.UseGDIPlus

Alternatively, if you do not need the Alpha channel, just make sure to create your pictures with the color range within your class, such as

Dim myPic as New Picture(100,100,32)

For what it’s worth I have created a similar control. There are two versions, a standard one that works left-right and a vertical up-down control. I have dispensed with the ON and OFF script and used green and red buttons to determine the on/off state. A picture is below.

The files can be downloaded here:
https://dl.dropboxusercontent.com/u/10747116/RealStudioClasses/OnOffSliders.zip

[quote=181305:@Simon Berridge]For what it’s worth I have created a similar control. There are two versions, a standard one that works left-right and a vertical up-down control. I have dispensed with the ON and OFF script and used green and red buttons to determine the on/off state. A picture is below.

The files can be downloaded here:
https://dl.dropboxusercontent.com/u/10747116/RealStudioClasses/OnOffSliders.zip[/quote]

I can understand you like to present your control too but I ask you do not hijack this thread as
it’s only a feedback thread for my custom control.

[quote=181228:@Michel Bujardet]Here :

As you can see, the two labels above the textfields “eat” them. You can make them transparent, or just move them up a pixel or two.

The GDI+ thing can be avoided simply by adding it in the Open event of the app ;
http://documentation.xojo.com/index.php/Application.UseGDIPlus

Alternatively, if you do not need the Alpha channel, just make sure to create your pictures with the color range within your class, such as

Dim myPic as New Picture(100,100,32)

Thanks again Michel. It’s looks horrible. I’ll figure out and tweak the control for windows.

EasySwitch v1.01 available:

EasySwitch 1.01 - April 20th
- fixed issue: on/off state doesn't get inverted anymore
- added properties to inspector behavior
- improved drawing on windows (GDI+), doublebuffer, transparent

EasySwitch v1.01

Please dl and check. I’d appreciate your feedback especially for window users.

[quote=181417:@Rob Egal]EasySwitch v1.01 available:

EasySwitch 1.01 - April 20th
- fixed issue: on/off state doesn't get inverted anymore
- added properties to inspector behavior
- improved drawing on windows (GDI+), doublebuffer, transparent

EasySwitch v1.01

Please dl and check. I’d appreciate your feedback especially for window users.[/quote]

Much better on Windows for the labels. But still :

  • The white “ON” does not appear
  • In Small, there is an awkward shadow on each side that goes over the knob. See picture.

[quote=181388:@Rob Egal]I can understand you like to present your control too but I ask you do not hijack this thread as
it’s only a feedback thread for my custom control.[/quote]
With many apologies, Rob.

Not my intention!

[quote=181423:@Michel Bujardet]Much better on Windows for the labels. But still :

  • The white “ON” does not appear
  • In Small, there is an awkward shadow on each side that goes over the knob. See picture.

[/quote]

Thank you once again Michel. I’ll look into it. Hopefully this window thing is easy to sort out. :slight_smile:

I’ve looked into it and changed some things. However, drawing on windows seems difficult as
the rounded rects are not nicely rounded like on Mac. I am not sure how to make it good.
I am inclined to say double the size and scale down?

[quote=181903:@Rob Egal]I’ve looked into it and changed some things. However, drawing on windows seems difficult as
the rounded rects are not nicely rounded like on Mac. I am not sure how to make it good.
I am inclined to say double the size and scale down?[/quote]

Sounds good. I would even go 4x at least.

Under Windows, although scaling is available a bit like Retina 2x, High Dpi under Windows uses 216 dpi, which is actually already 3x. In other words, under Windows on an iMac 5k at full resolution, your control would need to be drawn at 3 times the size.

You may want to plan for that as well. Or for the possibility that the user has RubberViews on his window, which may change the size of your control.

[quote=181906:@Michel Bujardet]Sounds good. I would even go 4x at least.

Under Windows, although scaling is available a bit like Retina 2x, High Dpi under Windows uses 216 dpi, which is actually already 3x. In other words, under Windows on an iMac 5k at full resolution, your control would need to be drawn at 3 times the size.

You may want to plan for that as well. Or for the possibility that the user has RubberViews on his window, which may change the size of your control.[/quote]

Thanks Michel for your valuable help. I’ll check this out.

[quote=181417:@Rob Egal]EasySwitch v1.01 available:

EasySwitch 1.01 - April 20th
- fixed issue: on/off state doesn't get inverted anymore
- added properties to inspector behavior
- improved drawing on windows (GDI+), doublebuffer, transparent

EasySwitch v1.01

Please dl and check. I’d appreciate your feedback especially for window users.[/quote]

Hello @Rob Egal

i am currently looking for a Switch Control for OS X and found this Thread. The Switch looks exactly like what i am searching for. Would you please be so kind and put it for a few days on your Dropbox again?

Thank you for your kind help.

[quote=275764:@Sascha S]Hello @Rob Egal

i am currently looking for a Switch Control for OS X and found this Thread. The Switch looks exactly like what i am searching for. Would you please be so kind and put it for a few days on your Dropbox again?

Thank you for your kind help.[/quote]
Although I don’t normally like to suggest my own paid wares as alternate solutions, I have a switch control ready to go right now if you cannot wait for Rob. https://thezaz.com/code/zirconswitch/

Thank you @Thom McGrath, any help is welcome. :slight_smile:

Hi Sascha,

The suggested zirconswitch by Thom is a professional solution you’d consider for your apps if you want 100%
support and code maintaince.

The following projects I’ve made are free to use at your own risk.
https://www.dropbox.com/s/ql532n0mr0lhot5/EasySwitch_v1.03.xojo_binary_project?dl=1
https://www.dropbox.com/s/7kx09upgbw3fsl3/FlatSwitch.xojo_binary_project?dl=1

flatswitch: