Re: Multiple questions on the treeview



Pavlo Korzhyk wrote:
I did some testing, and noticed that the selection 'changed' signal is
emitted *before* the 'focus_in_event' of the treeview. In my case, this
means that when one of the text entries has the focus, and I use the
mouse to select another row in the treeview, signals are emitted in this
order:

on_treeview_selection_changed
on_entry_focus_out_event
on_treeview_focus_in_event

Did you try catching signal_changed() and signal_editing_done() of the
text entry?
They may be fired before selection_changed and will be usefull in your case...

The changed signal of the text entry is fired while editing the text entry and thus always before the treeview selection_changed signal can happen. So I could use it to update the treeview, but it's not really suitable to reformat (or validate) the input.

For example, if the user inputs something like "5.19" or even "5.19abc" in an entry that is supposed to be converted to a number with only one digit, the treeview will show the correct value "5.2" after the conversion, but the the text entry still contains the bad input. I think doing the reformatting also in the changed signal handler is a bad idea, because that will have side-effects like changing the cursor (which will be confusing for the user I think). And won't this create a loop when the text is modified inside the signal handler?

The signal_editing_done is only used as part of a treeview, as far as I understand from the documentation. I tried it and it does nothing.

In the meantime, I found some other contra-indications for using the focus_out_event signal to update the treeview. There are cases when the focus is not lost at all. For instance a button with an accelerator can be "clicked" without giving it focus first (and thus never loosing the focus on the text entry). Of course I can still use the signal for the reformatting. But I'll have to find another method to update my treeview... Ideas are welcome...




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