New topic: ListBox/TextField's not refreshed when they should?
<http://forums.realsoftware.com/viewtopic.php?t=46184> Page 1 of 1 [ 2 posts ] Previous topic | Next topic Author Message BillFrugge Post subject: ListBox/TextField's not refreshed when they should?Posted: Sun Dec 09, 2012 5:17 pm Joined: Sun Dec 09, 2012 4:47 pm Posts: 1 I am trying to learn REALbasic, but having a tough time at it... I am working with REALbasic 2010r5.1 on the Windows 7 platform. I am writing a program to help me archive some files. The program shells to winrar and par2. Winrar was nice enough to provide me with a visual indication that it is working, but par2cmdline was the only thing I've found that let me run it and pass parameters to it. The problem is that when I shell to par2cmdline, I don't see anything and I want visual feedback so that I can tell that the program is still working. It would be nice to create my own terminal window to replace the command prompt window, but I would settle for a simple line in a TextField or ListBox. Inside a for-next loop, I have placed code similar to the following: myCmd.Timeout=-1 myCmd.Mode=0 ListBox2.AddRow("Archiving " + listbox1.cell(i,1)) listbox2.Refresh cmd = "C:\winrar" + listbox1.cell(i,1) +" " + listbox1.cell(i,1) + "*.*" myCmd.Execute(cmd) //Generate Pars listbox2.AddRow("Generating Pars for " + listbox1.cell(i,1)) listbox2.Refresh cmd = "C:\Par2" + listbox1.cell(i,1) + " " + listbox1.cell(i,1) + "*.*" myCmd.Execute(cmd) Okay... Yes, I know. There are some errors with the value of cmd. I cut out a lot for clarity. Hardcoding the file location is a no-no as well. I can clean that up later; right now, I'm focused on a larger problem: Listbox2 never changes. Same thing with a TextField. Listbox2 shows only that it is working on the first file. It never changes to state that it is now working on the second phase, nor does it change to the second file. (or so on) Once the program has finished, all entries show up. I have experimented with setting a delay after each refresh command. (Oddly enough, the program works properly while at breakpoints) I know this may not be the best way to do this, but I don't see why this doesn't work. I've seen this behaviour before and gave up. Top timhare Post subject: Re: ListBox/TextField's not refreshed when they should?Posted: Sun Dec 09, 2012 5:30 pm Joined: Fri Jan 06, 2006 3:21 pm Posts: 11874 Location: Portland, OR USA Quote:Inside a for-next loop... Unless this code is in a Thread, you are blocking the UI so you won't see any updates until the entire process is finished. Use a thread. Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 2 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]
