Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Custom control event
#7
Right click and select it  at the same time   Shy

I added some code, but still don't implement the right click function.  Sad
 
Code:
Copy      Help
 
#sub rcmessage
function i
sel i
case 1
_s.getwintext(id(4 hDlg))
mac+ _s
case 2
_s.getwintext(id(4 hDlg))
mac+ _s

Macro Run or open Func
Code:
Copy      Help
out

QMITEM qmac; int imac
ARRAY(str) amac
rep
,imac=qmitem(-imac 2 &qmac 1)
,if(imac=0) break
,if qmac.itype=1
,,amac[]=qmac.name

str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 174 132 "Win Dialog subclass example"
;3 Button 0x54032000 0x0 22 110 132 14 "Click Run | Right Click Open"
;4 ComboBox 0x54230641 0x0 7 22 158 78 ""
;5 Static 0x54000000 0x0 8 8 160 12 "Double-click run function | right click open function"
;END DIALOG
;DIALOG EDITOR: "" 0x2040801 "*" "" "" ""

str controls = "4"
str cb4
cb4=amac
if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc v
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,int hbc=id(3 hDlg)
,int hcbc=child("" "ComboLBox" id(4 hDlg) 0x0 "id=1000") ;;list
,SetWindowSubclass hbc &sub.WndProc_Subclass 1 0
,SetWindowSubclass hcbc &sub.WndProc_Subclass 1 0
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 3 ;;Click Run Function
,_s.getwintext(id(4 hDlg))
,mac _s
,
,case CBN_DBLCLK<<16|4
,_s.getwintext(id(4 hDlg))
,mac _s

ret 1

#sub WndProc_Subclass
function# hwnd message wParam lParam uIdSubclass dwRefData

;This function can be used with SetWindowSubclass as window procedure.
;<help>SetWindowSubclass</help> is the recommended way to subclass windows. Easier and safer than SetWindowLong. Example: SetWindowSubclass(hwnd &sub.WndProc_Subclass 1 0)

;OutWinMsg message wParam lParam _s _i ;;uncomment to see received messages
sel message
,case WM_RBUTTONUP
,Acc a.FromMouse
,int mi=iif((a.elem<>0) 2 1)
,mac "sub.rcmessage" "" mi
int R=DefSubclassProc(hwnd message wParam lParam)

sel message
,case WM_NCDESTROY
,RemoveWindowSubclass(hwnd &sub.WndProc_Subclass uIdSubclass) ;;replace ThisFunction with the name of this function or subfunction (eg sub.WndProc_Subclass)
,;case ...

ret R

#sub rcmessage
function i
sel i
,case 1
,;_s.getwintext(id(4 hDlg))
,mac+ _s
,
,case 2
,;_s.getwintext(id(4 hDlg))
,mac+ _s


Messages In This Thread
Custom control event - by win - 04-22-2019, 12:00 PM
RE: Custom control event - by Kevin - 04-22-2019, 01:58 PM
RE: Custom control event - by win - 04-22-2019, 02:09 PM
RE: Custom control event - by Kevin - 04-23-2019, 03:17 AM
RE: Custom control event - by win - 04-23-2019, 03:51 AM
RE: Custom control event - by Kevin - 04-23-2019, 03:57 AM
RE: Custom control event - by win - 04-23-2019, 04:22 AM
RE: Custom control event - by Kevin - 04-23-2019, 06:42 AM
RE: Custom control event - by win - 04-23-2019, 07:16 AM
RE: Custom control event - by Kevin - 04-23-2019, 01:45 PM
RE: Custom control event - by win - 04-23-2019, 02:02 PM
RE: Custom control event - by Kevin - 04-23-2019, 02:09 PM
RE: Custom control event - by win - 04-23-2019, 02:11 PM
RE: Custom control event - by Kevin - 04-23-2019, 02:12 PM
RE: Custom control event - by win - 04-23-2019, 02:13 PM
RE: Custom control event - by Kevin - 04-23-2019, 02:16 PM
RE: Custom control event - by win - 04-23-2019, 02:18 PM
RE: Custom control event - by Kevin - 04-23-2019, 02:19 PM
RE: Custom control event - by win - 04-23-2019, 02:20 PM
RE: Custom control event - by Kevin - 04-23-2019, 02:21 PM
RE: Custom control event - by win - 04-23-2019, 02:27 PM
RE: Custom control event - by Kevin - 04-23-2019, 02:34 PM
RE: Custom control event - by win - 04-23-2019, 03:02 PM
RE: Custom control event - by win - 04-26-2019, 01:45 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)