jefhal Posted June 4, 2006 Share Posted June 4, 2006 (edited) I added a color picker to the analog clock project from Scripts and Scraps, but when I try to close the color picker, it will not close. It seems to be due to the fact that it is a gui that is launched from another gui. It is now fixed. To test it you would run the clock program and then right click the clock and choose "Change face color". Edited June 4, 2006 by jefhal ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format Link to comment Share on other sites More sharing options...
Lazycat Posted June 4, 2006 Share Posted June 4, 2006 (edited) You trying to use loop in your function, though script is in onevent mode. Use Opt("GUIOnEventMode", 0) to switch to loop mode. BTW, why not use standard Windows color choose function? This will save bunch of code lines. Edited June 4, 2006 by Lazycat 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...
jefhal Posted June 4, 2006 Author Share Posted June 4, 2006 BTW, why not use standard Windows color choose function? This will save bunch of code lines.What would that look like? ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format Link to comment Share on other sites More sharing options...
cppman Posted June 4, 2006 Share Posted June 4, 2006 (edited) change your colorchooser function to this.. u don't need a GUI or anything.. Func ChangeFaceColor() $dColor = _ChooseColor() GUISetBkColor($dColor) EndFunc i think that should work... Edited June 4, 2006 by CHRIS95219 Miva OS Project Link to comment Share on other sites More sharing options...
Lazycat Posted June 4, 2006 Share Posted June 4, 2006 What would that look like? Try this function: $nColor = 0x00FF00 ; initial color _ChooseColor(0, $nColor) MsgBox (0, "Color", "0x"&Hex($nColor, 6)) Func _ChooseColor($hWnd, ByRef $nColor) $cp = DllStructCreate("dword[16]") $p = DllStructCreate("dword;dword;dword;dword;dword;dword;dword;dword;dword") DllStructSetData($p, 1, DllStructGetSize($p)) DllStructSetData($p, 2, $hWnd) DllStructSetData($p, 4, $nColor) DllStructSetData($p, 5, DllStructGetPtr($cp)) DllStructSetData($p, 6, 2 + 1) $ret = DllCall("comdlg32.dll", "long", "ChooseColorA", "ptr", DllStructGetPtr($p)) If IsArray($ret) and $ret[0] <> 0 Then $nColor = DllStructGetData($p, 4) EndFunc $hWnd - handle of parent GUI, $nColor - variable with color. Function take color from this var as default and change it if user choose OK. 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...
jefhal Posted June 4, 2006 Author Share Posted June 4, 2006 (edited) Try this function:Thanks LazyCat and Chris95219- I'll try those ideas out right away. Also, LazyCat, thanks for the tip on GuiEvent mode. It took me a while to get it, but the script works. During my color picker function, I change event mode to "while", and then change it back to "event driven" when I leave my function.This was another perfect case of me trying to do something the hard way when AutoIT already had the function built-in! I have read the manual from top to bottom several times, and I still am surprised by the hidden treasures that others point out to me with AutoIT... Edited June 4, 2006 by jefhal ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format 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