How to display a round object?

User avatar
issboss
Posts: 27
Joined: Wednesday 16th October 2019 6:20pm
Location: Ohio, USA
Contact:

How to display a round object?

Post by issboss » Sunday 08th December 2019 7:14pm

I'm creating a control panel and can't seem to find any way to display a round image. The image is one of a rotary switch (with a white dot as an indicator) with small hash marks at the stopping points around the periphery (outside the image). I am using a PictureBox and setting "Picture" to the image. That works well, but there are four corners to the image that blot out the tick marks around the sides.

Is there a way to make a round area, which will NOT be clickable or used by the operator, but simply show the rotating image as buttons around the image are clicked. My attempts at making the four corners transparent have not been successful although there is supposed to be a way to make that happen in Gimp. Even then, I'm not sure it will cause the underlying "panel" behind the image show once more.

A screenshot is attached showing what I mean.

Bill
Attachments
Rotary Example.jpg
Rotary Example.jpg (8.1 KiB) Viewed 653 times
Retired 20-year USN veteran. In IT field since 1961.

User avatar
Technopeasant
Posts: 36
Joined: Saturday 13th July 2019 6:50pm

Re: How to display a round object?

Post by Technopeasant » Sunday 08th December 2019 7:39pm

As far as I know, all Gambas controls are rectangles. Is your image for the dial transparent? What I would do is have the dial as the bottom control, and then the ticks as the top control and let transparency do the rest.

Also, what toolkit are you using? I only use Qt 5 as the transparency in all of the others is non-functional.
Technical director,
Piga Software
http://icculus.org/piga/

User avatar
issboss
Posts: 27
Joined: Wednesday 16th October 2019 6:20pm
Location: Ohio, USA
Contact:

Re: How to display a round object?

Post by issboss » Sunday 08th December 2019 8:13pm

I'm using QT5 and QT5 Extension. I don't see anything about transparent for a picturebox, though. I've been trying all morning to make the four corners (the areas in Gray) transparent, but haven't had any luck. I'm not proficient in Gimp enough to extract the circular switch and leave the rest transparent. Could it be because I'm using JPGs instead of something else?

Bill
Retired 20-year USN veteran. In IT field since 1961.

User avatar
issboss
Posts: 27
Joined: Wednesday 16th October 2019 6:20pm
Location: Ohio, USA
Contact:

Re: How to display a round object?

Post by issboss » Sunday 08th December 2019 9:20pm

Seems as if I've solved the problem from way outside the box (no pun intended). I just made the buttons for the register letters larger than they would have been to include the short marker line and overlay a picture onto the button that covers the four "skirts" of gray nicely.

Are any of the devs thinking of creating a round control? Seems it would be right handy to a lot of people - including me for the toggle switches I have to animate.

Bill
Retired 20-year USN veteran. In IT field since 1961.

User avatar
Technopeasant
Posts: 36
Joined: Saturday 13th July 2019 6:50pm

Re: How to display a round object?

Post by Technopeasant » Monday 09th December 2019 3:31am

For future reference, as far as I know JPEG has no transparency support, so you would need to use GIF or PNG.
Technical director,
Piga Software
http://icculus.org/piga/

User avatar
Got2BeFree
Posts: 88
Joined: Saturday 26th November 2016 2:52am
Location: Lost

Re: How to display a round object?

Post by Got2BeFree » Monday 09th December 2019 5:17am

Bill, if you send me your image file I can create a new png image for you.

The example image I created using your rotary example is a png with transparent corners.
Rotary Example.png
Rotary Example.png (21.63 KiB) Viewed 642 times
sholzy

I'm wondering around lost in the past, not knowing where the present is.

User avatar
jornmo
Site Admin
Posts: 219
Joined: Wednesday 21st September 2016 1:19pm
Location: Norway

Re: How to display a round object?

Post by jornmo » Monday 09th December 2019 2:41pm

You might get some ideas from this?!

viewtopic.php?f=6&t=12

User avatar
issboss
Posts: 27
Joined: Wednesday 16th October 2019 6:20pm
Location: Ohio, USA
Contact:

Re: How to display a round object?

Post by issboss » Monday 09th December 2019 4:03pm

Great suggestions. Last first:

@Jornmo: I saw the gauge and fiddled with it for an hour or so. If I were making a continuous rotating object, it would be fine, but I needed snap-to steps of 30 degrees. Individual pictures seemed the best way to go, displayed as the perimeter letters were clicked.

@Got2befree: Much thanks. I should take the time to figure out how to do this myself. You image worked perfectly. Thank goodness for the Stretch property.

@Technopeasant: I knew JPGs didn't have but one channel, but they were the easiest to work with. I'm in the process of converting all of them to at least flat PNGs as that format seems to display better for some reason. Probably because it isn't a lossy format.

My thanks to all.

Bill
Retired 20-year USN veteran. In IT field since 1961.

User avatar
Cedron
Posts: 104
Joined: Thursday 21st February 2019 5:02pm
Location: The Mitten State
Contact:

Re: How to display a round object?

Post by Cedron » Monday 09th December 2019 8:01pm

issboss wrote:
Sunday 08th December 2019 9:20pm
Seems as if I've solved the problem from way outside the box (no pun intended). I just made the buttons for the register letters larger than they would have been to include the short marker line and overlay a picture onto the button that covers the four "skirts" of gray nicely.

Are any of the devs thinking of creating a round control? Seems it would be right handy to a lot of people - including me for the toggle switches I have to animate.

Bill
Did some one say "way outside the box" and something about animated controls?

You might enjoy the programming examples from this thread: "Programming is supposed to be fun"

viewtopic.php?p=1517
.... and carry a big stick!

User avatar
issboss
Posts: 27
Joined: Wednesday 16th October 2019 6:20pm
Location: Ohio, USA
Contact:

Re: How to display a round object?

Post by issboss » Monday 09th December 2019 8:58pm

Interesting thread, Cedron. The Author in me couldn't resist a little editing. In the last post of the thread: "run it up the flag pool" ??? Sorry. it's my OCD kicking in.

Bill
Retired 20-year USN veteran. In IT field since 1961.

Post Reply