Sign in to follow this  
Followers 0
layer

Huston, we've got a problem...

6 posts in this topic

if you have checked in the scripts and scraps section, you will see im making a PixelShop program... and im doing some testing, but i came across that my loop, is not polling to see if mouse1 was pressed... maybe you could please check it out and see what the problem is? thanks a millioN!! :huh:

#include <GUIConstants.au3>
#include <Color.au3>
Func GUICtrlCreateGradient($nStartColor, $nEndColor, $nX, $nY, $nWidth = 255, $nHeight = 20); this function from Lazycat, all credit goes to him!! :)
   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, $nY + $nHeight)
      GUICtrlSetBkColor(-1, $sColor)
   Next
EndFunc  ;==>GUICtrlCreateGradient
Func ChooseGradientDialog($GradTitle)
   GUICreate($GradTitle, 300, 500)
   GUICtrlCreateGradient(0x0000FF, 0xFF0000, 10, 5, 255, 50)
   GUICtrlCreateGradient(0x000000, 0xFFFFFF, 10, 50, 255)
   GUICtrlCreateGradient(0x00FF00, 0xFFFF00, 10, 105, 255, 10)
   GUICtrlCreateGradient(0x0000FF, 0x00FF48, 10, 160)
   GUICtrlCreateLabel("", 10, 220, 255, 120)
   GUICtrlCreateLabel("Current color: ", 10, 400)
   $curcol = GUICtrlCreateLabel("", 100, 400, 50, 50)
   $Ok = GUICtrlCreateButton("Ok", 10, 475)
   $Cancel = GUICtrlCreateButton("Cancel", 50, 475)
   GUISetState(@SW_SHOW, $GradTitle)
   While 1
      $cur = GUIGetCursorInfo(WinGetHandle($GradTitle))
      $get = GUIGetMsg(1)
      If $get[0] = -3 Then
        ;GUISetState(@SW_HIDE, $GradTitle) testing..
         MsgBox(0, "", "");really in original script no msgbox, just MainLoop()
         Exit
      EndIf
      If $get[0] = $Cancel Then
        ;GUISetState(@SW_HIDE, $GradTitle) testing...
         MsgBox(0, "", "");really in original script no msgbox, just MainLoop()
         Exit
         If $cur[2] = 1 Then Track()
      EndIf
   WEnd
EndFunc  ;==>ChooseGradientDialog

Func Track()
   Do
      $pos = MouseGetPos()
      $col = PixelGetColor($pos[0], $pos[1])
      GUICtrlSetBkColor($curcol, $col)
   Until $cur[2] = 0
EndFunc  ;==>Track
ChooseGradientDialog("Test...")

:)

PS: i know larry has a Dll that has ChooseColorDialog, but personally, i like using my work only on projects, unless, its a real nesecity... :D

thanks :D


FootbaG

Share this post


Link to post
Share on other sites

you know you want to :)...


FootbaG

Share this post


Link to post
Share on other sites

...
      If $get[0] = $Cancel Then
       ;GUISetState(@SW_HIDE, $GradTitle) testing...
         MsgBox(0, "", "");really in original script no msgbox, just MainLoop()
         Exit
         If $cur[2] = 1 Then Track()
      EndIf
...

...

...
      If $get[0] = $Cancel Then
       ;GUISetState(@SW_HIDE, $GradTitle) testing...
         MsgBox(0, "", "");really in original script no msgbox, just MainLoop()
         Exit
      EndIf
      If $cur[2] = 1 Then Track()
...

See? :)

Share this post


Link to post
Share on other sites

omg... i feel like such a noob :"> thanks... :)


FootbaG

Share this post


Link to post
Share on other sites

Don't worry you're in good company :)


~Projects~1. iPod Ejector 1.0 - Tool Used To Eject iPod in Windows - Uses DevEject.exe :P2. SmartFTP Close Popup Tool - Closes reminders from freeware SmartFTP.~Helpful Links For New Users~1. LXP's Learning AutoIT PDF Guide - <<< Go here for a PDF Guide on learning AutoIT from the ground up!<<<2. AutoIt 1-2-3 <<<Want to learn more about AutoIT quickly? Go Here<<<3. How To Install The Beta And Production Versions Of AutoIT / SciteAutoIT

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

here it now works, but gets caught in a loop, i dont know what your trying to do with it so i left it

#include <GUIConstants.au3>
#include <Color.au3>
Func GUICtrlCreateGradient($nStartColor, $nEndColor, $nX, $nY, $nWidth = 255, $nHeight = 20); this function from Lazycat, all credit goes to him!! :)
   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, $nY + $nHeight)
      GUICtrlSetBkColor(-1, $sColor)
   Next
EndFunc;==>GUICtrlCreateGradient
Func ChooseGradientDialog($GradTitle)
   GUICreate($GradTitle, 300, 500)
   GUICtrlCreateGradient(0x0000FF, 0xFF0000, 10, 5, 255, 50)
   GUICtrlCreateGradient(0x000000, 0xFFFFFF, 10, 50, 255)
   GUICtrlCreateGradient(0x00FF00, 0xFFFF00, 10, 105, 255, 10)
   GUICtrlCreateGradient(0x0000FF, 0x00FF48, 10, 160)
   GUICtrlCreateLabel("", 10, 220, 255, 120)
   GUICtrlCreateLabel("Current color: ", 10, 400)
   $curcol = GUICtrlCreateLabel("", 100, 400, 50, 50)
   $Ok = GUICtrlCreateButton("Ok", 10, 475)
   $Cancel = GUICtrlCreateButton("Cancel", 50, 475)
   GUISetState(@SW_SHOW, $GradTitle)
   While 1
      $cur = GUIGetCursorInfo(WinGetHandle($GradTitle))
      $get = GUIGetMsg(1)
      If $get[0] = -3 Then;$GUI_EVENT_CLOSE
      ;GUISetState(@SW_HIDE, $GradTitle) testing..
         MsgBox(0, "", "");really in original script no msgbox, just MainLoop()
         Exit
      EndIf
      If $get[0] = $Cancel Then
      ;GUISetState(@SW_HIDE, $GradTitle) testing...
         MsgBox(0, "", "");really in original script no msgbox, just MainLoop()
         Exit
     EndIf
     If $cur[2] = 1 Then Track($curcol, $cur)
   WEnd
EndFunc;==>ChooseGradientDialog

Func Track(ByRef $curcol, ByRef $cur)
   Do
      $pos = MouseGetPos()
      $col = PixelGetColor($pos[0], $pos[1])
      GUICtrlSetBkColor($curcol, $col)
  Until $cur[2] = 0
EndFunc;==>Track
ChooseGradientDialog("Test...")

edit: i was beat to it, but mine has no not yet declared errors.

Edited by RazerM

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.

Share this post


Link to post
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
Sign in to follow this  
Followers 0