Signals firing too often



I've got a Gtk2::SimpleList that triggers some code when a row is selected.
The signal I'm currently using is 'button_release_event'. I've tried a fair few others. The code that gets triggered updates the contents of the form, based on which row is selected. The update process refreshes the data in the Gtk2::SimpleList, which seems to trigger more events, and it doesn't matter which signal I use, they all seem to get triggered multiple times. Without any further modification, I get 3 events.

So I've added a global variable, $do_company_update, which I set to 0 right after the row is clicked, and before the rest of the code runs. If the 'refresh' code finds $do_company_update has a 1, it updates the SimpleList, otherwise if it finds a 0, it simply resets this to 1 and continues without refreshing the SimpleList. This reduces the number of my signals being fired from 3 to 2. I can't really see how the 2nd is being fired now.

The reason I began investigating it is that on the 3rd signal, the selected row would be reset to 0 ( which itself doesn't sound right, but that's another issue ). Now that I have only 2 signals, this behaviour has stopped and the form works as expected ( the code runs twice, but you only discover this inside a debugger - you can't tell from the form ).

What's going on?

Is there a signal I can use to catch when someone selects a row in a SimpleList that:
a) Won't get triggered if the SimpleList data is rebuild
b) Won't trigger multiple times?

Thanks!

Dan

--
Daniel Kasak
IT Developer
NUS Consulting Group
Level 5, 77 Pacific Highway
North Sydney, NSW, Australia 2060
T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989
email: dkasak nusconsulting com au
website: http://www.nusconsulting.com.au
Title: CanIt Vote for ID 45125

The following links have been placed here by the NUS Consulting internal spam filter and are for use by NUS Consulting staff only.
Please ingore these links.
Spam
Not spam
Forget previous vote


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]