Re: Timing Problem



Ok...  a more complete description:

The Gtk::TreeView is displaying a Gtk::TreeStore, and the user can
create new rows; both sibling rows and child rows.  The first cell in
each sibling row must contain a unique character string.  In order to
enforce this, I created a callback slot and connected it to the
signal_edited signal of the cell renderer of the first column in each
row.  In this callback slot, I have a routine that enforces this
condition.  The callback slot is called anytime this editable cell
renderer loses focus. 

The application has two buttons:  The first is labeled "Apply" and it
writes the content of the TreeStore out to a database.  The second is
labeled "Cancel" and it merely leaves the application screen without
doing anything.  If the user is just trying to leave the screen without
writing the data he has entered to the database, then obviously, I do
not want to perform the uniqueness check in the callback slot of the
cell renderer.  My problem is this:  When the cell renderer loses focus
for whatever reason, its signal_edited callback slot is called before
anything else.  I do have a callback slot connected to both buttons
"signal_clicked" and I did set a status variable in this function, but
it gets set AFTER the callback slot for the cell renderer is called, and
hence is too late to do me any good.

My question is:  is there any way to force the order in which callback
slots are called.  I had hoped to do this uniqueness enforcement as the
user entered data, rather than at the end when he has pressed the
"Apply" button.  If I cannot detect which of the buttons he presses that
results in the cell renderer losing focus before the signal_edited
callback slot is called, I'll have to abandon this approach.

I hope this makes  a little more sense.

Bob

Marco Scholten wrote:

>> Greetings all!
>>
>> I have an editable cell renderer in a treeview which has a callback slot
>> connected to its "signal_edited" signal.  The actions taken in this
>> callback slot depend upon knowing to which widget the cell renderer lost
>> focus.  Because the cell renderer's callback slot is called prior to the
>> callback slot (wherein status variables are set) connected to the
>> "signal_clicked" signal of the widget gaining focus from the cell
>> renderer, the cell renderer's callback slot doesn't have fresh status
>> data.
>>
>> Anyone have any ideas on how I can get around this problem?
>>
>> Bob
>
>
> Maybe i don't fully understand your problem, but it sounds like you
> want to process
> the data from the cellrenderer in the signal_clicked of the widgets
> that get the focus.
> If you want this to be done in one function then you can connect the
> callback slot to
> all the signal_clicked signals of the widgets instead of the
> signal_edited of your
> cell renderer.
>
> -- 
> Marco
>
>
>



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