How to display a round object?

Post

Posted
Rating:
#1 (In Topic #347)
Avatar
Regular
issboss is in the usergroup ‘Regular’
 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

Image

(Click to enlarge)


Retired 20-year USN veteran. In IT field since 1961.
Online now: No Back to the top

Post

Posted
Rating:
#2
Avatar
Regular
Technopeasant is in the usergroup ‘Regular’
 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.
Online now: No Back to the top

Post

Posted
Rating:
#3
Avatar
Regular
issboss is in the usergroup ‘Regular’
 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.
Online now: No Back to the top

Post

Posted
Rating:
#4
Avatar
Regular
issboss is in the usergroup ‘Regular’
 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.
Online now: No Back to the top

Post

Posted
Rating:
#5
Avatar
Regular
Technopeasant is in the usergroup ‘Regular’
For future reference, as far as I know JPEG has no transparency support, so you would need to use GIF or PNG.
Online now: No Back to the top

Post

Posted
Rating:
#6
Avatar
Administrator
sholzy is in the usergroup ‘unknown’
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.

Image

(Click to enlarge)


sholzy
Gambas One Site Director

To report bugs in the Gambas IDE:
Official Gambas Bug Tracker
Online now: No Back to the top

Post

Posted
Rating:
#7
Avatar
Regular
jornmo is in the usergroup ‘Regular’
You might get some ideas from this?!

Gambas One - Gambas ONE

Online now: No Back to the top

Post

Posted
Rating:
#8
Avatar
Regular
issboss is in the usergroup ‘Regular’
 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.
Online now: No Back to the top

Post

Posted
Rating:
#9
Avatar
Regular
Cedron is in the usergroup ‘Regular’

issboss said

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"

https://forum.gambas.one/viewtopic.php?p=1517

.... and carry a big stick!
Online now: No Back to the top

Post

Posted
Rating:
#10
Avatar
Regular
issboss is in the usergroup ‘Regular’
 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.
Online now: No Back to the top

Post

Posted
Rating:
#11
Avatar
Guru
cogier is in the usergroup ‘Guru’
That's the trouble people doesn't speak proper no more! :D
Online now: No Back to the top

Post

Posted
Rating:
#12
Avatar
Regular
Cedron is in the usergroup ‘Regular’

issboss said

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

Having lived with OCD people, I fixed it for you.

Hopefully you recognize the line from the movie "12 Angry Men".

Nobody seems to have recognized, or at least mentioned it, that the state model (TS_Ready, TS_Attack, TS_Decay, TS_Sustain, TS_Release) I used is actually the standard model for a musical note and the program is really a prototype for a Midi renderer.

It's all in how you see things, and of course, morely done proper speaking.

.... and carry a big stick!
Online now: No Back to the top

Post

Posted
Rating:
#13
Avatar
Regular
issboss is in the usergroup ‘Regular’
:lol:  Thanks. I appreciate that. Keep on doing gooder then others

Bill

Retired 20-year USN veteran. In IT field since 1961.
Online now: No Back to the top

Post

Posted
Rating:
#14
Avatar
Regular
issboss is in the usergroup ‘Regular’
 So as not to keep anyone in suspense, here's what I've come up with so far. I'll add the working file as an attachment. I know it is FULL of outright horrible programming techniques, but I tend to attack a problem, solve it, THEN make it pretty. Seems to be easier that way.

It's a simple thing, the switches and lights work (especially when the "computer" is turned on and the Auto/Manual is in Manual. You can set switch patterns into registers and transfer them from register to register. RAM has just 16K (40000 Octal).

There is a menu item for Saving "RAM", but I haven't finished the Loading into RAM portion. I'm working on a sort-of compiler for this computer, but it's slow going. I used this computer for almost 15 years while in the Navy, and was the only Navy-wide programmer for 7 of those 15. It's common name was Outstation Processing Unit and was in every outstation of a worldwide HFDF network. Fantastic machine, given the age and its age. Runs on OCTAL, so be wary.

Bill

Attachment

Retired 20-year USN veteran. In IT field since 1961.
Online now: No Back to the top

Post

Posted
Rating:
#15
Avatar
Administrator
sholzy is in the usergroup ‘unknown’
Interesting. I like playing with old equipment, even if it's just a simulation.

2 issues…
Image

(Click to enlarge)


1. Good thing I use dual monitors!  ;)  When FMain's Form Resizable property is set to "False", as you can see I need 2 monitors to hold the app's window. When the property is set to "True" the window fits on one screen. You must be using a high-resolution monitor? Also, for whatever reason (I haven't dug into it yet), the switch and lamp images don't line up properly.

2. When quitting an app, you should use "Close", not "Quit".  Has something to do with the app ending properly and not leaving behind any crud. It's documented somewhere, I just can't locate it right now.

Edit: Found two of the references for using "Close", not "Quit"…
http://gambaswiki.org/wiki/lang/quit
https://gambas-user.na…not-close-gui-application
There was another reference that went into better detail, but that's the one I can't locate.

sholzy
Gambas One Site Director

To report bugs in the Gambas IDE:
Official Gambas Bug Tracker
Online now: No Back to the top

Post

Posted
Rating:
#16
Avatar
Regular
issboss is in the usergroup ‘Regular’
 When I created the main form, I set Resize to False. If it goes True, none of the controls will resize or move from their original positions. Yes, I do have a widescreen monitor (1920 x 1080). What seems strange, to me anyway, is the double representation of the three lit lights and the rotary switch. Would that be because the positions "start over" at the right edge of the un-resized form when resized?

I'll change to "Close" right away. Quit didn't sound right to me, but I couldn't find anything definitive. Thanks for the references. What I did in VB was to close all the open windows, then shut down any programming loops, then end the program. I should have followed that practice.

It was/is a fun thing to program.

Bill

Retired 20-year USN veteran. In IT field since 1961.
Online now: No Back to the top
1 guest and 0 members have just viewed this.