Marcelos Posted October 21, 2013 Posted October 21, 2013 Hi 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" ;~ GUIRegisterMsg($CP_WM_ACTIVATE, 'CP_WM_ACTIVATE') ;~ GUIRegisterMsg($CP_WM_COMMAND, 'CP_WM_COMMAND') ;~ GUIRegisterMsg($CP_WM_MOUSEWHEEL, 'CP_WM_MOUSEWHEEL') ;~ GUIRegisterMsg($CP_WM_SETCURSOR, 'CP_WM_SETCURSOR') 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 EndIf 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 EndIf EndIf ExitLoop EndIf Next Switch $wParam ;----------------My Code ------------------------------- Case $buttonApply ....... Case $PickerMessageBackground ...... Case $PickerTopBackground .... ;-------------- end my code ------------------ EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>CP_WM_COMMAND 3- in my form i registered the 4 functions commented in "colorPicker.au3" ; --------- here is my form and controls .... ;-------------------- GUISetState(@SW_SHOW) UIRegisterMsg($CP_WM_ACTIVATE, 'CP_WM_ACTIVATE') GUIRegisterMsg($CP_WM_COMMAND, 'CP_WM_COMMAND') GUIRegisterMsg($CP_WM_MOUSEWHEEL, 'CP_WM_MOUSEWHEEL') GUIRegisterMsg($CP_WM_SETCURSOR, 'CP_WM_SETCURSOR') While 1 If $fFlag = True Then $fFlag = False GUISetState(@SW_HIDE,$Gui) GUIDelete($Gui) ExitLoop EndIf sleep(5) Wend GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") EndFunc 4- and before exiting the form . i re- registered "wm_command" Thanks for the help Graphical Control - Week Planner
dom3787 Posted October 25, 2013 Posted October 25, 2013 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.
KovaaK Posted October 26, 2013 Posted October 26, 2013 (edited) 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): expandcollapse popup#include "GraphGDIPlus.au3" ; Used for graphing window #Include "ColorPicker.au3" ; Graph options _Main() 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)) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ; OR $msg = $exititem _GUIColorPicker_Delete($Picker) GUIDelete($GraphGUI) ExitLoop EndSelect WEnd EndFunc 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) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $graphoptions _GraphOptionsGui($GUI) Case $msg = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd EndFunc 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 October 26, 2013 by KovaaK
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