RE: [PHP-GTK] Killing vs blocking signals -- Solved
| From: | dpgirago at mdanderson dot org | Date: | Tue, 17 Aug 2004 17:46:03 +0000 |
| Subject: | RE: [PHP-GTK] Killing vs blocking signals -- Solved | ||
| Groups: | php.gtk.general | ||
| Request: | Send a blank email to php-gtk-general+get-4971@lists.php.net to get a copy of this message | ||
Solution found.
I am instantiating the patient clist (line 13 below) in the body of the
application, then passing it to the function described on lines 7 and 8,
where the names are appended to the clist. The problem arose from also
having inside this function the _connect_ calls to other functions, e.g.,
$cListPatientID->connect('select-row', 'GetPrescriptionsFromPatientID'),
rather than within the body of the app. Once moved outside the function,
all worked as expected.
Thanks, Scott, for your response, and for all who read the thread.
Dave
1> I have a series of 6 checkboxes, each of which corresponds to a
treatment
2> room in a clinic, say, rooms 1 - 6. These checkboxes all _connect_ to
the
3> same function, which determines which button was _clicked_, then adds
or
4> subtracts a value from an array depending upon whether the button was
5> checked or unchecked. This function then calls another function that
uses
6> the array values as a filter - the where clause - in a database query.
The
7> result set from this query then is used to populate a Clist of patient
8> names who are to be seen in the treatment rooms that have been checked.
So
9> a user can uncheck all 6 buttons, and thereby clear the clist, or check
10> one or more buttons, with each click automatically changing the
contents
11> and display of patient names in the Clist. This all works as expected.
12>
13> The problem comes when a patient's name in the Clist is selected. This
14> _event_ is handled by another function that queries the database for
15> information related to the patient and displays it elsewhere in the
GUI.
16> Although this also works correctly on the surface, what happens is
that
17> for each state change in the checkboxes, a corresponding number, plus
1,
18> of identical queries are run for the related information. I'm assuming
the
19> 'plus 1' part is occurring as a result of the actual selection of a
20> patient's name in the clist.
21> As you can imagine, with many clicks of the checkboxes, and a
22> corresponding increase in identical queries run, the displaying of
data
23> can start to have a noticeable delay.
24>
25> To debug, I've echoed out the queries that I'm running, and the
problem
26> seems to be as I've described above. The solution seems to involve
27> 'killing' the signals emitted from the checkboxes, but only after the
28> clist has been updated.
29>
30> I've looked at and played with the GtkObject::emit_stop(), but have
not
31> had success using it. And I'm aware of and using signal_handler_block
and
32> unblock, but this is not preventing the behavior that I'm describing.