Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
(Solved)...Mouse over highlight
#2
Function DT_HiliteControlOnMouseOver
Code:
Copy      Help
;/
function# hDlg message wParam lParam hctrl backcolor textcolor

;Changes control colors when mouse pointer is over.
;The control must be Static or read-only Edit.
;Call this function from dialog function, between ' message' and 'sel message' lines.
;If this function returns a nonzero value, let the dialog function return that value.
;Call this function for each control you want to change colors.


;hDlg message wParam lParam - hDlg message wParam lParam.
;hctrl - control handle.
;backcolor - control color. Use -1 for default color.
;textcolor - control text color. Use -1 for default color.


;See also: <ColorFromRGB>

;EXAMPLE
;;...
;;messages
;int z=DT_HiliteControlOnMouseOver(hDlg message wParam lParam id(3 hDlg) 0xff0000 0x00ffff)
;if(z) ret z
;sel message
;,;...


int brush=GetProp(hDlg "qm_hcoobrush")
sel message
,case WM_SETCURSOR
,if(!brush and child(mouse)=hctrl)
,,;out "1 %i" hctrl
,,if(backcolor=-1) backcolor=GetSysColor(COLOR_BTNFACE)
,,SetProp(hDlg "qm_hcoobrush" CreateSolidBrush(backcolor))
,,SetProp(hDlg "qm_hcoohwnd" hctrl)
,,RedrawWindow hctrl 0 0 RDW_INVALIDATE
,,SetTimer hDlg 33345 50 0
,case WM_TIMER
,if(wParam=33345 and hctrl=GetProp(hDlg "qm_hcoohwnd") and child(mouse)!=hctrl)
,,;out "2 %i" hctrl
,,KillTimer hDlg wParam
,,RemoveProp(hDlg "qm_hcoobrush")
,,RemoveProp(hDlg "qm_hcoohwnd")
,,DeleteObject brush
,,RedrawWindow hctrl 0 0 RDW_INVALIDATE
,case WM_CTLCOLORSTATIC
,if(brush and lParam=hctrl)
,,SetBkMode wParam TRANSPARENT
,,if(textcolor!=-1) SetTextColor wParam textcolor
,,ret brush

Example dialog
Function testDlg
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 223 135 "Dialog"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;3 Static 0x54030100 0x4 16 84 48 13 "&ClickHere"
;4 Edit 0x54230844 0x20000 0 94 96 48 "dddd"
;END DIALOG
;DIALOG EDITOR: "" 0x2020100 "" ""

if(!ShowDialog("testDlg" &testDlg)) ret
ret
;messages
int z=DT_HiliteControlOnMouseOver(hDlg message wParam lParam id(3 hDlg) 0xff0000 0x00ffff)
if(z) ret z
z=DT_HiliteControlOnMouseOver(hDlg message wParam lParam id(4 hDlg) 0xff0000 0x00ffff)
if(z) ret z
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case STN_CLICKED<<16|3
,out 1
,case IDOK
,case IDCANCEL
ret 1


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)