Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
solve the conflict between double keys
#1
I have a few problem that is difficult to solve. I added a search edit box above the list box. I can use the arrow keys to make a selection, use the space bar and the Enter key to confirm, But

1. I can't enter a space in the edit box because it will trigger a double click event

2. I want to use the Enter key to achieve: select and execute the first item in the list , Can't do it now , because it will trigger a double click event
* For example, when I type the letter on in the edit box, one will be displayed in the list, at this time, I want to key Enter, select and execute it

3. I want to use the ESC key to delete all the letters I have entered, but the dialog will close.
I tried to add code in the case IDCANCEL, but because it have two edit boxes, I don't know how to judge
In addition, I want to close the dialog box by pressing the esc key twice in succession. Can it be achieved?

4. I want to add a right-click event to an item in the list, which can execute external macros

The above question, for me, is very complicated, I very hope that someone can provide some help, thanks in advance.
Heart

Macro Macro3
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 256 154 "Dialog" "4"
;3 Edit 0x54030080 0x200 24 12 96 13 ""
;4 ListBox 0x54230101 0x200 24 28 96 93 ""
;5 Edit 0x54030080 0x200 136 12 96 13 ""
;6 ListBox 0x54230101 0x200 136 28 96 93 ""
;1 Button 0x54030001 0x4 72 132 48 14 "OK"
;2 Button 0x54030000 0x4 136 132 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040801 "*" "" "" ""

str controls = "3 4 5 6"
str e3 lb4 e5 lb6
lb4="one[]two[]three"
lb6="four[]five[]six"
if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc v
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,SetTimer hDlg 1 10 0
,int he3=id(3 hDlg)
,SetProp he3 "wndproc" SubclassWindow(he3 &sub.EditSubclassProc3)
,
,SetTimer hDlg 2 10 0
,int he5=id(5 hDlg)
,SetProp he5 "wndproc" SubclassWindow(he5 &sub.EditSubclassProc5)
,
,case WM_TIMER
,sel wParam
,,case 1
,,KillTimer hDlg wParam
,,goto e3text
,,case 2
,,KillTimer hDlg wParam
,,goto e5text
,,
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case EN_CHANGE<<16|3
,SetTimer hDlg 1 100 0
,case EN_CHANGE<<16|5
,SetTimer hDlg 2 100 0
,
,case LBN_DBLCLK<<16|4
,int i4=LB_SelectedItem(lParam)
,mes F"selected {i4+1}"
,
,case LBN_DBLCLK<<16|6
,int i6=LB_SelectedItem(lParam)
,mes F"selected {i6+1}"
,case IDOK
,case IDCANCEL
ret 1

;e3text
int hlb4=id(4 hDlg)
SendMessage hlb4 LB_RESETCONTENT 0 0
str s3 sEdit3.getwintext(id(3 hDlg)) 
foreach s3 lb4
,if(sEdit3.len and find(s3 sEdit3 0 1)<0) continue
,LB_Add hlb4 s3
ret

;e5text
int hlb6=id(6 hDlg)
SendMessage hlb6 LB_RESETCONTENT 0 0
str s5 sEdit5.getwintext(id(5 hDlg)) 
foreach s5 lb6
,if(sEdit5.len and find(s5 sEdit5 0 1)<0) continue
,LB_Add hlb6 s5
ret

#sub EditSubclassProc3
function# hWnd message wParam lParam

;OutWinMsg message wParam lParam
sel message
,case WM_DESTROY
,
,case WM_GETDLGCODE
,sel(wParam) 
,,case [VK_RETURN,VK_SPACE]
,,ret DLGC_WANTALLKEYS

,case [WM_KEYDOWN,WM_KEYUP]
,sel wParam
,,case [VK_DOWN,VK_UP,VK_PRIOR,VK_NEXT]
,,SendMessage id(4 GetParent(hWnd)) message wParam lParam
,,ret
,,case [VK_RETURN,VK_SPACE]
,,SendMessage GetParent(hWnd) WM_COMMAND LBN_DBLCLK<<16|4 hWnd
,,ret

int wndproc=GetProp(hWnd "wndproc"); if(!wndproc) ret
ret CallWindowProcW(wndproc hWnd message wParam lParam)


#sub EditSubclassProc5
function# hWnd message wParam lParam

;OutWinMsg message wParam lParam
sel message
,case WM_DESTROY
,
,case WM_GETDLGCODE
,sel(wParam) 
,,case [VK_RETURN,VK_SPACE]
,,ret DLGC_WANTALLKEYS

,case [WM_KEYDOWN,WM_KEYUP]
,sel wParam
,,case [VK_DOWN,VK_UP,VK_PRIOR,VK_NEXT]
,,SendMessage id(6 GetParent(hWnd)) message wParam lParam
,,ret
,,case [VK_RETURN,VK_SPACE]
,,SendMessage GetParent(hWnd) WM_COMMAND LBN_DBLCLK<<16|6 hWnd
,,ret

int wndproc=GetProp(hWnd "wndproc"); if(!wndproc) ret
ret CallWindowProcW(wndproc hWnd message wParam lParam)


Messages In This Thread
solve the conflict between double keys - by win - 04-25-2019, 02:58 AM

Forum Jump:


Users browsing this thread: 7 Guest(s)