Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
solve the conflict between double keys
#31
something is wrong.

restart qm and see if works then?
#32
prompt the same error as above
#33
oops posted last functions incorrectly should have been these 

seems this will not work for you
Function Function211
Code:
Copy      Help
str s ss sss
int i t
s="this is a test"
ss="for Win" 
i=4
t=132
sub.TestForWin(s sss ss i t)
out sss
#sub TestForWin
function ~s1 ~&result [~s2][ii][tt]
result.format("%s %i %s %i "s1 ii s2 tt)
ret
and this
Function Function211
Code:
Copy      Help
str s ss sss
int i t
s="this is a test"
ss="for Win" 
i=4
t=132
sub.TestForWin(s sss ss i t)
out sss
#sub TestForWin
function ~s1 ~&result [~s2][#ii][#tt]
result.format("%s %i %s %i "s1 ii s2 tt)
ret

but this does
Function Function211
Code:
Copy      Help
str s ss sss
int i t
s="this is a test"
ss="for Win" 
i=4
t=132
sub.TestForWin(s sss ss i t)
out sss
#sub TestForWin
function ~s1 ~&result [~s2][int'ii][int'tt]
result.format("%s %i %s %i "s1 ii s2 tt)
ret


but all 3 should work

report it in bug reports to Gintaras . I cannot help solve this. Only Gintaras can.
#34
The above three are all successful

I think it may be that the variables are not cleared in time. I have often encountered this situation before.

This is the GIF of the five code runs
#35
I don't know what the cause is but that shouldn't happen. Report it.

no its my mistake i posted incorrect code
#36
I don't know how to describe the problem.
#37
remove those attachments and retest the code i  put correct code in post above now

output should be 
this is a test 4 for Win 132
#38
unsuccessful


Attached Files Image(s)
   
#39
and this im guessing will work

Function Function214
Code:
Copy      Help
str s ss sss
int i t
s="this is a test"
ss="for Win" 
i=4
t=132
sub.TestForWin(s sss ss i t)
out sss
#sub TestForWin
function ~s1 ~&result ~s2 ii tt
result.format("%s %i %s %i"s1 ii s2 tt)
ret
#40
Yes !!


Attached Files Image(s)
   
#41
Macro Macro30
Code:
Copy      Help
str s ss sss
int i t
s="this is a test"
ss="for Win" 
i=4
t=132
TestForWin(s sss ss i t)
out sss

Function TestForWin
Code:
Copy      Help
function ~s1 ~&result [~s2][int'ii][int'tt]
result.format("%s %i %s %i"s1 ii s2 tt)
ret

Macro Macro31
Code:
Copy      Help
str s ss sss
int i t
s="this is a test"
ss="for Win" 
i=4
t=132
TestForWin2(s sss ss i t)
out sss

Function TestForWin2
Code:
Copy      Help
function ~s1 ~&result [~s2][ii][tt]
result.format("%s %i %s %i"s1 ii s2 tt)
ret

you really need to report this as your not able to use qm correctly
#42
That's true, I can't use the function above

Thank you for your help, I have already reported


Attached Files Image(s)
   
#43
Not just the function above but also qm functions as well.
#44
Still can't output characters, why Huh

Macro Macro8
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
,LB_SelectedItem(lParam _s)
,mes F"selected {_s}"
,
,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)


Attached Files Image(s)
   
#45
try this simple version dont change code at all
  just copy code from here and run

this is a simple version no subclass, no right click, just double left click to select listbox item

Function Dialog10
Code:
Copy      Help
str- sItems="one[]two[]three"
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog" "4"
;3 Edit 0x54030080 0x200 48 8 96 12 ""
;4 ListBox 0x54230101 0x200 48 24 96 48 ""
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040802 "*" "" "" ""

str controls = "3 4"
str e3 lb4
lb4=sItems
if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc v
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,case WM_TIMER
,sel wParam
,,case 1
,,KillTimer hDlg wParam
,,int hlb4=id(4 hDlg)
,,SendMessage hlb4 LB_RESETCONTENT 0 0
,,str s3 sEdit3.getwintext(id(3 hDlg))
,,foreach s3 sItems
,,,if(sEdit3.len and find(s3 sEdit3 0 1)<0) continue
,,,LB_Add hlb4 s3
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
,case LBN_DBLCLK<<16|4
,str lb4text
,_i=LB_SelectedItem(lParam lb4text)
,mes F"Selected listem number: {_i}  Text: {lb4text}"
,case EN_CHANGE<<16|3
,SetTimer hDlg 1 10 0
,
ret 1

the code you posted in macro8 has several issues. The biggest is you subclassed controls and set properties on those controls and don't remove them when dialog is closed.
#46
The above code run successfully, But it didn't achieve the effect I needed

I ended up with two purposes:

1. After type the keyword, if the required item is already in the first (in the list box), I can use enter key to   directly select and perform the operation

2. After type the keyword, Use the arrow keys select the item in the list box , use enter key to perform the operation

Can it be achieved?
#47
try this no enter required

Function Dialog10a
Code:
Copy      Help
str- sItems="one[]two[]three"
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog" "4"
;3 Edit 0x54030080 0x200 48 8 96 12 ""
;4 ListBox 0x54230101 0x200 48 24 96 48 ""
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040802 "*" "" "" ""

str controls = "3 4"
str e3 lb4
lb4=sItems
if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc v
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,case WM_TIMER
,sel wParam
,,case 1
,,KillTimer hDlg wParam
,,int hlb4=id(4 hDlg)
,,SendMessage hlb4 LB_RESETCONTENT 0 0
,,str s3 sEdit3.getwintext(id(3 hDlg))
,,foreach s3 sItems
,,,if(sEdit3.len and find(s3 sEdit3 0 1)<0) continue
,,,LB_Add hlb4 s3
,,int count=LB_GetCount(hlb4)
,,if count=1
,,,LB_SelectItem(hlb4 0)
,,,SendMessage hDlg WM_COMMAND LBN_DBLCLK<<16|GetDlgCtrlID(hlb4) hlb4        
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
,case LBN_DBLCLK<<16|4
,str lb4text
,_i=LB_SelectedItem(lParam lb4text)
,mes F"Selected listem number: {_i}  Text: {lb4text}"
,case EN_CHANGE<<16|3
,SetTimer hDlg 1 10 0
,
ret 1
#48
In actual use, it is inconvenient. Just inputting a character is executed.

Need to press the Enter key to confirm
#49
the way that works is once the list filtering eliminates all other entries but one  it automatically selects and double clicks that item.
#50
If there is no Enter key to confirm, it is too dangerous. Wink

If use a combo box, i can use the arrow keys to select directly, but filtering is difficult.
#51
If implement the following features, that to be succeeds

In case no item is selected, use the Enter key to execute the first item in the list box


http://www.quickmacros.com/forum/showthr...5#pid33445


Forum Jump:


Users browsing this thread: 1 Guest(s)