New topic: How can I fix this (Thread)
<http://forums.realsoftware.com/viewtopic.php?t=44008> Page 1 of 1 [ 4 posts ] Previous topic | Next topic Author Message lenpartico Post subject: How can I fix this (Thread)Posted: Mon May 14, 2012 8:13 pm Joined: Fri Sep 30, 2005 10:49 pm Posts: 438 Hello, I have an app that displays lots of graphics in Imagewells, these imagewells are on Window1. The app opens in Window2 and Window2 has a Pushbutton which will display Window1 when pushed. Window2 takes about 60 seconds to be displayed, so when the Pushbutton in Window2 is pushed the Pushbutton becomes highlighted and nothing appears to be happening to the user until about 60 seconds when Window1 is displayed. I would like to show a progressbar and a label with the following text âPlease be patient, this window is loading graphics... Depending on the graphic content of the file this window can take up to one minute to be displayed.â So in Window2 I have a Label1 with that text, and I have a ProgressBar1 and a Thread1 I have this code in the Pushbutton StaticText1.Visible = True ProgressBar1.Visible = True ProgressBar1.Maximum = 0 Thread1.Run and this code in the Thread1 Window1.Show When the Pushbutton in Window2 is pushed it becomes highlighted and nothing appears to be happening to the user until about 60 seconds when Window1 is displayed just like if there were no ProgressBar1 and Thread1. What am I doing wrong and how can I fix it? Thanks. Lennox Top simulanics Post subject: Re: How can I fix this (Thread)Posted: Mon May 14, 2012 9:00 pm Joined: Sun Aug 12, 2007 10:10 am Posts: 594 Location: Boiling Springs, SC I'm surprised your window isn't flashing from the window2.show repeating in the thread...are you "pre" loading graphics so-to-speak before showing the user the window with the graphics (and are they part of the app resources or static image files in a directory...or loaded from the Net?)... Just trying to wrap my thoughts around why it would take 60 seconds to load the images when if they are static (which should be a few thousand for 60 seconds)...when the fileitems could be stored in an array in a matter of milliseconds and appear in the imagewell using imagewell.backdrop=picture.open(fileitem)...this being more efficient if memory becomes an issue since it sounds like they are being loaded and stored into memory. They array could then propogate a listbox or any other means of "selecting" an image... What is a quick 2 sentence outline of what your program is trying to achieve? Sorry for all the questions and possible assumptions... Trying to gather info so I can try to help to the best of my abilities _________________ Matthew A. Combatti Real Studio 2011 r4.3 Visit Real Studio Developer's Spot! Systems: Windows XP/Windows Vista/Windows Server 2008 r2/Windows 7/Windows 8 Beta Mac OSX 10.5/Mac OSX 10.6/Mac OSX Server/Ubuntu/Debian/Suse/Red Hat/ Windows Server 2011/CentOS 5.4 /ReactOS/SimOS ~All REAL Compatible~ Top lenpartico Post subject: Re: How can I fix this (Thread)Posted: Mon May 14, 2012 9:28 pm Joined: Fri Sep 30, 2005 10:49 pm Posts: 438 The pictures being loaded were obtained via dropping into the imagewells. The images were then converted to binarystreams and encoded via encodebase64. So I now have an array of encode64 binarystreams which is saved as a text document. On opening the text document the array is split into the corresponding elements and are decoded base64, Then the array of binarystreams are converted to pictures and loaded into the imagewells. The opening of the text document and loading them back into the imagewells is what takes all that time. If you can suggest another method that would be appreciated too. Thanks. Lennox OK, I have a set of pictures that I want to save as a text document and later reopen that text document and display the picturestrings in imagewells. Top timhare Post subject: Re: How can I fix this (Thread)Posted: Mon May 14, 2012 10:51 pm Joined: Fri Jan 06, 2006 3:21 pm Posts: 11298 Location: Portland, OR USA Have the thread read the file and convert the images into an array of picture objects. When it is done, fire a short period timer and have the timer load the images into the imagewells. Touching the window from the thread is verboten. 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]
