Jump to content

Pangaea Ruler


rakudave
 Share

Recommended Posts

I made this little tool to measure things when testing GUI's 'n stuff

it's resizable and transparent. there's also a optional tooltip with all infos.

and you can toggle on/off

for the compiled version with icon: see attached file

screenie:

Posted Image

and the source:

CODE
#include <GUIConstants.au3>

AutoItSetOption("GUIResizeMode",802)

Global $oldwidth = 500, $oldheight = 100, $ontop = 1

$main = GUICreate("Pangaea_Ruler",500,100,-1,-1,$WS_POPUP + $WS_SIZEBOX)

GUICtrlCreateLabel("",28,28,32,20,$SS_BLACKFRAME,$GUI_WS_EX_PARENTDRAG)

$quit = GUICtrlCreateLabel("",133,28,32,20,$SS_BLACKFRAME + $SS_NOTIFY)

_draw()

GUICtrlCreateLabel("move",30,30,28,20,$SS_CENTER,$GUI_WS_EX_PARENTDRAG)

GUICtrlCreateLabel("",28,28,32,20,$SS_BLACKFRAME)

$trans = GUICtrlCreateSlider(60,37,73,18,$TBS_NOTICKS)

GUICtrlSetLimit(-1,255,80)

GUICtrlSetData(-1,220)

GUICtrlCreateLabel("transparency:",70,25,100,12)

GUICtrlSetFont(-1,7)

$top = GUICtrlCreateCheckbox('"Always On Top"',28,50)

GUICtrlSetState(-1,1)

$info = GUICtrlCreateCheckbox("Info",130,50,-1,-1,$SS_NOTIFY)

GUICtrlSetState(-1,1)

GUICtrlCreateLabel("quit",135,30,28,20,$SS_CENTER)

GUICtrlCreateLabel("",133,28,32,20,$SS_BLACKFRAME)

GUISetState()

WinSetTrans("Pangaea_Ruler","",220)

WinSetOnTop("Pangaea_Ruler","",1)

do

$msg = GUIGetMsg()

$size = WinGetPos("Pangaea_Ruler","")

If $size[3] <> $oldheight then

If $size[3] < 100 then

WinMove("Pangaea_Ruler","",$size[0],$size[1],$size[2],100)

Else

$oldheight = $size[3]

EndIf

EndIf

If $size[2] <> $oldwidth then

If $size[2] < 200 then

WinMove("Pangaea_Ruler","",$size[0],$size[1],200)

Else

$oldwidth = $size[2]

EndIf

EndIf

If $msg = $top then

select

case $ontop = 0

WinSetOnTop("Pangaea_Ruler","",1)

$ontop = 1

case $ontop = 1

WinSetOnTop("Pangaea_Ruler","",0)

$ontop = 0

EndSelect

EndIf

If $msg = $trans then WinSetTrans("Pangaea_Ruler","",GUICtrlRead($trans))

If $msg = $quit then exit

If $msg = $info then ToolTip("")

If GUICtrlRead($info) = 1 then

$cur = GUIGetCursorInfo()

$pos = WinGetPos("Pangaea_Ruler","")

ToolTip("Rel. mouse position: " & $cur[0] + 4 & "x" & $cur[1] + 4 & @crlf & "Abs. mouse position: " & MouseGetPos(0) & "x" & MouseGetPos(1) & @crlf & "Win position: " & $pos[0] & "x" & $pos[1] & @crlf & "Win size: " & $pos[2] & "x" & $pos[3])

EndIf

until $msg = $GUI_EVENT_CLOSE

Func _draw()

for $x = 5 to @desktopwidth step 5

Select

case $x = 20

GUICtrlCreateLabel("",$x - 4,0,1,10,$SS_BLACKRECT)

case StringinStr($x / 20,".") = 0

GUICtrlCreateLabel("",$x - 4,0,1,10,$SS_BLACKRECT)

GUICtrlCreateLabel($x,$x - 4,10)

GUICtrlSetFont(-1,6)

case else

GUICtrlCreateLabel("",$x - 4,0,1,5,$SS_BLACKRECT)

EndSelect

next

for $y = 5 to @desktopheight step 5

Select

case $y = 20

GUICtrlCreateLabel("",0,$y - 4,10,1,$SS_BLACKRECT)

