Jump to content

Recommended Posts


thanks for the fast response,

i tryed some codes , trying to implement the sugested solution .

at the ent i came up with this solution.

1- i commented the registration from the "colorPicker.au3"


2- i added to "Func CP_WM_COMMAND"  the case options to handle the controls in my form  (see "my code" )

Func CP_WM_COMMAND($hWnd, $iMsg, $wParam, $lParam)

    ; Handler from ColorChooser.au3
    If (IsDeclared('__CC_WM0111')) And (Not Eval('__CC_WM0111')) Then
        $__CP_WM0111 = 1
        Call('CC' & '_WM_COMMAND', $hWnd, $iMsg, $wParam, $lParam)
        $__CP_WM0111 = 0

    For $i = 1 To $cpId[0][0]
        If $cpId[$i][1] = $lParam Then
            If Number($wParam) > 0 Then
                If Not CP_PickerDlg($i) Then
                    Return 0

    Switch $wParam
;----------------My Code -------------------------------
    Case $buttonApply
    Case $PickerMessageBackground
    Case $PickerTopBackground

;-------------- end my code ------------------

EndFunc   ;==>CP_WM_COMMAND

3- in my form  i registered the 4 functions commented in  "colorPicker.au3"

; ---------   here is my form and controls



    While 1
              If $fFlag = True  Then
            $fFlag = False


4- and before exiting the form . i re- registered "wm_command"


Thanks for the help

Link to post
Share on other sites
  • Replies 42
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

LAST VERSION - 1.5 07-Dec-10 Creates a button to quickly select a color from the specified palette. It is possible to change the appearance, at its discretion, determine their own palette, call a sta

robertcollier4, If all you want is the Windows dialog, then use the standard _ChooseColor UDF - look in the Help file for more details and an example. M23

Marcelos, When you register a message handler, you overwrite any previous registration. So if you register a handler for any of the messages used within this UDF AFTER the UDF has registered the mess

Posted Images

Awesome work, thanks Yashied, you saved me a lot of time.

I'd like to disable that "fade in" effect when you choose a color though, it looks weird in my GUI since the color of the object is switching instantly, but then the ColorPicker is fading to the new color slowly so yeah... it doesn't look right, better if it was instant switch, I'm still searching what to modify to get that.

Link to post
Share on other sites

I'm having some weirdness happen when I try to combine this ColorPicker with >andybiochem's GraphGDIPlus UDF.  I originally took Example #3 from the base post as a start then cut it down to Example #1, and both work fine until I add in a graph from the above mentioned UDF in the same program.

I took my fairly large program and snipped it down to a smaller version that exhibits the same issue.  Here's some sample code (requires GraphGDIPlus.au3 and ColorPicker.au3):

#include "GraphGDIPlus.au3" ; Used for graphing window
#Include "ColorPicker.au3" ; Graph options


Func _GraphOptionsGui($GUI) ; Draw and handle the Graph options GUI
   Local $tempPos = WinGetPos("Test")
   $GraphGUI = GUICreate("Graph Settings", 250, 100, $tempPos[0]+50, $tempPos[1]+50, -1, -1, $GUI)

   GUICtrlCreateLabel("Color", 10, 10)
   $Picker = _GUIColorPicker_Create('Picker', 10, 25, 60, 23, 0xFF6600, BitOR($CP_FLAG_DEFAULT, $CP_FLAG_TIP))
   While 1
      $msg = GUIGetMsg()
         Case $msg = $GUI_EVENT_CLOSE ; OR $msg = $exititem

Func _Main()
   $GUI = GUICreate("Test",350,360)
   $settingsmenu = GUICtrlCreateMenu("&Settings")
   $graphoptions = GUICtrlCreateMenuItem("Change &Graph settings", $settingsmenu)

   ; Comment out the following line to see the bug go away
   $Graph = _GraphGDIPlus_Create($GUI,10,10,330,320,0xFF000000,0xFF88B3DD)


   While 1
      $msg = GUIGetMsg()
         Case $msg = $graphoptions
         Case $msg = $GUI_EVENT_CLOSE

Basically, the problem is that when you go to the Graph Settings menu and double click on the "Picker" button.  When you double click it seems to create an extra copy of the color picker menu with the 5 x 8 grid of colors, and the second copy becomes non-interactive while on top of everything.  Clicking Picker button once and then picking a color works fine - it's just if a stray second click lands on the button that it messes up.

The weird part is that if you comment out line #31, the bug goes away.  All that line does is draw the graph on the main part of the GUI, which should be unrelated to the color picker.

Any ideas as to why this combination of UDFs would be having this issue?  Many thanks in advance!

Edit: Removed colorchooser and switched to example #1 since I can isolate the problem down to just colorpicker now.

It seems that Func CP_PickerDlg($ID) in ColorPicker.au3 is having trouble triggering the following lines correctly when the graph exists:

Switch $Msg
            Case $GUI_EVENT_CLOSE, $cpId[0][3]
Edited by KovaaK
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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...