Killing vs blocking signals
| From: | dpgirago at mdanderson dot org | Date: | Tue, 17 Aug 2004 15:43:19 +0000 |
| Subject: | Killing vs blocking signals | ||
| Groups: | php.gtk.general | ||
| Request: | Send a blank email to php-gtk-general+get-4968@lists.php.net to get a copy of this message | ||
I'm having some unexpected GUI behavior, and I'm uncertain whether my
overall design is off (definitely possible) or whether there are low-level
methods that I might use but am unaware of (definitely) to alter the
incorrect behavior.
Here's the set-up:
I have a series of 6 checkboxes, each of which corresponds to a treatment
room in a clinic, say, rooms 1 - 6. These checkboxes all _connect_ to the
same function, which determines which button was _clicked_, then adds or
subtracts a value from an array depending upon whether the button was
checked or unchecked. This function then calls another function that uses
the array values as a filter - the where clause - in a database query. The
result set from this query then is used to populate a Clist of patient
names who are to be seen in the treatment rooms that have been checked. So
a user can uncheck all 6 buttons, and thereby clear the clist, or check
one or more buttons, with each click automatically changing the contents
and display of patient names in the Clist. This all works as expected.
The problem comes when a patient's name in the Clist is selected. This
_event_ is handled by another function that queries the database for
information related to the patient and displays it elsewhere in the GUI.
Although this also works correctly on the surface, what happens is that
for each state change in the checkboxes, a corresponding number, plus 1,
of identical queries are run for the related information. I'm assuming the
'plus 1' part is occurring as a result of the actual selection of a
patient's name in the clist.
As you can imagine, with many clicks of the checkboxes, and a
corresponding increase in identical queries run, the displaying of data
can start to have a noticeable delay.
To debug, I've echoed out the queries that I'm running, and the problem
seems to be as I've described above. The solution seems to involve
'killing' the signals emitted from the checkboxes, but only after the
clist has been updated.
I've looked at and played with the GtkObject::emit_stop(), but have not
had success using it. And I'm aware of and using signal_handler_block and
unblock, but this is not preventing the behavior that I'm describing.
The example code for the above seemed longer and more complicated than
just describing it, but I could re-post with the code if need be.
All feedback gratefully accepted as I've pretty much run out of ideas.
Thanks,
dave