GUICtrlCreateLabel($y,15,$y - 8)

GUICtrlSetFont(-1,6)

case StringinStr($y / 20,".") = 0

GUICtrlCreateLabel("",0,$y - 4,10,1,$SS_BLACKRECT)

GUICtrlCreateLabel($y,10,$y - 4)

GUICtrlSetFont(-1,6)

case else

GUICtrlCreateLabel("",0,$y - 4,5,1,$SS_BLACKRECT)

EndSelect

next

AutoItSetOption("GUIResizeMode",842)

for $x = 5 to @desktopwidth step 5

Select

case $x < 30

case StringinStr($x / 20,".") = 0

GUICtrlCreateLabel($x,$x - 4,80)

GUICtrlSetFont(-1,6)

GUICtrlCreateLabel("",$x - 4,90,1,10,$SS_BLACKRECT)

case else

GUICtrlCreateLabel("",$x - 4,95,1,5,$SS_BLACKRECT)

EndSelect

next

AutoItSetOption("GUIResizeMode",804)

for $y = 5 to @desktopheight step 5

Select

case $y < 25

case StringinStr($y / 20,".") = 0

GUICtrlCreateLabel($y,480,$y - 4)

GUICtrlSetFont(-1,6)

GUICtrlCreateLabel("",490,$y - 4,10,1,$SS_BLACKRECT)

case else

GUICtrlCreateLabel("",495,$y - 4,5,1,$SS_BLACKRECT)

EndSelect

next

AutoItSetOption("GUIResizeMode",802)

EndFunc

hope anyone uses it ^^

Pangaea_Ruler.zip

Link to comment
Share on other sites

Ooh, wow, great idea, I know I could use this alot XD when Im makeing GUI's it consists of alot of trialand error.

[quote name='DaleHohm']You have a strange habit of posting error messages that don't match your code.[/quote][quote name='SmOke_N']Forget the learning... straight to the scripting :lol: (laugh.gif)[/quote]

Link to comment
Share on other sites

I made this little tool to measure things when testing GUI's 'n stuff

it's resizable and transparent. there's also a optional tooltip with all infos.

and you can toggle on/off

for the compiled version with icon: see attached file

screenie:

Posted Image

and the source:

CODE
#include <GUIConstants.au3>

AutoItSetOption("GUIResizeMode",802)

Global $oldwidth = 500, $oldheight = 100, $ontop = 1

$main = GUICreate("Pangaea_Ruler",500,100,-1,-1,$WS_POPUP + $WS_SIZEBOX)

GUICtrlCreateLabel("",28,28,32,20,$SS_BLACKFRAME,$GUI_WS_EX_PARENTDRAG)

$quit = GUICtrlCreateLabel("",133,28,32,20,$SS_BLACKFRAME + $SS_NOTIFY)

_draw()

GUICtrlCreateLabel("move",30,30,28,20,$SS_CENTER,$GUI_WS_EX_PARENTDRAG)

GUICtrlCreateLabel("",28,28,32,20,$SS_BLACKFRAME)

$trans = GUICtrlCreateSlider(60,37,73,18,$TBS_NOTICKS)

GUICtrlSetLimit(-1,255,80)

GUICtrlSetData(-1,220)

GUICtrlCreateLabel("transparency:",70,25,100,12)

GUICtrlSetFont(-1,7)

$top = GUICtrlCreateCheckbox('"Always On Top"',28,50)

GUICtrlSetState(-1,1)

$info = GUICtrlCreateCheckbox("Info",130,50,-1,-1,$SS_NOTIFY)

GUICtrlSetState(-1,1)

GUICtrlCreateLabel("quit",135,30,28,20,$SS_CENTER)

GUICtrlCreateLabel("",133,28,32,20,$SS_BLACKFRAME)

GUISetState()

WinSetTrans("Pangaea_Ruler","",220)

WinSetOnTop("Pangaea_Ruler","",1)

do

$msg = GUIGetMsg()

$size = WinGetPos("Pangaea_Ruler","")

If $size[3] <> $oldheight then

If $size[3] < 100 then

WinMove("Pangaea_Ruler","",$size[0],$size[1],$size[2],100)

Else

$oldheight = $size[3]

EndIf

EndIf

If $size[2] <> $oldwidth then

If $size[2] < 200 then

