GaryFrost Posted April 22, 2006 Share Posted April 22, 2006 (edited) Function call format:_GuiCtrlCreateButton($s_text, $x, $y, $width, $height[, $text_color = -1[, $back_color = -1[, $text_color_disabled = -1[, $back_color_disabled = -1[, $b_RGB = True]]]]]) oÝ÷ Ù«¢+Ø)}Õ¥ Ñɱ ÕÑѽ¹MÑQáÑ ½±½È ÀÌØí¹ Ñɱ%°ÀÌØíÑáÑ}½±½Él°ÀÌØíÑáÑ}½±½É}¥Í±ô´Ål°ÀÌØí}IôQÉÕut¤oÝ÷ Ù«¢+Ø)}Õ¥ Ñɱ ÕÑѽ¹MÑ ½±½È ÀÌØí¹ Ñɱ%°ÀÌØí}½±½Él°ÀÌØí}½±½É}¥Í±ô´Ål°ÀÌØí}IôQÉÕut¤(oÝ÷ Ù«¢+Ø)}Õ¥ Ñɱ ÕÑѽ¹ÑQáÐ ÀÌØí¹ Ñɱ%¤(oÝ÷ Ù«¢+Ø)}Õ¥ Ñɱ ÕÑѽ¹MÑQáÐ ÀÌØí¹ Ñɱ%°ÀÌØíÍ}9ÝQáФ(by default the colors passed in will be rgb colorsif you wish to use bgr colors, set the last param to Falsedefault colors use -1see exampleI'm sure there is room for improvement, suggestions/help welcome.Enjoy!!!GaryEdit: Updated the scripts with my latest ones, and added the 12 button test script. Edit: Updated scripts for custom disabled colorsEdit: Added _GuiCtrlButtonSetTextColor and _GuiCtrlButtonSetBkColor functionsEdit: Added _GuiCtrlButtonGetText and _GuiCtrlButtonSetText functionshttp://www.autoitscript.com/fileman/users/gafrost/projects/OwnerDrawnButtons/12_Buttons.au3http://www.autoitscript.com/fileman/users/gafrost/projects/OwnerDrawnButtons/12button.PNGhttp://www.autoitscript.com/fileman/users/gafrost/projects/OwnerDrawnButtons/Test_Button.au3http://www.autoitscript.com/fileman/users/gafrost/projects/OwnerDrawnButtons/buttons.PNGInclude file http://www.autoitscript.com/fileman/users/gafrost/projects/OwnerDrawnButtons/GuiButton.au3 Edited November 5, 2006 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
RazerM Posted April 22, 2006 Share Posted April 22, 2006 this makes it ALOT easier. well done gafrost 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 More sharing options...
slightly_abnormal Posted April 30, 2006 Share Posted April 30, 2006 <-bump->any word if this bug as been fixed? http://www.autoitscript.com/forum/index.ph...ndpost&p=175930 Link to comment Share on other sites More sharing options...
rakudave Posted May 1, 2006 Share Posted May 1, 2006 i made an approach from a different, simpler angle... it is not perfect yet, but it's a start... :-) expandcollapse popup#include <GUIConstants.au3> GUICreate("test",300,100) $a = _GUICtrlCreateColorButton("test1", 5, 5, 50, 20,0xff0000) $b = _GUICtrlCreateColorButton("test2", 65, 5, 50, 20,0x00ff00) $c = _GUICtrlCreateColorButton("test3", 125, 5, 50, 20,0x0000ff,0xffffff) $d = _GUICtrlCreateColorButton("test4", 185, 5, 50, 20,0xffff00) $e = _GUICtrlCreateColorButton("test5", 245, 5, 50, 20,0xffffff) GUICtrlCreateLabel("Colorbuttons - by rakudave, Pangaea WorX",50,50) GUISetState () do $msg = GUIGetMsg() if $msg = $a[0] then msgbox(0,"colorbutton pressed","You pressed cb1") if $msg = $b[0] then msgbox(0,"colorbutton pressed","You pressed cb2") if $msg = $c[0] then msgbox(0,"colorbutton pressed","You pressed cb3") if $msg = $d[0] then msgbox(0,"colorbutton pressed","You pressed cb4") if $msg = $e[0] then msgbox(0,"colorbutton pressed","You pressed cb5") until $msg = $GUI_EVENT_CLOSE ;#include-once ;============================================================================= ; ; Function Name: _GUICtrlCreateColorButton() ; ; Description: Creates a colored Button ; ; Syntax: _GUICtrlCreateColorButton($text, $left, $top, $width, $height,$bkcolor[,$fontcolor]) ; ; Parameter(s); $text = The text of the control ; $left = The left side of the control ; $top = The top of the control ; $width = The width of the control ; $height = The height of the control ; $bkcolor = Backgroundcolor of the control ; $fontcolor = [optional] Fontcolor of the control ; ; Return Value(s): array[1] = used to change colors ; array[0] = notifies GUIGetMsg if user clicks ; ; Author: rakudave <rakudave@gmx.net> ;============================================================================= Func _GUICtrlCreateColorButton($text, $left, $top, $width, $height,$bkcolor,$fontcolor = 0x000000) local $colbut[2] $colbut[0] = GUICtrlCreateLabel("",$left,$top,$width,$height,$SS_BLACKRECT) GUICtrlCreateLabel("",$left,$top,$width -1,$height -1,$SS_WHITERECT) GUICtrlCreateLabel("",$left +1,$top +1,$width -2,$height -2,$SS_GRAYRECT) $colbut[1] = GUICtrlCreateLabel($text,$left +1,$top + 1,$width -3,$height -3,$SS_NOTIFY & $SS_CENTER) GUICtrlSetBkColor(-1,$bkcolor) GUICtrlSetColor(-1,$fontcolor) Return $colbut EndFunc Pangaea Ruler new, UDF: _GUICtrlCreateContainer(), Pangaea Desktops, Pangaea Notepad, SuDoku, UDF: Table Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 1, 2006 Moderators Share Posted May 1, 2006 <-bump->any word if this bug as been fixed? http://www.autoitscript.com/forum/index.ph...ndpost&p=175930@slightly_abnormal - Gary made this thread on the 21st, and Holger made this post: http://www.autoitscript.com/forum/index.ph...ndpost&p=176392 on the 23rd. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
GaryFrost Posted May 1, 2006 Author Share Posted May 1, 2006 i made an approach from a different, simpler angle...it is not perfect yet, but it's a start... :-)Thanks, but we are looking to use true buttons, not labels SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
rakudave Posted May 1, 2006 Share Posted May 1, 2006 i know, it's just a workaround... :-/ Pangaea Ruler new, UDF: _GUICtrlCreateContainer(), Pangaea Desktops, Pangaea Notepad, SuDoku, UDF: Table Link to comment Share on other sites More sharing options...
taurus905 Posted May 1, 2006 Share Posted May 1, 2006 i made an approach from a different, simpler angle...it is not perfect yet, but it's a start... :-)rakudave,This looks like something I can work with. I will give it a closer look next week after I finish moving to my new house.Thanks for taking a different approach as a work around.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 More sharing options...
taurus905 Posted May 2, 2006 Share Posted May 2, 2006 (edited) rakudave sent me this code: expandcollapse popup#include <GUIConstants.au3> GUICreate("test",300,100) $a = _GUICtrlCreateColorButton("test1", 5, 5, 50, 20, 0xff0000) $b = _GUICtrlCreateColorButton("test2", 65, 5, 50, 20, 0x00ff00) $c = _GUICtrlCreateColorButton("test3", 125, 5, 50, 20, 0x0000ff,0xffffff) $d = _GUICtrlCreateColorButton("test4", 185, 5, 50, 20, 0xffff00) $e = _GUICtrlCreateColorButton("test5", 245, 5, 50, 20, 0xffffff) $f = _GUICtrlCreateColorButton("test6", 5, 35, 50, 20,0xffaa00) $g = _GUICtrlCreateColorButton("test7", 65, 35, 50, 20,0xaaff00) $h = _GUICtrlCreateColorButton("test8", 125, 35, 50, 20,0x00aaff,0xffffff) $i = _GUICtrlCreateColorButton("test9", 185, 35, 50, 20,0xffffaa) $j = _GUICtrlCreateColorButton("test10",245, 35, 50, 20,0xdddddd) $k = _GUICtrlCreateColorButton("test11", 5, 65, 50, 20,0xffee00) $l = _GUICtrlCreateColorButton("test12", 65, 65, 50, 20,0xccff00) $m = _GUICtrlCreateColorButton("test13",125, 65, 50, 20,0x00ddff,0xffffff) $n = _GUICtrlCreateColorButton("test14",185, 65, 50, 20,0xffeedd) $o = _GUICtrlCreateColorButton("test15",245, 65, 50, 20,0x000000,0xffffff) GUISetState () do $msg = GUIGetMsg() if $msg = $a[0] then msgbox(0, "colorbutton pressed","You pressed cb1",1) if $msg = $b[0] then msgbox(0, "colorbutton pressed","You pressed cb2",1) if $msg = $c[0] then msgbox(0, "colorbutton pressed","You pressed cb3",1) if $msg = $d[0] then msgbox(0, "colorbutton pressed","You pressed cb4",1) if $msg = $e[0] then msgbox(0, "colorbutton pressed","You pressed cb5",1) if $msg = $f[0] then msgbox(0, "colorbutton pressed","You pressed cb6",1) if $msg = $g[0] then msgbox(0, "colorbutton pressed","You pressed cb7",1) if $msg = $h[0] then msgbox(0, "colorbutton pressed","You pressed cb8",1) if $msg = $i[0] then msgbox(0, "colorbutton pressed","You pressed cb9",1) if $msg = $j[0] then msgbox(0,"colorbutton pressed","You pressed cb10",1) if $msg = $k[0] then msgbox(0,"colorbutton pressed","You pressed cb11",1) if $msg = $l[0] then msgbox(0,"colorbutton pressed","You pressed cb12",1) if $msg = $m[0] then msgbox(0,"colorbutton pressed","You pressed cb13",1) if $msg = $n[0] then msgbox(0,"colorbutton pressed","You pressed cb14",1) if $msg = $o[0] then msgbox(0,"colorbutton pressed","You pressed cb15",1) until $msg = $GUI_EVENT_CLOSE ;#include-once ;============================================================================= ; ; Function Name: _GUICtrlCreateColorButton() ; ; Description: Creates a colored Button ; ; Syntax: _GUICtrlCreateColorButton($text, $left, $top, $width, $height,$bkcolor[,$fontcolor]) ; ; Parameter(s); $text = The text of the control ; $left = The left side of the control ; $top = The top of the control ; $width = The width of the control ; $height = The height of the control ; $bkcolor = Backgroundcolor of the control ; $fontcolor = [optional] Fontcolor of the control ; ; Return Value(s): array[1] = used to change colors ; array[0] = notifies GUIGetMsg if user clicks ; ; Author: rakudave <rakudave@gmx.net> ;============================================================================= Func _GUICtrlCreateColorButton($text, $left, $top, $width, $height,$bkcolor,$fontcolor = 0x000000) local $colbut[2] $colbut[0] = GUICtrlCreateLabel("",$left,$top,$width,$height,$SS_BLACKRECT) GUICtrlCreateLabel("",$left,$top,$width -1,$height -1,$SS_WHITERECT) GUICtrlCreateLabel("",$left +1,$top +1,$width -2,$height -2,$SS_GRAYRECT) $colbut[1] = GUICtrlCreateLabel($text,$left +1,$top + 1,$width -3,$height -3,$SS_NOTIFY & $SS_CENTER) GUICtrlSetBkColor(-1,$bkcolor) GUICtrlSetColor(-1,$fontcolor) Return $colbut EndFunc What I want to do is replace variables ($a, $b, $c . . . $m, $n, $o) with an array, like $Key[16], so I can put it in a loop. But I don't know how to get the GUIGetMsg() to work once I do that. Any help with this is appreciated. taurus905 Edited: Just noticed I posted in the wrong forum. I will learn how to do this right. Edited May 2, 2006 by 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 More sharing options...
ConsultingJoe Posted May 2, 2006 Share Posted May 2, 2006 There has to be a different way, those aren't even buttons, there labels Check out ConsultingJoe.com Link to comment Share on other sites More sharing options...
GaryFrost Posted May 2, 2006 Author Share Posted May 2, 2006 I don't care that they're labels(for now). That code is much easier to work with. Thanks a bunch rakudave.How about starting your own thread on using labels as buttons. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Valuater Posted May 2, 2006 Share Posted May 2, 2006 How about starting your own thread on using labels as buttons.gafrost has put alot of work into this.... they are real buttons..... and i agree!!8) Link to comment Share on other sites More sharing options...
rakudave Posted May 3, 2006 Share Posted May 3, 2006 yes, also my POV. i only intended to provide an interim solution until the problem is solved... so plz stop telling me that i used labels :-/ Pangaea Ruler new, UDF: _GUICtrlCreateContainer(), Pangaea Desktops, Pangaea Notepad, SuDoku, UDF: Table Link to comment Share on other sites More sharing options...
techguy86 Posted May 3, 2006 Share Posted May 3, 2006 Hey, these labels don't sink into the GUI when you click them. No pun intended. Is it possible to make that happen? My Programs:Dissolve (Updated 5-30-06)Credit Card Validator (Not created as of yet)Master Lock Combination Cracker (Updated 7-08-07)Go Site-Seeing:My Website: - Click Here Link to comment Share on other sites More sharing options...
rakudave Posted May 3, 2006 Share Posted May 3, 2006 possible, but a bit complex... should i give it a try? Pangaea Ruler new, UDF: _GUICtrlCreateContainer(), Pangaea Desktops, Pangaea Notepad, SuDoku, UDF: Table Link to comment Share on other sites More sharing options...
GaryFrost Posted May 3, 2006 Author Share Posted May 3, 2006 possible, but a bit complex...should i give it a try?yeah in another thread. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 3, 2006 Moderators Share Posted May 3, 2006 yeah in another thread.Damn Gary, you were hijacked lol Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Valuater Posted May 3, 2006 Share Posted May 3, 2006 Damn Gary, you were hijacked lol Ditto!!! 8) Link to comment Share on other sites More sharing options...
RazerM Posted May 3, 2006 Share Posted May 3, 2006 Ill call the police... 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 More sharing options...
ConsultingJoe Posted May 3, 2006 Share Posted May 3, 2006 Ill call the police...what happend? what did I miss? You were hacked? Check out ConsultingJoe.com Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now