Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Array Questions
#1
I have this array I'm trying to setup but I can't figure out why it doesn't work unless I put a "-1" at the end of "w=wininfo.len-1". Why won't this work? "w=wininfo.len" If "len" is the number of "rows" then wouldn't wininfo[0 wininfo.len] work?


Code:
Copy      Help
ClearOutput
int h=child(mouse)
if h=0
,end
int m w x y cx cy
GetWinXY win() x y cx cy
ARRAY(int)+ wininfo
if wininfo=0
,wininfo.create(3 1);;columns rows
,out "created"
for(w 0 wininfo.len)
,if wininfo[0 w]=h
,,wininfo[1 w]=cx
,,wininfo[2 w]=cy
,,out "replaced"
,,end
wininfo.redim(-1)
w=wininfo.len-1
wininfo[0 w]=h
wininfo[1 w]=cx
wininfo[2 w]=cy
An old blog on QM coding and automation.

The Macro Hook
#2
ARRAY(int) a.create(2)
out a.len ;;2
out a[0]
out a[1]
out a[a.len] ;;error, a[2] does not exist
out a[a.ubound] ;;ok, a[1]

Use len-1 or ubound.
#3
AHHHHHHH....THAT FREAKIN "0" AGAIN!!!!!!:evil:

THANKS. :oops:
An old blog on QM coding and automation.

The Macro Hook


Forum Jump:


Users browsing this thread: 1 Guest(s)