Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Optional parameters about the function
#10
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
Code:
Copy      Help
;/
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
Code:
Copy      Help
;/
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.


Messages In This Thread
Optional parameters about the function - by win - 04-27-2019, 04:56 AM
RE: Optional parameters about the function - by Kevin - 04-27-2019, 03:22 PM

Forum Jump:


Users browsing this thread: 3 Guest(s)