WinMove("Pangaea_Ruler","",$size[0],$size[1],200)

Else

$oldwidth = $size[2]

EndIf

EndIf

If $msg = $top then

select

case $ontop = 0

WinSetOnTop("Pangaea_Ruler","",1)

$ontop = 1

case $ontop = 1

WinSetOnTop("Pangaea_Ruler","",0)

$ontop = 0

EndSelect

EndIf

If $msg = $trans then WinSetTrans("Pangaea_Ruler","",GUICtrlRead($trans))

If $msg = $quit then exit

If $msg = $info then ToolTip("")

If GUICtrlRead($info) = 1 then

$cur = GUIGetCursorInfo()

$pos = WinGetPos("Pangaea_Ruler","")

ToolTip("Rel. mouse position: " & $cur[0] + 4 & "x" & $cur[1] + 4 & @crlf & "Abs. mouse position: " & MouseGetPos(0) & "x" & MouseGetPos(1) & @crlf & "Win position: " & $pos[0] & "x" & $pos[1] & @crlf & "Win size: " & $pos[2] & "x" & $pos[3])

EndIf

until $msg = $GUI_EVENT_CLOSE

Func _draw()

for $x = 5 to @desktopwidth step 5

Select

case $x = 20

GUICtrlCreateLabel("",$x - 4,0,1,10,$SS_BLACKRECT)

case StringinStr($x / 20,".") = 0

GUICtrlCreateLabel("",$x - 4,0,1,10,$SS_BLACKRECT)

GUICtrlCreateLabel($x,$x - 4,10)

GUICtrlSetFont(-1,6)

case else

GUICtrlCreateLabel("",$x - 4,0,1,5,$SS_BLACKRECT)

EndSelect

next

for $y = 5 to @desktopheight step 5

Select

case $y = 20

GUICtrlCreateLabel("",0,$y - 4,10,1,$SS_BLACKRECT)

GUICtrlCreateLabel($y,15,$y - 8)

GUICtrlSetFont(-1,6)

case StringinStr($y / 20,".") = 0

GUICtrlCreateLabel("",0,$y - 4,10,1,$SS_BLACKRECT)

GUICtrlCreateLabel($y,10,$y - 4)

GUICtrlSetFont(-1,6)

case else

GUICtrlCreateLabel("",0,$y - 4,5,1,$SS_BLACKRECT)

EndSelect

next

AutoItSetOption("GUIResizeMode",842)

for $x = 5 to @desktopwidth step 5

Select

case $x < 30

case StringinStr($x / 20,".") = 0

GUICtrlCreateLabel($x,$x - 4,80)

GUICtrlSetFont(-1,6)

GUICtrlCreateLabel("",$x - 4,90,1,10,$SS_BLACKRECT)

case else

GUICtrlCreateLabel("",$x - 4,95,1,5,$SS_BLACKRECT)

EndSelect

next

AutoItSetOption("GUIResizeMode",804)

for $y = 5 to @desktopheight step 5

Select

case $y < 25

case StringinStr($y / 20,".") = 0

GUICtrlCreateLabel($y,480,$y - 4)

GUICtrlSetFont(-1,6)

GUICtrlCreateLabel("",490,$y - 4,10,1,$SS_BLACKRECT)

case else

GUICtrlCreateLabel("",495,$y - 4,5,1,$SS_BLACKRECT)

EndSelect

next

AutoItSetOption("GUIResizeMode",802)

EndFunc

hope anyone uses it ^^
This is really cool - two questions first can you add a grid? and second can the back ground change colors?

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

I made this little tool to measure things when testing GUI's 'n stuff

it's resizable and transparent. there's also a optional tooltip with all infos.

and you can toggle on/off

rakudave,

Very cool tool. :P Thanks for sharing.

I think (as another option) the optional tooltip with all infos would fit nicely inside the ruler. As it is, when you are working on the right side of the screen the tooltip is off the screen.

Good job.

taurus905

"Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs

Link to comment
Share on other sites

This is really cool - two questions first can you add a grid? and second can the back ground change colors?

Would also Like to see a grid, maby cover entire desktop but not interfere with anything, likeyour background, but always be alligned with ruler....Would be a nice addition.

[quote name='DaleHohm']You have a strange habit of posting error messages that don't match your code.[/quote][quote name='SmOke_N']Forget the learning... straight to the scripting :lol: (laugh.gif)[/quote]

