New topic: Global array - NilObjectException
<http://forums.realsoftware.com/viewtopic.php?t=45362> Page 1 of 1 [ 1 post ] Previous topic | Next topic Author Message Bodevinaat Post subject: Global array - NilObjectExceptionPosted: Sun Sep 16, 2012 4:29 am Joined: Tue Aug 28, 2012 3:52 am Posts: 8 Hello, I have constructed a date picker as sheet window (Mac) It is an array of text controls. Upon filling the controls with the correct dates I fill another global array with the corresponding date objects. When the user moves the mouse the corresponding date object gets selected. I have declared the date array as a global array. This array gets filled: //declare var's sub DrawMonth(isDate as Date) dim weekDay as Byte dim weekNummer as Byte dim startDate as new Date dim vandaag as new Date dim i as Integer dim monthList() as String = Array("januari","februari","maart","april","mei","juni","juli","augustus","september","oktober","november","december") //first day of month isDate.day = 1 //obtain start position weekday = isDate.DayOfWeek-2 isDate.day = isDate.day - weekday //fill control Array for i = 0 to 41 if isDate.Month <> vandaag.Month then //if date is not in this month then lighter text pd(i).TextColor = rgb(160,160,160) else pd(i).TextColor = rgb(0,0,0) end if pd(i).text = str(isDate.day) dateArray(i) = isDate // fill dateArray<-- pd(i).MouseCursor = System.Cursors.FingerPointer isDate.day = isDate.day+1 next dateField.text = vandaag.LongDate bigDate.text = str(vandaag.day) bigMonth.text = monthList(vandaag.Month-1) //fill weeknrs for i = 0 to 5 weeknr(i).text = Str(isDate.WeekOfYear+i) next But when I try to read the array when moving the mouse over the control: Pickdate.day = dateArray(index).Day bigDate.text = Str(Pickdate.day) dateField.text = Pickdate.LongDate I get a NilObjectException. If I take a look with the debugger, I can't find the array....The array ceases to exist, or can't be reached or what? Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 1 post ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
