New topic: Canvas paint not working properly.
<http://forums.realsoftware.com/viewtopic.php?t=34255> Page 1 of 1 [ 5 posts ] Previous topic | Next topic Author Message waveuponwave Post subject: Canvas paint not working properly.Posted: Sat Jun 12, 2010 11:55 pm Joined: Fri Jan 29, 2010 12:39 pm Posts: 309 Location: Virginia U.S.A. I am trying to paint multiple canvases by index. I am finding the canvas index to paint from a database comparison to paint the canvas based on index. The database query and compare is working properly and it is populating the array correctly as I can msgbox through the array and get the values within it. However when I try to paint the indexes by looping through the array in the paint event, it only paints the first array index result and ignores the rest of them. I can't understand it, it should be working. Any help would be appreciated. Thanks. Paint event code: Code: ' Paint the matched times Dim i as Integer Dim j as Integer j=Ubound(cnvPaintTime) for i = 0 to j If cnvPaintTime(i) = me.Index Then g.forecolor = &cFF0000 g.fillrect 0, 0, me.width, me.height End ' Walk through the array by adding 1 i = i + 1 next _________________ RB2010r2 Pro on Win 7 I promise to help if I ever learn how to help myself. Last edited by waveuponwave on Sun Jun 13, 2010 1:19 am, edited 1 time in total. Top timhare Post subject: Re: Canvas paint not working properly.Posted: Sun Jun 13, 2010 12:23 am Joined: Fri Jan 06, 2006 3:21 pm Posts: 7886 Location: Portland, OR USA Why do you have the line Code:i = i + 1 inside a For/Next loop? You're skipping every other index. Top waveuponwave Post subject: Re: Canvas paint not working properly.Posted: Sun Jun 13, 2010 1:13 am Joined: Fri Jan 29, 2010 12:39 pm Posts: 309 Location: Virginia U.S.A. Because when I first coded it, it was a while loop. I just left it in there by mistake. Nice catch. Sorry it took me so long to respond. My system crashed right after I posted this question. Thank you. _________________ RB2010r2 Pro on Win 7 I promise to help if I ever learn how to help myself. Top jefftullin Post subject: Re: Canvas paint not working properly.Posted: Sun Jun 13, 2010 1:37 am Joined: Wed Nov 15, 2006 3:50 pm Posts: 1650 Location: England I couldnt leave that enormous select case as it was... try this alternative: Code: dim theval as integer dim hrstr as string hrstr = left(mstrTime, instr(mstrTime,":")-1) theval = val(hrstr) if right(mstrTime,2) = "AM" and hr = 12 then hr = 0 if right(mstrTime,2) = "PM" then hr = hr + 12 theval = theval * 4 + val(mid(mstrTime,instr(mstrTime,":")+1,2)) \15 //theval is the number you should append for any given time of day Edit: and by the time I posted this, you had removed the select case statement from the post.! _________________ RB2009 R5.1 and RB2008 Mac 10.6 + Windows 7/XP + Ubuntu Linux in Vmware on a Macbook 2.16 Top waveuponwave Post subject: Re: Canvas paint not working properly.Posted: Sun Jun 13, 2010 2:45 am Joined: Fri Jan 29, 2010 12:39 pm Posts: 309 Location: Virginia U.S.A. Sorry. I didn't think it was needed to understand what I did wrong for future readers. Because as you stated, it is huge and took up a lot of space. I'll take a look at what you've done. Thank you. _________________ RB2010r2 Pro on Win 7 I promise to help if I ever learn how to help myself. Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 5 posts ] -- 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]