Link to comment
Share on other sites

@all: thanks...

This is really cool - two questions first can you add a grid? and second can the back ground change colors?

I can do that...

I think (as another option) the optional tooltip with all infos would fit nicely inside the ruler. As it is, when you are working on the right side of the screen the tooltip is off the screen.

ahm, good point...

i'll try to solve this problem...

Link to comment
Share on other sites

Another thing I think might be useful is to be able to decide the amount of pixels to show on the ruler. You have 500 width with every 10 pixels showing.

Someone could want it delimited 500 with every 5 pixels showing.

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

very useful, i agree with the idea JSThePatriot

My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.
Link to comment
Share on other sites

Another thing I think might be useful is to be able to decide the amount of pixels to show on the ruler. You have 500 width with every 10 pixels showing.

Someone could want it delimited 500 with every 5 pixels showing.

... not sure whether i'm getting your point, but you can resize the window and i'ts showing 5 pixels, with a bigger one every 20...

Link to comment
Share on other sites

... not sure whether i'm getting your point, but you can resize the window and i'ts showing 5 pixels, with a bigger one every 20...

In the example you have listed. Your lines are $X number of pixels apart. I was saying make $X be an option.

You have big lines every 20 pixels, and the small lines are 5 pixels apart. In your picture above...$X = 5. What if someone wanted to show it ever 2 pixels or something similar?

Thanks,

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

I think hes saying add an option, like some people will leave it at 5 pixels, some might want two pixels, and some people might onle want it every 10 or 20 pixles. Like maby a small input for how many pixels apart the lines are.

EDIT:TYPO

Edited by Vivvic

[quote name='DaleHohm']You have a strange habit of posting error messages that don't match your code.[/quote][quote name='SmOke_N']Forget the learning... straight to the scripting :lol: (laugh.gif)[/quote]

Link to comment
Share on other sites

I think hes saying add an option, like some people will leave it at 5 pixels, some might want two pixels, and some people might onle want it every 10 or 20 pixles. Like maby a small input for how many pixels apart the lines are.

EDIT:TYPO

also - for the grid if you can make it so we can adjust the length of the markers (line) - and one more thought if you can change (or make a radio button) the way the listing are for the numbers, I would like to be able to see the bottom the opposite of the top - say left to right on top is 1 - 600 and on the bottome i would like 600 - 1 - this way you can measure both ways - also the right and left of the ruler - would be the changed in the same way.

I really like this ruler - I might just leave it up all the time

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

also - for the grid if you can make it so we can adjust the length of the markers (line) - and one more thought if you can change (or make a radio button) the way the listing are for the numbers, I would like to be able to see the bottom the opposite of the top - say left to right on top is 1 - 600 and on the bottome i would like 600 - 1 - this way you can measure both ways - also the right and left of the ruler - would be the changed in the same way.

I really like this ruler - I might just leave it up all the time

... getting more complicated every day ... :P

but i'll try

Link to comment
Share on other sites

well, i can do that, but it gets very hard to see anything if the lines are just 1px apart...

Of course it would have to be limited to the smallest being 2 pixels apart. Because if you did it every pixel then it would be a solid line because the lines themselves are 1px wide.

I think hes saying add an option, like some people will leave it at 5 pixels, some might want two pixels, and some people might onle want it every 10 or 20 pixles. Like maby a small input for how many pixels apart the lines are.

EDIT:TYPO

That is exactly what I am talking about, and I think he understands that now.

Thanks,

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

Just a thought, you could make a slider to decide how far (like 2 pixels - 200 pixels) the lines are from each other.

EDIT:After thinking about it, it would make it difficult to get what you want, could have a 'combobox?' (not sure on the name of it) with like 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 16, 18, 20, 25, 50, 100, 200 (just example of how it would need to be scaled 'in my opinion' ) that way.

What Im thinking of 'combobox' is this

__

|6|^

|_|V

a box with a number in it that you can change with up and down arrows, dont think its called a combo box. :P

Edited by Vivvic

[quote name='DaleHohm']You have a strange habit of posting error messages that don't match your code.[/quote][quote name='SmOke_N']Forget the learning... straight to the scripting :lol: (laugh.gif)[/quote]

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...