Posts: 1,337
Threads: 61
Joined: Jul 2006
something is wrong.
restart qm and see if works then?
Posts: 726
Threads: 99
Joined: Mar 2018
prompt the same error as above
Posts: 1,337
Threads: 61
Joined: Jul 2006
04-27-2019, 03:25 AM
(This post was last modified: 04-27-2019, 04:14 AM by Kevin .)
oops posted last functions incorrectly should have been these
seems this will not work for you
Function
Function211
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
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
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.
Posts: 726
Threads: 99
Joined: Mar 2018
04-27-2019, 03:36 AM
(This post was last modified: 04-27-2019, 04:17 AM by win .)
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
Posts: 1,337
Threads: 61
Joined: Jul 2006
04-27-2019, 04:02 AM
(This post was last modified: 04-27-2019, 04:09 AM by Kevin .)
I don't know what the cause is but that shouldn't happen. Report it.
no its my mistake i posted incorrect code
Posts: 726
Threads: 99
Joined: Mar 2018
I don't know how to describe the problem.
Posts: 1,337
Threads: 61
Joined: Jul 2006
04-27-2019, 04:15 AM
(This post was last modified: 04-27-2019, 04:20 AM by Kevin .)
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
Posts: 726
Threads: 99
Joined: Mar 2018
unsuccessful
Attached Files
Image(s)
Posts: 1,337
Threads: 61
Joined: Jul 2006
and this im guessing will work
Function
Function214
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
Posts: 726
Threads: 99
Joined: Mar 2018
Yes !!
Attached Files
Image(s)
Posts: 1,337
Threads: 61
Joined: Jul 2006
04-27-2019, 04:33 AM
(This post was last modified: 04-27-2019, 04:39 AM by Kevin .)
Macro
Macro30
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
function ~ s1 ~& result [~ s2][int ' ii][int ' tt]
result.format ( "%s %i %s %i" s1 ii s2 tt)
ret
Macro
Macro31
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
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
Posts: 726
Threads: 99
Joined: Mar 2018
04-27-2019, 04:51 AM
(This post was last modified: 04-27-2019, 04:58 AM by win .)
That's true, I can't use the function above
Thank you for your help, I have already reported
Attached Files
Image(s)
Posts: 1,337
Threads: 61
Joined: Jul 2006
Not just the function above but also qm functions as well.
Posts: 726
Threads: 99
Joined: Mar 2018
Still can't output characters, why
Macro Macro8
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)
Posts: 1,337
Threads: 61
Joined: Jul 2006
04-27-2019, 11:43 PM
(This post was last modified: 04-27-2019, 11:45 PM by Kevin .)
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
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.
Posts: 726
Threads: 99
Joined: Mar 2018
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?
Posts: 1,337
Threads: 61
Joined: Jul 2006
try this no enter required
Function
Dialog10a
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
Posts: 726
Threads: 99
Joined: Mar 2018
04-28-2019, 12:24 AM
(This post was last modified: 04-28-2019, 12:27 AM by win .)
In actual use, it is inconvenient. Just inputting a character is executed.
Need to press the Enter key to confirm
Posts: 1,337
Threads: 61
Joined: Jul 2006
the way that works is once the list filtering eliminates all other entries but one it automatically selects and double clicks that item.
Posts: 726
Threads: 99
Joined: Mar 2018
04-28-2019, 12:43 AM
(This post was last modified: 04-28-2019, 12:45 AM by win .)
If there is no Enter key to confirm, it is too dangerous.
If use a combo box, i can use the arrow keys to select directly, but filtering is difficult.
Posts: 726
Threads: 99
Joined: Mar 2018
04-28-2019, 02:41 AM
(This post was last modified: 04-28-2019, 02:55 AM by win .)
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