New topic: Accessing controls from thread.
<http://forums.realsoftware.com/viewtopic.php?t=37355> Page 1 of 1 [ 4 posts ] Previous topic | Next topic Author Message eleventh-hour Post subject: Accessing controls from thread.Posted: Mon Jan 31, 2011 6:47 pm Joined: Fri Sep 30, 2005 12:05 pm Posts: 4 I am trying to populate a listbox on a page using a thread so that I can run a progress wheel while a database query is running. However, when I try to access any control on the page I receive a nilobjectexception. Example. Code:if webpage.container1.control.visible then ... end if Any help would be appreciated. --Troy Top Thom McGrath Post subject: Re: Accessing controls from thread.Posted: Mon Jan 31, 2011 10:17 pm Site Admin Joined: Tue May 06, 2008 1:07 pm Posts: 658 Location: Greater Hartford Area, CT You should split up your code to determine which object is nil. I suspect it is WebPage, as there won't be a session in context. _________________ Thom McGrath - @tekcor, thezaz.com Web Framework Architect, REAL Software, Inc. Top eleventh-hour Post subject: Re: Accessing controls from thread.Posted: Mon Jan 31, 2011 10:41 pm Joined: Fri Sep 30, 2005 12:05 pm Posts: 4 You are correct. How would I go about keeping the session as well as the page and its controls in context so that I may work with them? Thanks for your help, Troy Top Thom McGrath Post subject: Re: Accessing controls from thread.Posted: Tue Feb 01, 2011 12:42 am Site Admin Joined: Tue May 06, 2008 1:07 pm Posts: 658 Location: Greater Hartford Area, CT Your best bet is to keep a reference to the session object on your thread. Then you can call SessionObject.WebPage to access that particular page. _________________ Thom McGrath - @tekcor, thezaz.com Web Framework Architect, REAL Software, Inc. Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 4 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]
