Posts: 726
Threads: 99
Joined: Mar 2018
I have encountered a strange problem, the same problem in the win7 64-bit English version and the Chinese version system.
I hope the developer can verify and fix it, the code and the action demo are here
http://www.quickmacros.com/forum/showthr...7#pid33407
Posts: 1,337
Threads: 61
Joined: Jul 2006
Win has a problem when there are optional function arguments the function errors. He is not able to run most functions that have optional arguments or if the function works the optional variable is empty
Posts: 726
Threads: 99
Joined: Mar 2018
If you need me to cooperate, you can use teamvievwer to connect to my computer to check the situation.
Posts: 12,081
Threads: 142
Joined: Dec 2002
04-27-2019, 01:42 PM
(This post was last modified: 04-27-2019, 01:44 PM by Gintaras.)
Which code does not work? I tested this, it works as expected.
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
The code without spaces between parameters is incorrect.
Posts: 763
Threads: 261
Joined: Jul 2012
04-27-2019, 02:30 PM
(This post was last modified: 04-27-2019, 02:58 PM by r0n.)
- never mind -
Posts: 12,081
Threads: 142
Joined: Dec 2002
The bug is that QM does not throw a syntax error when used code like this:
Posts: 1,337
Threads: 61
Joined: Jul 2006
it's very strange any function that has optional function arguments doesn't work for him or only partially works. i cannot reproduce his problem either.They work for me but not him.
Another example
,case LBN_DBLCLK<<16|4
,LB_SelectedItem(lParam _s)
,mes F"selected {_s}"
see here as well
http://www.quickmacros.com/forum/showthr...0#pid33350
don't work or only partially work for him.
Posts: 763
Threads: 261
Joined: Jul 2012
Ah ok, I edited my post.
(sorry).
Posts: 726
Threads: 99
Joined: Mar 2018
04-27-2019, 03:09 PM
(This post was last modified: 04-27-2019, 03:12 PM by win.)
@kevin
I also just found out that if there is a space between the parameters, it can run successfully.
function# hwnd [ARRAY(int)&ai ] [ARRAY(str)&as]
Function LB_GetSelectedItems
;/
function# hwnd [ARRAY(int)&ai] [ARRAY(str)&as]
;Gets selected items in a multisel listbox control.
;Returns number of selected items.
;hwnd - control handle.
;ai - array variable that receives indices of selected items. Optional, can be 0.
;as - array variable that receives text of selected items. Optional, can be 0.
;REMARKS
;The control must belong to current process. Use eg in dialog procedures.
if(&ai) ai=0
;if(&as) as=0
int i n
n=SendMessage(hwnd LB_GETSELCOUNT 0 0); if(n<1) ret
if &ai or &as
,ARRAY(int) _ai; if(!&ai) &ai=_ai
,ai.create(n)
,n=SendMessage(hwnd LB_GETSELITEMS n &ai[0]); if(n<0) n=0
,if(n!ai.len) ai.redim(n)
,if &as
,,as.create(n)
,,for(i 0 n) LB_GetItemText(hwnd ai[i] as[i])
ret n
http://www.quickmacros.com/forum/showthr...0#pid33350
This problem is still not solved
Posts: 1,337
Threads: 61
Joined: Jul 2006
04-27-2019, 03:22 PM
(This post was last modified: 04-27-2019, 03:30 PM by Kevin.)
very strange i didn't touch the function code only copied and pasted. I just checked it has a space on my qm file. Maybe in that case the spaces didn't transfer over
ok i did find the reason for that particular one
seems if you preview a post before submitting some spaces are removed
example
post code directly
Function LB_GetSelectedItems
;/
function# hwnd [ARRAY(int)&ai] [ARRAY(str)&as]
;Gets selected items in a multisel listbox control.
;Returns number of selected items.
;hwnd - control handle.
;ai - array variable that receives indices of selected items. Optional, can be 0.
;as - array variable that receives text of selected items. Optional, can be 0.
;REMARKS
;The control must belong to current process. Use eg in dialog procedures.
if(&ai) ai=0
if(&as) as=0
int i n
n=SendMessage(hwnd LB_GETSELCOUNT 0 0); if(n<1) ret
if &ai or &as
,ARRAY(int) _ai; if(!&ai) &ai=_ai
,ai.create(n)
,n=SendMessage(hwnd LB_GETSELITEMS n &ai[0]); if(n<0) n=0
,if(n!ai.len) ai.redim(n)
,if &as
,,as.create(n)
,,for(i 0 n) LB_GetItemText(hwnd ai[i] as[i])
ret n
and now code previewed then submitted
Function LB_GetSelectedItems
;/
function# hwnd [ARRAY(int)&ai][ARRAY(str)&as]
;Gets selected items in a multisel listbox control.
;Returns number of selected items.
;hwnd - control handle.
;ai - array variable that receives indices of selected items. Optional, can be 0.
;as - array variable that receives text of selected items. Optional, can be 0.
;REMARKS
;The control must belong to current process. Use eg in dialog procedures.
if(&ai) ai=0
if(&as) as=0
int i n
n=SendMessage(hwnd LB_GETSELCOUNT 0 0); if(n<1) ret
if &ai or &as
,ARRAY(int) _ai; if(!&ai) &ai=_ai
,ai.create(n)
,n=SendMessage(hwnd LB_GETSELITEMS n &ai[0]); if(n<0) n=0
,if(n!ai.len) ai.redim(n)
,if &as
,,as.create(n)
,,for(i 0 n) LB_GetItemText(hwnd ai[i] as[i])
ret n
there is a bug in the forum preview code it removes spaces.
Posts: 726
Threads: 99
Joined: Mar 2018
So that is what it is , I really admire your seriousness
Posts: 12,081
Threads: 142
Joined: Dec 2002
Confirmed.
It is a bug in forum software. Probably i will not be able to fix it. But now you know how to live with it.
Posts: 12,081
Threads: 142
Joined: Dec 2002
Function Function19
;/
function# [a] [b]
;Surprise! I installed the new version of the editor plugin, and the bug is fixed.
Posts: 1,337
Threads: 61
Joined: Jul 2006
That's good news thanks Gintaras
Posts: 726
Threads: 99
Joined: Mar 2018
|