New topic: Drawstring array help.
<http://forums.realsoftware.com/viewtopic.php?t=33749> Page 1 of 2 [ 24 posts ] Go to page 1, 2 Next Previous topic | Next topic Author Message waveuponwave Post subject: Drawstring array help.Posted: Tue May 11, 2010 8:39 pm Joined: Fri Jan 29, 2010 12:39 pm Posts: 220 Location: Virginia U.S.A. I have an array appended with a result from a database. I am trying to draw the array result into 31 canvas boxes. When I use the code below it just draws them all as a clump of data from each result in each box. Any idea how I can get each result into each canvas box as it loops through? Thanks. Code: dim c as integer for c = 0 to 30 g.forecolor = &c000000 g.drawstring PlannerCount(c), 25, 50 next _________________ RB2010r2 Pro on Win 7 I promise to help if I ever learn how to help myself. Last edited by waveuponwave on Tue May 11, 2010 9:48 pm, edited 1 time in total. Top brisance Post subject: Re: Drawstring question.Posted: Tue May 11, 2010 9:14 pm Joined: Tue Oct 06, 2009 2:38 am Posts: 230 Did you mean to say that you want to have the result from the database appearing in 30 different Canvases? If so, you would probably have to extend your Canvas to allow an arbitrary string to be written somewhere within each Canvas's Graphic object and then trigger each Canvas's paint event by calling the refresh method. _________________ Mike Ash: Getting Answers Top waveuponwave Post subject: Re: Drawstring question.Posted: Tue May 11, 2010 9:18 pm Joined: Fri Jan 29, 2010 12:39 pm Posts: 220 Location: Virginia U.S.A. I want to draw array result 1 in canvas box 1 and result 2 in canvas box 2 and so on. As it stands, it draws them all on top of each other in each canvas box. _________________ RB2010r2 Pro on Win 7 I promise to help if I ever learn how to help myself. Top serd83 Post subject: Re: Drawstring array help.Posted: Tue May 11, 2010 9:56 pm Joined: Thu Feb 22, 2007 7:08 pm Posts: 1070 Just put this in your Paint event: Code:g.drawstring PlannerCount(index), 25, 50 and all works fine. Top waveuponwave Post subject: Re: Drawstring array help.Posted: Tue May 11, 2010 9:59 pm Joined: Fri Jan 29, 2010 12:39 pm Posts: 220 Location: Virginia U.S.A. I almost got it working like this. But the indexes are off on the canvas boxes. Code: dim c as integer dim cc as integer dim s as string for c = 0 to 30 s = PlannerCount(c) cnvDay(c).graphics.forecolor = &c000000 cnvDay(c).graphics.drawstring s, 25, 50 next or Code: dim c as integer for c = 0 to 30 cnvDay(c).graphics.forecolor = &c000000 cnvDay(c).graphics.drawstring PlannerCount(c), 25, 50 next _________________ RB2010r2 Pro on Win 7 I promise to help if I ever learn how to help myself. Top serd83 Post subject: Re: Drawstring array help.Posted: Tue May 11, 2010 10:10 pm Joined: Thu Feb 22, 2007 7:08 pm Posts: 1070 Your loops can not work this way. Have you try only this line in your paint event? Code:g.drawstring PlannerCount(index), 25, 50 Top waveuponwave Post subject: Re: Drawstring array help.Posted: Tue May 11, 2010 10:12 pm Joined: Fri Jan 29, 2010 12:39 pm Posts: 220 Location: Virginia U.S.A. Yeah that could work and so could my code but my array indexes and my canvas indexes can't be identical unfortunately. _________________ RB2010r2 Pro on Win 7 I promise to help if I ever learn how to help myself. Top serd83 Post subject: Re: Drawstring array help.Posted: Tue May 11, 2010 10:18 pm Joined: Thu Feb 22, 2007 7:08 pm Posts: 1070 You create 31 canvas as a control array with the same name, and PlannerCount is a string array which have the content from the database? Or is your composition different? If it is different, how it looks? Top waveuponwave Post subject: Re: Drawstring array help.Posted: Tue May 11, 2010 10:21 pm Joined: Fri Jan 29, 2010 12:39 pm Posts: 220 Location: Virginia U.S.A. I have 36 canvas boxes as an array. I have a string array that is populated by 31 results from the database. Only 31 of the 36 boxes are active at any time and their indexes change. Thanks for the help by the way. _________________ RB2010r2 Pro on Win 7 I promise to help if I ever learn how to help myself. Top serd83 Post subject: Re: Drawstring array help.Posted: Tue May 11, 2010 10:32 pm Joined: Thu Feb 22, 2007 7:08 pm Posts: 1070 Assume you have a global array "PlannerCount() as string" and add 4 canvas as control array. Open: Code:PlannerCount = array("A", "B", "C", "D") Canvas1().Paint: Code:g.drawstring PlannerCount(index), 25, 50 What is wrong with this? Top waveuponwave Post subject: Re: Drawstring array help.Posted: Tue May 11, 2010 10:35 pm Joined: Fri Jan 29, 2010 12:39 pm Posts: 220 Location: Virginia U.S.A. serd83 wrote:Assume you have a global array "PlannerCount() as string" and add 4 canvas as control array. Open: Code:PlannerCount = array("A", "B", "C", "D") Canvas1().Paint: Code:g.drawstring PlannerCount(index), 25, 50 What is wrong with this? Nothing. But that's not the way my app is set up unfortunately. Thanks for the help Serd. I'll see if I can't redesign my controls or something. _________________ RB2010r2 Pro on Win 7 I promise to help if I ever learn how to help myself. Top timhare Post subject: Re: Drawstring array help.Posted: Tue May 11, 2010 10:52 pm Joined: Fri Jan 06, 2006 3:21 pm Posts: 7723 Location: Portland, OR USA So how do you determine which array index goes in which canvas? (We can't answer that for you without a lot more information.) Top waveuponwave Post subject: Re: Drawstring array help.Posted: Tue May 11, 2010 10:53 pm Joined: Fri Jan 29, 2010 12:39 pm Posts: 220 Location: Virginia U.S.A. I'm trying Tim. I really am. That is the question isn't it. _________________ RB2010r2 Pro on Win 7 I promise to help if I ever learn how to help myself. Top waveuponwave Post subject: Re: Drawstring array help.Posted: Tue May 11, 2010 10:57 pm Joined: Fri Jan 29, 2010 12:39 pm Posts: 220 Location: Virginia U.S.A. I only have the 31 of 36 visible. is there any way to tell the index of just the visible canvas boxes? _________________ RB2010r2 Pro on Win 7 I promise to help if I ever learn how to help myself. Top waveuponwave Post subject: Re: Drawstring array help.Posted: Tue May 11, 2010 10:59 pm Joined: Fri Jan 29, 2010 12:39 pm Posts: 220 Location: Virginia U.S.A. Or some other thing I can do to those non-visible canvas boxes to remove the indexes from them? _________________ 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 2 [ 24 posts ] Go to page 1, 2 Next -- 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]
