Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Couple button questions. Enlarge control on mouse over.
#5
Use this instead.

example
Function dlg_change_button_size2
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

if(!ShowDialog("dlg_change_button_size2" &dlg_change_button_size2)) ret

;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 223 135 "Dialog"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;3 Button 0x54032000 0x0 16 30 16 14 "A"
;4 Button 0x54032000 0x0 32 30 16 14 "B"
;5 Button 0x54032000 0x0 48 30 16 14 "C"
;6 Static 0x54000000 0x0 16 14 98 12 "move mouse on a button"
;END DIALOG
;DIALOG EDITOR: "" 0x2030300 "" "" ""

ret
;messages
sel message
,case WM_INITDIALOG
,DT_ChangeMouseControlSize id(3 hDlg) 5
,DT_ChangeMouseControlSize id(4 hDlg) 5
,DT_ChangeMouseControlSize id(5 hDlg) 15
,
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1

You'll need these 2 functions. You can use them with any dialog.
Function DT_ChangeMouseControlSize
Code:
Copy      Help
;/
function hwndControl sizePlus

;Sets a control to make bigger on mouse over.
;Call this function in dialog procedure, under WM_INITDIALOG.

;hwndControl - control handle.
;sizePlus - how much bigger.


type CMCS_DATA wndProc sizePlus !big RECT'r
CMCS_DATA* p._new
p.wndProc=SubclassWindow(hwndControl &CMCS_WndProc)
p.sizePlus=sizePlus
SetProp hwndControl "CMCS_DATA" p

Function CMCS_WndProc
Code:
Copy      Help
;/
function# hWnd message wParam lParam

CMCS_DATA* p=+GetProp(hWnd "CMCS_DATA")
if(!p) ret
int wndProc=p.wndProc

sel message
,case WM_NCDESTROY
,p._delete
,RemoveProp(hWnd "CMCS_DATA")
,
,case WM_MOUSEMOVE
,if !p.big
,,p.big=1
,,GetWindowRect hWnd &p.r; MapWindowPoints 0 GetParent(hWnd) +&p.r 2 ;;save old rect
,,RECT r=p.r; InflateRect &r p.sizePlus p.sizePlus; MoveWindow hWnd r.left r.top r.right-r.left r.bottom-r.top 1 ;;make bigger
,,TRACKMOUSEEVENT t.cbSize=16; t.dwFlags=TME_LEAVE; t.hwndTrack=hWnd; TrackMouseEvent &t ;;set to notify when mouse leaves
,
,case WM_MOUSELEAVE
,if p.big
,,p.big=0
,,MoveWindow hWnd p.r.left p.r.top p.r.right-p.r.left p.r.bottom-p.r.top 1

ret CallWindowProc(wndProc hWnd message wParam lParam)


Messages In This Thread

Forum Jump:


Users browsing this thread: 6 Guest(s)