Re: Progress/Status of Data inload in a popup window
| From: | Alan Knowles | Date: | Wed, 31 Oct 2001 05:35:47 +0000 |
| Subject: | Re: Progress/Status of Data inload in a popup window | ||
| References: | 1 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-500@lists.php.net to get a copy of this message | ||
PQ Administrator wrote:
I have the progress bar working somewhat... i created it in Glade.... and in my query... $i // $i is the number of records being returned set by i++ in while(odbc_fetch_array...) and $chckcount is the number of rows returned bye odbc_num_rows() Code: if($i != $chkcount) { $progress->update(0.$i); try$progress->update($i/$checkcount);
} My problem is that 461 records are being returned so the progress bar goes to 100% once or twice and then it will count 461 as 46% for a third time stopping halfway TIA-----Original message----- * From:* "PQ Administrator" <pqadmin@physicianquest.net>*To:* "RichPayne" <rdp@talisman.alphalinux.org> *Cc:* "PHP-GTK" <php-gtk-general@lists.php.net> *Date:* 10/30/2001(Tue)18:42 *Subject:* Re: Re: Re: Re: [PHP-GTK] Progress/Status of Data inload in a popup windowThanks for the tip, i used those gtk:: even handlers and the app win doesnt look frozen any more.However, I cant get my update to the progress bar to work. It wil show up *after* the query has finished...Ive enclosed teh query i am trying to use with the progressbar...TIA$queryezcap = "SELECT ....";$queryexe2 = odbc_exec($connezcap, $queryezcap) or die ("Couldnt exec EZ-CAP query!");$j=0;$j=(int)$j;$progress->update('0.1');while(odbc_fetch_row($queryexe2)) { $clist->freeze();$ezmembid=odbc_result($queryexe2, 1); $ezfname=odbc_result($queryexe2, 2); $ezlname=odbc_result($queryexe2, 3); $ezmi=odbc_result($queryexe2, 4); $ezpcp=odbc_result($queryexe2, 5); $ezstreet=odbc_result($queryexe2, 6); $ezcity=odbc_result($queryexe2, 7); $ezstate=odbc_result($queryexe2, 8); $ezzip=odbc_result($queryexe2, 9); $histmembid=odbc_result($queryexe2, 10); $histhpfrom=odbc_result($queryexe2, 11); $histcurr=odbc_result($queryexe2, 12); $histopt=odbc_result($queryexe2, 13); $ezbirth=odbc_result($queryexe2, 14); $ezsubssn=odbc_result($queryexe2, 15); $pcpmembid=odbc_result($queryexe2, 16); $pcpfromdt=odbc_result($queryexe2, 17); $pcpcurrhist=odbc_result($queryexe2, 18); $pcphistid=odbc_result($queryexe2, 19);list($year, $month, $day) = explode("-", $ezbirth); list($year1, $month1, $day1) = explode("-", $histhpfrom); list($year2, $month2, $day2) = explode("-", $pcpfromdt);$formtdbday = "$month/$day/$year"; $formthpfrom = "$month1/$day1/$year1"; $formtpcpfromdt = "$month2/$day2/$year2";$return2[] .= $ezmembid; $return2[] .= $ezlname; $return2[] .= $ezfname; $return2[] .= $ezmi; $return2[] .= $formtdbday; $return2[] .= $ezsubssn; $return2[] .= $histopt; $return2[] .= $formthpfrom; $return2[] .= $pcphistid; $return2[] .= $formtpcpfromdt;$rowfill = $clist->append($return2);// $col1 = &new GdkColor(105000, 105000, 105000); // $col2 = &new GdkColor(255000, 182000, 193000); $col1 = &new GdkColor("gray"); $col2 = &new GdkColor("pink");$style = $clist->style; $style1 = $style->copy(); $style1->base[GTK_STATE_NORMAL] = $col1; $style1->base[GTK_STATE_SELECTED] = $col1; $style2 = $style->copy(); $style2->base[GTK_STATE_NORMAL] = $col2; $style2->base[GTK_STATE_SELECTED] = $col2;if($ezmembid != $membid) {$clist->set_cell_style($rowfill, 0, $style2);} else {$clist->set_cell_style($rowfill, 0,$style1);} if($ezlname != $lname) {$clist->set_cell_style($rowfill, 1, $style2);} else {$clist->set_cell_style($rowfill, 1,$style1);} if($ezfname != $fname) {$clist->set_cell_style($rowfill, 2, $style2);} else {$clist->set_cell_style($rowfill, 2,$style1);} if($ezmi != $mi) {$clist->set_cell_style($rowfill, 3, $style2);} else {$clist->set_cell_style($rowfill, 3,$style1);} if($ezbirth != $bdate) {$clist->set_cell_style($rowfill, 4, $style2);} else {$clist->set_cell_style($rowfill, 4,$style1);} if($ezsubssn != $certnum) {$clist->set_cell_style($rowfill, 5, $style2);} else {$clist->set_cell_style($rowfill, 5,$style1);} if($histopt != $plancode) {$clist->set_cell_style($rowfill, 6, $style2);} else {$clist->set_cell_style($rowfill, 6,$style1);} if($formthpfrom != $newezopeffdt) {$clist->set_cell_style($rowfill, 7, $style2);} else {$clist->set_cell_style($rowfill, 7,$style1);}if($pcphistid != $ezpcpid) {$clist->set_cell_style($rowfill, 8, $style2);} else {$clist->set_cell_style($rowfill, 8,$style1);}if($formtpcpfromdt != $newproveffdt) {$clist->set_cell_style($rowfill, 9, $style2);} else {$clist->set_cell_style($rowfill, 9,$style1);}/* $inloadprogress->update('1');if($j == $chkezcapquery){$statslabel->set_text("Done!");} */ $clist->thaw(); unset($return2); $j++;-----Original message----- * From:* "RichPayne" <rdp@talisman.alphalinux.org>*To:* "PQAdministrator" <pqadmin@physicianquest.net> *Cc:* php-gtk-general@lists.php.net *Date:* 10/30/2001(Tue)17:32 *Subject:* Re: Re: Re: [PHP-GTK] Progress/Status of Data inload in a popup windowOn Tue, 30 Oct 2001, PQ Administrator wrote:Thanks for your reply, im actually new to GTK... isgtk::events_pending(), etc .... a handler?How would I implement that?Well, I haven't seen your code but I'm assuming you're trying to update the progress bar as you pull data (to/from a DB etc...). The problem is that while you may be updating the progress bar, the GUI never get updated as you're using the one available thread for your work. What that little loop does is to check if there's any GTK+ related work to be done, and if so do it, then go back to what you were doing before. So the code might look something like this:while ($row=mysql_fetch_object($result_set) != FALSE) { while (gtk::events_pending()) gtk::main_iteration();do_someting_with_the_result_set($row);update_status_bar($new_value); }Does that make some sense?--rdpThanks again!-----Original message----- From: "RichPayne" To: "PQAdministrator" Cc: "PHP-GTK" Date: 10/30/2001(Tue)16:03 Subject: Re: [PHP-GTK] Progress/Status of Data inload in a popup windowI think the old:while (gtk::events_pending()) gtk::main_iteration();is your friend here. There's also an example status bar app at php-coders.net (or is that php-coder.net, don't have time to check at the moment).--rdpOn Tue, 30 Oct 2001, PQ Administrator wrote:Thanks for the help on my last problem with passing the objects from func to func, I figured it out (sometimes its right in front of you!) ... I do have another ? however.Im trying to create some type of status window with either dynamic labels or progress bar which shows the status of the data inload into the application.Right now when I start up the app the screen is just stuck not displaying anything as if its locked up while the data gets inserted from the DB into the Clist's.When I tried creating a window which tells the user to wait while data is being inloaded, and then lets them know when its done, it gets "freezed up" as well.How can I create a popup window which can display this without being frozen by the parent windows data inload?And how do I do the progress bar from a MySQL/ODBC query(s) (NOT successful here yet!)TIA Troy McComas Networks/System Admin. & Developer PhysicianQuest.com admin@physicianquest.com Office - (818)550-8777 or (626)282-0288 Cell- (626)255-9833Powered by PhysicianQuest.com-- Rich Payne rpayne@alphalinux.org www.alphalinux.orgTroy McComas Networks/System Admin. & Developer PhysicianQuest.com admin@physicianquest.com Office - (818)550-8777 or (626)282-0288 Cell- (626)255-9833Powered by PhysicianQuest.com-- Rich Payne rpayne@alphalinux.org www.alphalinux.org/*Troy McComas *//*Networks/System Admin. & Developer*//*PhysicianQuest.com <http://www.physicianquest.com> *//*admin@physicianquest.com <mailto:admin@physicianquest.com> *//*Office - (818)550-8777 or (626)282-0288 *//*Cell- (626)255-9833 */------------------------------------------------------------------------ /Powered by / PhysicianQuest.com <http://www.physicianquest.com> <http://mail.physicianquest.net:80/cgi-auth/mailrcpt.cgi?userid=pqadmin&maildomainname=physicianquest.net&msgid=20011030.AAA1004496036@physicianquest.net>/*Troy McComas */ /*Networks/System Admin. & Developer*/ /*PhysicianQuest.com <http://www.physicianquest.com> */ /*admin@physicianquest.com <mailto:admin@physicianquest.com> */ /*Office - (818)550-8777 or (626)282-0288 */ /*Cell- (626)255-9833 */ ------------------------------------------------------------------------ PhysicianQuest.com <http://www.physicianquest.com> <http://mail.physicianquest.net:80/cgi-auth/mailrcpt.cgi?userid=pqadmin&maildomainname=physicianquest.net&msgid=20011030.AAA1004500415@physicianquest.net>