ProgressCircle class

Hi folks,

I’ve just done my “progress circle” class and wondering if there’s any interest? :slight_smile:
It’s purely in Xojo and should work on x-platform.

Icons delivered in the package are open source:
https://useiconic.com/open/

Download dropbox:
https://www.dropbox.com/s/rqe5x0h8g74wxdm/progressCircle_v1.zip?dl=0

Fantastic, thanks.
Lennox

FYI: ProgressCircle is a locked class, so making changes (like moving the arrow a bit more to the left) is not possible by yourself.

Is the class meant to be Open Source too?
License?

Thanks.

??

It’s locked and encryptet, true. However, you can make your changes in the “paint” event called from the subclass.

Will you be offering full source?

[quote=220230:@Massimo Valle]Is the class meant to be Open Source too?
License?

Thanks.[/quote]

The images are open source components you can replace/remove. The class is available for purchase for 15€/15USD (unencrypted only). Please note send me a PM for more details.

Are you referring to Massimo’s question? If so look above.

Yes.

Here is a free quick code to create a simple similar ProgressCircle.

  • Add a slider control (and add a ValueChanged event with code Canvas1.Invalidate

  • Add a canvas with dimensions : 100x100

  • Put the below code in the Canvas paint event

    [code]
    Dim procent as double = Slider1.Value
    Dim procentText as string = str( round(procent) )

    Dim a As New ArcShape
    a.ArcAngle = (6.24/100)*procent
    a.StartAngle = -1.57
    a.FillColor = &c0000FF00
    a.Height=50
    a.Width=50

    g.ForeColor=&c99999900
    g.FillOval 25,25, 50,50

    g.DrawObject(a, 50, 50)

    g.ForeColor = &cB3B3B300
    g.ForeColor = rgb(110,110,110)

    g.ForeColor = &cFFFFFF00
    g.FillOval 28,28, 44,44
    g.ForeColor = &c00000000
    g.TextSize=20
    g.DrawString procentText,50-(g.StringWidth(procentText)/2),56
    g.TextSize=10
    g.DrawString “%”, 55+(g.StringWidth(procentText)/2) ,56
    [/code]

Nothing fancy but it works fine and you can tweak it easily to fit your needs.

Nice Christoph,
Lennox

Christoph’s Code with some color gimmicks

Download

Fantastic Axel
Lennox

This won’t be noticeable but tau (2pi) is 6.28318…
6.24 is 0.6% off :slight_smile:

Axel’s code as a REAL.Studio project (for those still using older versions)

https://dl.dropboxusercontent.com/u/992591/Xojo/Forum/ColoredPercentCircle.rbp.zip

(and I changed tau to 6.28)

to obtain the proportions when resizing Canvas1

Canvas1.Paint

    me.Height = me.Width
  Dim procent as double = Slider1.Value
  Dim procentText as string = str( round(procent) )
  
  Dim a As New ArcShape
  a.ArcAngle = (6.28/100)*procent
  a.StartAngle = - 1.57
  a.FillColor = mycolor
  a.Height=me.Height/2
  a.Width=me.Width/2
  
  g.ForeColor=myTXTcolor
  g.FillOval me.Width/4,me.Height/4, me.Width/2,me.Height/2
  
  g.DrawObject(a, me.Width/2,me.Height/2)
  
  g.ForeColor = myBGcolor
  g.FillOval  me.Width/3.33, me.Height/3.33, me.Width/2.5, me.Height/2.5
  g.ForeColor = myTXTcolor
  g.TextSize=floor(me.Width/5)
  g.DrawString procentText,me.Width/2.2-(g.StringWidth(procentText)/2),me.Width/1.75
  g.TextSize=floor(me.Width/10)
  g.DrawString "%", me.Width/2.2 + g.StringWidth(procentText) ,me.Width/1.88
  
  if val(procentText) > 99 then
    g.ForeColor=&cE50C0000
    g.FillOval me.Width/4, me.Height/4, me.Width/2, me.Height/2
    g.ForeColor=&c2D7D3500
    g.FillOval me.Width/3.33, me.Height/3.33, me.Width/2.5, me.Height/2.5
    g.ForeColor = &cFFFFFF00
    g.TextSize=floor(me.Width/6)
    g.DrawString procentText,me.Width/2.25-(g.StringWidth(procentText)/2),me.Width/1.75
    g.TextSize=floor(me.Width/10.5)
    g.DrawString "%", me.Width/2.25 + g.StringWidth(procentText) ,me.Width/1.88
  end if

I Love my class and its better than yours. Iam hijacking the thread back. :slight_smile:

Actually I think the original development was by Thomas Jakob in 2013 :wink:

https://forum.xojo.com/6604-free-control-for-dashboards

[quote=220185:@Rob Egal]I’ve just done my “progress circle” class and wondering if there’s any interest? :slight_smile:
[/quote]

Don’t let “it’s been done before” comments drag you down. Each new project is a welcome addition to Xojo’s toolbox.

What you did is much closer to what Apple uses today than the other projects hijacking your thread.

It is a very nice looking class, its just that something similar has been done before.

On the other hand better is the enemy of good :wink:

Also one can’t expect that because someone is selling a control that nobody else is creating their own version. On the contrary, once an idea is out it will be pounced upon, and one’s job is to stay ahead. That is what drives innovation.

Hey Folks,

Thanks for the comments. Of course it’s not “new” but if someone it still interested why not offering?
I’ve been looking for goods projects to learn from for ages and gave up as it was all for purchase.

I am now at a level where I do my own thing. I risk losing my code idea when making
it available for the public and some else incorporates it later. Heck who’s paying my license renewal ? It’s me right ?

Btw, the class from Thomas Jakob is great too.