Jonathon Jongsma wrote:
> On 11/8/07, Matt Bragano <[EMAIL PROTECTED]> wrote:
>   
>> I have a TreeView that allows multiple selections.  When multiple
>> selections are made and the user right-clicks, a pop-up menu appears
>> where the user can choose to add the selected files to a play list.  My
>> problem is that whenever the right mouse button is released and the menu
>> appears the selections are unselected, which makes the option to add
>> selected files useless from the pop-up menu  (although it still works
>> fine from the standard menu bar).
>>
>> So I'm wondering how I can maintain the selection after the TreeView
>> itself loses focus to the pop-up menu.  I messed around with
>> TreeSelection::set_select_function() but I was unable to make the
>> callback slot behave properly.
>>
>> Any suggestions?
>>
>> Thanks,
>> Matt Bragano
>>     
>
> You might look at the code I wrote for nemiver's Breakpoints list
> where I do something similar. The code is at
> http://svn.gnome.org/svn/nemiver/trunk/src/persp/dbgperspective/nmv-breakpoints-view.cc.
>  Most of the action is in on_breakpoints_view_button_press_signal().
> The important things to  note are that the signal is connected
> *before* the default handler (pass a 3rd parameter of 'false' to
> connect()), and that I return 'true' from the signal handler to
> prevent the default handler from running (which would result in all of
> the other rows becoming de-selected).
>
>   
Ah I see now.  Actually, in connecting the signal before the default 
handler, I noticed that I had use connect_notify() and didn't preempt 
the default handler.

Thanks for the help, I never would've figured that out!

Matt Bragano
_______________________________________________
gtkmm-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtkmm-list

Reply via email to