Powder81 Posted April 8, 2005 Share Posted April 8, 2005 Alright, i saw that someone had made a gradient gui script, so i checked it out. I love it, but i have a problem with it. I cant seem to get my buttons to work. As of right now, i only have one button programmed to work, but i cant seem to get it to work. Maybe my positioning is wrong, but im not sure. Anyways, here is the code i have so far, any suggestions would be greatly appreciated. Thank you all for your help you have given me so far, everytime i need help, someone was there for me, and i am constantly learning from you all. expandcollapse popup#include "GUIConstants.au3" #include <Color.au3> $color1 = 0x00ff00 $color2 = 0x000000 $dll = DLLOpen("cwebpage.dll") $hwnd = GUICreate("Draco.v2",800,650,0,0,$WS_SIZEBOX+$WS_SYSMENU+$WS_CAPTION) $pos = WinGetClientSize($hwnd) DLLCall($dll,"long","EmbedBrowserObject","hwnd",$hwnd) GUISetState() DLLCall($dll,"long","DisplayHTMLPage","hwnd",$hwnd,"str","http://www.Runescape.com") GUICreate("Draco-Control",250,652,805,0) _GUICtrlCreateGradient($color1, $color2,0,0,250,217) $1 = GuiCtrlCreateButton("Fight!", 150, 100, 75, 20) GuiCtrlCreateLabel("Click here to start the Draco.v2 AutoFighter", 10, 80, 100, 60) GuiCtrlSetBkColor(-1,0x000000) GuiCtrlSetColor(-1,0x00ff00) _GUICtrlCreateGradient($color2, $color1,0,217,250,217) $2 = GuiCtrlCreateButton("Cut!", 10, 300, 75, 20) GuiCtrlCreateLabel("Click here to start the Draco.v2 AutoLumberjack", 150, 280, 100, 60) GuiCtrlSetBkColor(-1,0x000000) GuiCtrlSetColor(-1,0x00ff00) _GUICtrlCreateGradient($color1, $color2,0,434,250,219) $3 = GuiCtrlCreateButton("Mine!", 150, 500, 75, 20) GuiCtrlCreateLabel("Click here to start the Draco.v2 AutoMiner", 10, 480, 100, 60) GuiCtrlSetBkColor(-1,0x000000) GuiCtrlSetColor(-1,0x00ff00) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $1 MsgBox(0,"Draco.v2","This function is under construction.") EndSelect If $msg = -3 Then ExitLoop $newpos = WinGetClientSize($hwnd) If Not @error And $newpos[0] <> $pos[0] And _ $newpos[1] <> $pos[1] Then $pos = $newpos DLLCall($dll,"none","ResizeBrowser","hwnd",$hwnd,"int",$pos[0],"int",$pos[1]) EndIf WEnd $ret = DLLCall($dll,"long","UnEmbedBrowserObject","hwnd",$hwnd) Func _GUICtrlCreateGradient($nStartColor, $nEndColor, $nX, $nY, $nWidth = 255, $nHeight = 20) Local $color1R = _ColorGetRed($nStartColor) Local $color1G = _ColorGetGreen($nStartColor) Local $color1B = _ColorGetBlue($nStartColor) Local $nStepR = (_ColorGetRed($nEndColor) - $color1R) / $nWidth Local $nStepG = (_ColorGetGreen($nEndColor) - $color1G) / $nWidth Local $nStepB = (_ColorGetBlue($nEndColor) - $color1B) / $nWidth For $i = 0 To $nWidth - $nX $sColor = "0x" & StringFormat("%02X%02X%02X", $color1R+$nStepR*$i, $color1G+$nStepG*$i, $color1B+$nStepB*$i) GUICtrlCreateLabel("", $nX + $i, $nY, 1, $nHeight) GUICtrlSetBkColor(-1, $sColor) Next EndFunc Func OnAutoItExit() DLLClose($dll) EndFunc Again, thank you all for your help. [font="Optima"]Every once in a while... we realize the sun does not rise on our command.[/font][font="Optima"]"Man Standing on Toilet is High on Pot" :Qui Con Jin[/font][font="Optima"]"Can't We All Just Get Along?" :The man who said that was shot by his brother shortly afterwards.[/font]Brand new site/forum i just started. As of 04/12/2005 no members.Check it out, join if you want. Link to comment Share on other sites More sharing options...
Insolence Posted April 8, 2005 Share Posted April 8, 2005 It's because you create the gradiant over the buttons. "I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar. Link to comment Share on other sites More sharing options...
Powder81 Posted April 8, 2005 Author Share Posted April 8, 2005 well, could you elaborate... or redo my code so that it is under the buttons? [font="Optima"]Every once in a while... we realize the sun does not rise on our command.[/font][font="Optima"]"Man Standing on Toilet is High on Pot" :Qui Con Jin[/font][font="Optima"]"Can't We All Just Get Along?" :The man who said that was shot by his brother shortly afterwards.[/font]Brand new site/forum i just started. As of 04/12/2005 no members.Check it out, join if you want. Link to comment Share on other sites More sharing options...
Insolence Posted April 8, 2005 Share Posted April 8, 2005 expandcollapse popup#include "GUIConstants.au3" #include <Color.au3> $color1 = 0x00ff00 $color2 = 0x000000 $dll = DLLOpen("cwebpage.dll") $hwnd = GUICreate("Draco.v2",800,650,0,0,$WS_SIZEBOX+$WS_SYSMENU+$WS_CAPTION) $pos = WinGetClientSize($hwnd) DLLCall($dll,"long","EmbedBrowserObject","hwnd",$hwnd) GUISetState() DLLCall($dll,"long","DisplayHTMLPage","hwnd",$hwnd,"str","http://www.Runescape.com") GUICreate("Draco-Control",250,652,805,0) ; Moved _GuiCtrlCreateGradiant under this, and it works $1 = GuiCtrlCreateButton("Fight!", 150, 100, 75, 20) _GUICtrlCreateGradient($color1, $color2,0,0,250,217) GuiCtrlCreateLabel("Click here to start the Draco.v2 AutoFighter", 10, 80, 100, 60) GuiCtrlSetBkColor(-1,0x000000) GuiCtrlSetColor(-1,0x00ff00) _GUICtrlCreateGradient($color2, $color1,0,217,250,217) $2 = GuiCtrlCreateButton("Cut!", 10, 300, 75, 20) GuiCtrlCreateLabel("Click here to start the Draco.v2 AutoLumberjack", 150, 280, 100, 60) GuiCtrlSetBkColor(-1,0x000000) GuiCtrlSetColor(-1,0x00ff00) _GUICtrlCreateGradient($color1, $color2,0,434,250,219) $3 = GuiCtrlCreateButton("Mine!", 150, 500, 75, 20) GuiCtrlCreateLabel("Click here to start the Draco.v2 AutoMiner", 10, 480, 100, 60) GuiCtrlSetBkColor(-1,0x000000) GuiCtrlSetColor(-1,0x00ff00) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $1 MsgBox(0,"Draco.v2","This function is under construction.") EndSelect If $msg = -3 Then ExitLoop $newpos = WinGetClientSize($hwnd) If Not @error And $newpos[0] <> $pos[0] And _ $newpos[1] <> $pos[1] Then $pos = $newpos DLLCall($dll,"none","ResizeBrowser","hwnd",$hwnd,"int",$pos[0],"int",$pos[1]) EndIf WEnd $ret = DLLCall($dll,"long","UnEmbedBrowserObject","hwnd",$hwnd) Func _GUICtrlCreateGradient($nStartColor, $nEndColor, $nX, $nY, $nWidth = 255, $nHeight = 20) Local $color1R = _ColorGetRed($nStartColor) Local $color1G = _ColorGetGreen($nStartColor) Local $color1B = _ColorGetBlue($nStartColor) Local $nStepR = (_ColorGetRed($nEndColor) - $color1R) / $nWidth Local $nStepG = (_ColorGetGreen($nEndColor) - $color1G) / $nWidth Local $nStepB = (_ColorGetBlue($nEndColor) - $color1B) / $nWidth For $i = 0 To $nWidth - $nX $sColor = "0x" & StringFormat("%02X%02X%02X", $color1R+$nStepR*$i, $color1G+$nStepG*$i, $color1B+$nStepB*$i) GUICtrlCreateLabel("", $nX + $i, $nY, 1, $nHeight) GUICtrlSetBkColor(-1, $sColor) Next EndFunc Func OnAutoItExit() DLLClose($dll) EndFunc "I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar. Link to comment Share on other sites More sharing options...
zcoacoaz Posted April 8, 2005 Share Posted April 8, 2005 It's more efficient to use Graphics. [font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font] Link to comment Share on other sites More sharing options...
Powder81 Posted April 8, 2005 Author Share Posted April 8, 2005 It's more efficient to use Graphics.<{POST_SNAPBACK}>i agree, its just that i like the gradient look, and thought i would try to implement it into my program.Also....Once i move the gradient as you suggested Insolence, it seems the buttons do not show up until the mouse is moved over where they are supposed to be.Does this happen for you? [font="Optima"]Every once in a while... we realize the sun does not rise on our command.[/font][font="Optima"]"Man Standing on Toilet is High on Pot" :Qui Con Jin[/font][font="Optima"]"Can't We All Just Get Along?" :The man who said that was shot by his brother shortly afterwards.[/font]Brand new site/forum i just started. As of 04/12/2005 no members.Check it out, join if you want. Link to comment Share on other sites More sharing options...
zcoacoaz Posted April 8, 2005 Share Posted April 8, 2005 (edited) No, i mean Graphic controls not images edit: as in GuiCtrlCreateGraphic edit2: your a newbie so you probably dont have it... All you need to do is disable the pic control and everything shall be fine Edited April 8, 2005 by Xenogis [font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font] Link to comment Share on other sites More sharing options...
Powder81 Posted April 8, 2005 Author Share Posted April 8, 2005 ok, this is for the admins.... you can close and delete this topic now. thank you all for your help. [font="Optima"]Every once in a while... we realize the sun does not rise on our command.[/font][font="Optima"]"Man Standing on Toilet is High on Pot" :Qui Con Jin[/font][font="Optima"]"Can't We All Just Get Along?" :The man who said that was shot by his brother shortly afterwards.[/font]Brand new site/forum i just started. As of 04/12/2005 no members.Check it out, join if you want. Link to comment Share on other sites More sharing options...
Lazycat Posted April 8, 2005 Share Posted April 8, 2005 Or, if for some reason you prefer not use beta-version, just add one line: expandcollapse popup#include "GUIConstants.au3" #include <Color.au3> $color1 = 0x00ff00 $color2 = 0x000000 $dll = DLLOpen("cwebpage.dll") $hwnd = GUICreate("Draco.v2",800,650,0,0,$WS_SIZEBOX+$WS_SYSMENU+$WS_CAPTION) $pos = WinGetClientSize($hwnd) DLLCall($dll,"long","EmbedBrowserObject","hwnd",$hwnd) GUISetState() DLLCall($dll,"long","DisplayHTMLPage","hwnd",$hwnd,"str","http://www.Runescape.com") GUICreate("Draco-Control",250,652,805,0) _GUICtrlCreateGradient($color1, $color2,0,0,250,217) $1 = GuiCtrlCreateButton("Fight!", 150, 100, 75, 20) GuiCtrlCreateLabel("Click here to start the Draco.v2 AutoFighter", 10, 80, 100, 60) GuiCtrlSetBkColor(-1,0x000000) GuiCtrlSetColor(-1,0x00ff00) _GUICtrlCreateGradient($color2, $color1,0,217,250,217) $2 = GuiCtrlCreateButton("Cut!", 10, 300, 75, 20) GuiCtrlCreateLabel("Click here to start the Draco.v2 AutoLumberjack", 150, 280, 100, 60) GuiCtrlSetBkColor(-1,0x000000) GuiCtrlSetColor(-1,0x00ff00) _GUICtrlCreateGradient($color1, $color2,0,434,250,219) $3 = GuiCtrlCreateButton("Mine!", 150, 500, 75, 20) GuiCtrlCreateLabel("Click here to start the Draco.v2 AutoMiner", 10, 480, 100, 60) GuiCtrlSetBkColor(-1,0x000000) GuiCtrlSetColor(-1,0x00ff00) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $1 MsgBox(0,"Draco.v2","This function is under construction.") EndSelect If $msg = -3 Then ExitLoop $newpos = WinGetClientSize($hwnd) If Not @error And $newpos[0] <> $pos[0] And _ $newpos[1] <> $pos[1] Then $pos = $newpos DLLCall($dll,"none","ResizeBrowser","hwnd",$hwnd,"int",$pos[0],"int",$pos[1]) EndIf WEnd $ret = DLLCall($dll,"long","UnEmbedBrowserObject","hwnd",$hwnd) Func _GUICtrlCreateGradient($nStartColor, $nEndColor, $nX, $nY, $nWidth = 255, $nHeight = 20) Local $color1R = _ColorGetRed($nStartColor) Local $color1G = _ColorGetGreen($nStartColor) Local $color1B = _ColorGetBlue($nStartColor) Local $nStepR = (_ColorGetRed($nEndColor) - $color1R) / $nWidth Local $nStepG = (_ColorGetGreen($nEndColor) - $color1G) / $nWidth Local $nStepB = (_ColorGetBlue($nEndColor) - $color1B) / $nWidth For $i = 0 To $nWidth - $nX $sColor = "0x" & StringFormat("%02X%02X%02X", $color1R+$nStepR*$i, $color1G+$nStepG*$i, $color1B+$nStepB*$i) GUICtrlCreateLabel("", $nX + $i, $nY, 1, $nHeight) GUICtrlSetBkColor(-1, $sColor) GUICtrlSetState(-1, $GUI_DISABLE); Disable each label Next EndFunc Func OnAutoItExit() DLLClose($dll) EndFunc Koda homepage ([s]Outdated Koda homepage[/s]) (Bug Tracker)My Autoit script page ([s]Outdated mirror[/s]) Link to comment Share on other sites More sharing options...
Powder81 Posted April 8, 2005 Author Share Posted April 8, 2005 Thanks alot Lazycat, that really helped me out. I really appreciate it. [font="Optima"]Every once in a while... we realize the sun does not rise on our command.[/font][font="Optima"]"Man Standing on Toilet is High on Pot" :Qui Con Jin[/font][font="Optima"]"Can't We All Just Get Along?" :The man who said that was shot by his brother shortly afterwards.[/font]Brand new site/forum i just started. As of 04/12/2005 no members.Check it out, join if you want. Link to comment Share on other sites More sharing options...
GaryFrost Posted April 8, 2005 Share Posted April 8, 2005 here's a twist to the gradient using the current release version. expandcollapse popup#include "GUIConstants.au3" #include <Color.au3> If Not IsDeclared('Purple') Then Dim $Purple = 0x800080 If Not IsDeclared('Misty_Rose') Then Dim $Misty_Rose = 0xffe4e1 If Not IsDeclared('Green') Then Dim $Green = 0x00FF00 If Not IsDeclared('Dark_Green') Then Dim $Dark_Green = 0x006400 GUICreate("Gradient",500,500) _GUICreateGradient($Misty_Rose, $Purple,0,0,100,100,"TB") _GUICreateGradient($Green, $Dark_Green,100,0,100,100,"TB") _GUICreateGradient($Purple, $Misty_Rose,100,100,100,100,"TB") _GUICreateGradient($Dark_Green, $Green,0,100,100,100,"TB") _GUICreateGradient($Misty_Rose, $Purple,200,0,100,100,"TB") _GUICreateGradient($Green, $Dark_Green,300,0,100,100,"TB") _GUICreateGradient($Dark_Green, $Green,200,100,100,100,"TB") _GUICreateGradient($Misty_Rose, $Purple,300,100,100,100,"TB") _GUICreateGradient($Misty_Rose, $Purple,400,0,100,100,"TB") _GUICreateGradient($Green, $Dark_Green,400,100,100,100,"TB") _GUICreateGradient($Misty_Rose, $Purple,0,200,500,150,"TB") _GUICreateGradient($Purple, $Misty_Rose,0,350,500,150,"TB") GUISetState() Do $msg = GUIGetMsg() Until $msg = $GUI_EVENT_CLOSE Func _GUICreateGradient($nStartColor, $nEndColor, $nX, $nY, $nWidth, $nHeight,$s_direction="LR") Local $color1R = _ColorGetRed($nStartColor) Local $color1G = _ColorGetGreen($nStartColor) Local $color1B = _ColorGetBlue($nStartColor) If(StringInStr($s_direction,"LR") > 0) Then Local $nStepR = (_ColorGetRed($nEndColor) - $color1R) / $nWidth Local $nStepG = (_ColorGetGreen($nEndColor) - $color1G) / $nWidth Local $nStepB = (_ColorGetBlue($nEndColor) - $color1B) / $nWidth For $i = 0 To $nWidth - $nX $sColor = "0x" & StringFormat("%02X%02X%02X", $color1R+$nStepR*$i, $color1G+$nStepG*$i, $color1B+$nStepB*$i) GUICtrlCreateLabel("", $nX + $i, $nY, 1, $nHeight) GUICtrlSetBkColor(-1, $sColor) GUICtrlSetState(-1, $GUI_DISABLE); Disable each label Next ElseIf(StringInStr($s_direction,"TB") > 0) Then Local $nStepR = (_ColorGetRed($nEndColor) - $color1R) / $nHeight Local $nStepG = (_ColorGetGreen($nEndColor) - $color1G) / $nHeight Local $nStepB = (_ColorGetBlue($nEndColor) - $color1B) / $nHeight For $i = 0 To $nHeight $sColor = "0x" & StringFormat("%02X%02X%02X", $color1R+$nStepR*$i, $color1G+$nStepG*$i, $color1B+$nStepB*$i) GUICtrlCreateLabel("", $nX, $nY + $i,$nWidth, 1) GUICtrlSetBkColor(-1, $sColor) GUICtrlSetState(-1, $GUI_DISABLE); Disable each label Next EndIf EndFunc 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...
Powder81 Posted April 8, 2005 Author Share Posted April 8, 2005 thank you very much gafrost, that is helpfull as well, and i like how you did that aswell. [font="Optima"]Every once in a while... we realize the sun does not rise on our command.[/font][font="Optima"]"Man Standing on Toilet is High on Pot" :Qui Con Jin[/font][font="Optima"]"Can't We All Just Get Along?" :The man who said that was shot by his brother shortly afterwards.[/font]Brand new site/forum i just started. As of 04/12/2005 no members.Check it out, join if you want. 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