Page 1 of 2

Circle progress bar

Posted: 31 Mar 2015, 23:43
by Bruttosozialprodukt
I posted these functions in another thread and thought, why not share them with everyone:

Code: [Select all] [Expand] [Download] (progressCircle.ahk)GeSHi © Codebox Plus



Example 1: (Slowly fill a small progress circle)

Code: [Select all] [Expand] [Download] (example1.ahk)GeSHi © Codebox Plus



Example 2: (huge progress circle for downloads)

Code: [Select all] [Expand] [Download] (ecample2.ahk)GeSHi © Codebox Plus



Screenshot:
Image

Re: Circle progress bar

Posted: 01 Apr 2015, 01:35
by Learning one
Nice work! :) I quickly rewrote it and used Class syntax, auto GDI+ on/off, auto clear-up, click through style and hopefully simplified usage.
Edit: Added more options; ability to display text, draw background, added option to disable click through style, some minor drawing modifications...
Image

Example 1 - simple:

Code: [Select all] [Download] (Script.ahk)GeSHi © Codebox Plus

CircleProgress := new CircleProgressClass()
Loop, 100 {
CircleProgress.Update(A_Index, "Downloading`nAutoHotkey.exe`n`n" A_Index "% done")
Sleep, 50
}
return

Example 2 - intermediate:

Code: [Select all] [Expand] [Download] (Script.ahk)GeSHi © Codebox Plus


Class:

Code: [Select all] [Expand] [Download] (Script.ahk)GeSHi © Codebox Plus


Re: Circle progress bar

Posted: 01 Apr 2015, 08:22
by joedf
Very nice! :D

Re: Circle progress bar

Posted: 01 Apr 2015, 08:55
by fischgeek
Oh my God I love this.

Re: Circle progress bar

Posted: 01 Apr 2015, 09:39
by Ferry
Nice! but it is not working on Unicode 64 bit for now.

Re: Circle progress bar

Posted: 01 Apr 2015, 10:12
by fischgeek
I finally get to make my circle clock with ease! Thank you!

Code: [Select all] [Expand] [Download] (Script.ahk)GeSHi © Codebox Plus


Re: Circle progress bar

Posted: 01 Apr 2015, 13:28
by joedf
Somebody make a gist!
like "Circle.ahk" or something ;)

Re: Circle progress bar

Posted: 01 Apr 2015, 13:58
by fischgeek

Re: Circle progress bar

Posted: 01 Apr 2015, 16:37
by FanaticGuru
Ferry wrote:Nice! but it is not working on Unicode 64 bit for now.

You just need the 64 bit version of gdip.

https://www.dropbox.com/s/0e9gdfetbfa8v0o/Gdip_All.ahk

You have to rename that to Gdip.ahk and put in your lib folder.

FG

Re: Circle progress bar

Posted: 01 Apr 2015, 17:34
by FanaticGuru
Learning one wrote:Class:

Code: [Select all] [Expand] [Download] (Script.ahk)GeSHi © Codebox Plus


This line causes an error of Call to nonexistent function:
hbm := CreateDIBSection(this.W, this.W), hdc := CreateCompatibleDC(), obm := SelectObject(hdc, hbm)
It does not seem like this line should occur before a pToken := Gdip_Startup().

Works fine if I forgo the auto detect and insert a pToken := Gdip_Startup().

FG

Re: Circle progress bar

Posted: 02 Apr 2015, 01:38
by Ferry
FanaticGuru wrote:
Ferry wrote:Nice! but it is not working on Unicode 64 bit for now.

You just need the 64 bit version of gdip.

https://www.dropbox.com/s/0e9gdfetbfa8v0o/Gdip_All.ahk

You have to rename that to Gdip.ahk and put in your lib folder.

FG


That did the trick. Thanks!

Re: Circle progress bar

Posted: 02 Apr 2015, 05:08
by Learning one
I'm glad you like it guys :)
Nice example fischgeek!
Ferry, yes, you need Gdip_All.ahk, as FanaticGuru said.
FanaticGuru, I don't get such errors...
Bruttosozialprodukt, it seems I hijacked your thread :( I'm sorry do you want me to stop posting?

In v1.03 (see updated second post of this thread) I added option to disable click through style, and did some minor drawing modifications...

What about this concept - multiple circle progres;
Image

Re: Circle progress bar

Posted: 02 Apr 2015, 06:55
by joedf
@learningOne nonsense, Id say just add a comment header with versioning and proper credit to Bruttosozialprodukt and to you, with an open source license of your choice or public domain, etc ;)

Re: Circle progress bar

Posted: 02 Apr 2015, 08:29
by Bruttosozialprodukt
Learning one wrote:Bruttosozialprodukt, it seems I hijacked your thread :( I'm sorry do you want me to stop posting?

Yes, stop posting immediately and delete your account or I'm gonna sue you! xD

No, it's great to see that so many people like the idea so much. And I didn't plan to extend/improve the functions anyway. ;)

Re: Circle progress bar

Posted: 02 Apr 2015, 08:31
by fischgeek
@Learning one - That's awesome. I like that you changed the click-through style - though, I did like that I can click through it. I made some mods to my clock and it stays in the bottom left, but still allows me to click through. Also, thanks for the class implementation. Nice work! ;)

I do have a couple questions though about the capability if anyone can answer them...

1) Is there a physical window for this that would make it move-able? Usually in Gui's I do +ToolWindow -Caption and add a gLabel to a control with PostMessage, 0xA1, 2,,, A so that I can drag it around with a left click and drag. It would be nice to be able to do that with this. I'm assuming without wrapping this in some kind of gui it's not possible.

2) I cannot for the life of me figure out the color code is it hex with a transparency attached to it? What's the format here?

My mind is going crazy with all the possibilities and ideas I have planned for this.

Re: Circle progress bar

Posted: 02 Apr 2015, 08:59
by Bruttosozialprodukt
Color format should be 0xAARRGGBB
AA=Alpha (Opacity), RR=Red, GG=Green, BB=Blue
0xFFFF0000 - Red with full opacity
0x440000FF - Blue with low opacity

Re: Circle progress bar

Posted: 02 Apr 2015, 09:17
by fischgeek
Thank you.

Re: Circle progress bar

Posted: 02 Apr 2015, 10:28
by Learning one
@Bruttosozialprodukt: lol :) 8-) As joedf suggested, I would like to put the following text in CircleProgressClass comments: "Credits: Bruttosozialprodukt, Learning one. This code is public domain." Is that OK with you?
fischgeek wrote:... make it move-able ...
No problem :)

Code: [Select all] [Expand] [Download] (Script.ahk)GeSHi © Codebox Plus


Re: Circle progress bar

Posted: 02 Apr 2015, 11:22
by toralf
Wouldn't it be possible to include this in the class itself, since OnMessage() does now work for more then one CallBackFunc?

Re: Circle progress bar

Posted: 02 Apr 2015, 12:20
by Bruttosozialprodukt
Learning one wrote:As joedf suggested, I would like to put the following text in CircleProgressClass comments: "Credits: Bruttosozialprodukt, Learning one. This code is public domain." Is that OK with you?

Of course. ;)