- didn't load the already saved custom colors but on exit all were reset in the ini
- no Hand cursor on color pickers (user needs a visual cue of the possible operation)
- in settings when drag mode enabled, preview window hides when attempting to drag it
- in settings when drag mode enabled, A/B position selectors should be disabled
- selection checkboxes are not as intuitive as a dropdown list, for the 3 different display modes (and new modes could easily be added or deleted)
- no Move cursor on drag (user needs a visual cue of the possible operation)
Otherwise it seems to be alright for a very quick test. My (so called) dead keys appear correctly, drag works, mouse functions are correct.
Now I'll go look at the code. In the mean time, could you please test the following script, see if you get a change in tooltips after more than one color change? Tooltips should match the corresponding text but for some reason from second color change on the tooltip won't change anymore. That's another one of AHK's quirks that wasted my time. Or maybe it's the OS - dunno.
Code: Select all
#NoEnv
#SingleInstance Force
#KeyHistory 0
ListLines Off
SetBatchLines, -1
SetKeyDelay, -1, -1
SetMouseDelay, -1
SetWinDelay, -1
SetControlDelay, -1
SendMode Input
SetWorkingDir %A_ScriptDir%
CoordMode, Mouse, Screen
DetectHiddenWindows, On
; +LV0x24400 -0x8
cclvo := "-E0x200 +0x2000 +LV0x10400 +Border -Hdr -Multi +ReadOnly Report AltSubmit gsetColors"
cpW := 40, cpH := 24
global LV9:=0xFF55CC, LV10
h1 := DllCall("ImageList_Create"
, "Int", cpW
, "Int", cpH
, "UInt", 33
, "Int", 1
, "Int", 1
, "Ptr")
Gui, Add, ListView, %cclvo% Background%LV1% vLV1 w%cpW% h%cpH% x50, 0
Gui, Add, ListView, %cclvo% Background%LV2% vLV2 w%cpW% h%cpH% xp y+5, 0
Gui, Add, ListView, %cclvo% Background%LV3% vLV3 w%cpW% h%cpH% xp y+5, 0
Gui, Add, ListView, %cclvo% Background%LV4% vLV4 w%cpW% h%cpH% xp y+5, 0
Gui, Add, ListView, %cclvo% Background%LV5% vLV5 w%cpW% h%cpH% xp y+5, 0
Gui, Add, ListView, %cclvo% Background%LV6% vLV6 w%cpW% h%cpH% xp y+5, 0
Gui, Add, ListView, %cclvo% Background%LV7% vLV7 w%cpW% h%cpH% xp y+5, 0
Gui, Add, ListView, %cclvo% Background%LV8% vLV8 w%cpW% h%cpH% xp y+5, 0
h2:= AddColorPicker(1, "LV9", "xp-40 y+5 w80 h24", "This is another color")
h3:= AddColorPicker(1, "LV10", "xp y+5 wp hp", "This is tenth color, dammit!")
Loop, 8
{
Gui, ListView, LV%A_Index%
LV_SetImageList(h1, 1)
LV_Add("Icon1", "Click to select color for LV" A_Index)
}
Loop, 10
{
Gui, ListView, SysListView32%A_Index%
LV_GetText(lt, 1), y := 29*(A_Index-1)
Gui, Add, Text, x100 ym+%y% w300 h24 +0x200 vtxLV%A_Index%, %lt%
}
Gui, Show, AutoSize, Test
OnExit, cleanup
return
cleanup:
IL_Destroy(h1)
IL_Destroy(h2)
IL_Destroy(h3)
ExitApp
;================================================================
AddColorPicker(gui, var, size, tip:="")
{
Global
Static c, hW, L, ctrl, clr, hIL
StringSplit, c, size, %A_Space%, %A_Space%
;Static cclvo := "-E0x200 +LV0x24400 +0x2000 -0x8 +Border -Hdr -Multi +ReadOnly Report AltSubmit gsetColors"
Static cclvo := "-E0x200 +0x2000 +LV0x10400 +Border -Hdr -Multi +ReadOnly Report AltSubmit gsetColors"
if InStr(c3, "p") OR InStr(c4, "p")
{
DetectHiddenWindows, On
Gui, %gui%: +LastFound +hwndhW
WinGet, L, ControlList, ahk_id %hW%
Loop, Parse, L, `n, `r
ctrl := A_LoopField
if !ctrl
{
Gui, %gui%:Add, Text, x%c1% y%c2%, [Error]
return False
}
GuiControlGet, pos, %gui%:Pos, %ctrl%
StringReplace, w, c3, wp, %posW%,
StringReplace, h, c4, hp, %posH%,
}
else
{
StringReplace, w, c3, w,,
StringReplace, h, c4, h,,
}
hIL := DllCall("ImageList_Create"
, "Int", w
, "Int", h
, "UInt", 33
, "Int", 1
, "Int", 1
, "Ptr")
clr := %var% ? %var% : %var% := 0
Gui, %gui%:Add, ListView, %cclvo% Background%clr% v%var% %c1% %c2% %c3% %c4% hwndh%var%, 0
LV_SetImageList(hIL, 1)
LV_Add("Icon1", (tip ? tip : "Click to select color for " var))
return hIL
}
;================================================================
setColors(hC, event, c, err:=0)
{
Global
Static g, ctrl, lv, r, t, u
if (event != "Normal")
return
g:= A_Gui, ctrl := A_GuiControl, lv := A_DefaultListView, res := Dlg_Color(%ctrl%, hC)
if ErrorLevel
return
res := %ctrl% := hexRGB(res)
GuiControl, %g%:+Background%res%, %ctrl%
Gui, %g%:ListView, %ctrl%
LV_GetText(t, 1)
t := ((s := InStr(t, " (")) ? (u := SubStr(t, 1, s+1)) : t " (") "Current color is " res ")"
LV_Modify(0, "Col1", t)
GuiControl, %g%:+C%res%, %ctrl%
LV_GetText(t, 1)
GuiControl, %g%:, tx%ctrl%, %t%
Gui, %g%:ListView, %lv%
}
;================================================================
hexRGB(c) {
setformat, IntegerFast, H
r := ((c&255)<<16)+(c&65280)+((c&0xFF0000)>>16),c:=SubStr(r,1)
SetFormat, IntegerFast, D
return c
}
;================================================================
Dlg_Color(Color,hwnd) {
static
if !cc {
VarSetCapacity(CUSTOM,64,0),cc:=1,size:=VarSetCapacity(CHOOSECOLOR,9*A_PtrSize,0)
Loop, 16
NumPut(0x00FFFFFF,CUSTOM,(A_Index-1)*4,"UInt")
}
Color := hexRGB(InStr(Color, "0x") ? Color : Color ? "0x" Color : 0x0)
NumPut(size,CHOOSECOLOR,0,"UInt"),NumPut(hwnd,CHOOSECOLOR,A_PtrSize,"UPtr")
,NumPut(Color,CHOOSECOLOR,3*A_PtrSize,"UInt"),NumPut(0x103,CHOOSECOLOR,5*A_PtrSize,"UInt")
,NumPut(&CUSTOM,CHOOSECOLOR,4*A_PtrSize,"UPtr")
if !ret := DllCall("comdlg32\ChooseColor","UPtr",&CHOOSECOLOR,"UInt")
exit
setformat, IntegerFast, H
Color := NumGet(CHOOSECOLOR,3*A_PtrSize,"UInt")
SetFormat, IntegerFast, D
return Color
}