TreeView + Multiple Selection + Right Click == Lose Selection

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

TreeView + Multiple Selection + Right Click == Lose Selection

Jody Steele
Hello again. ^^

I swear eventually I'll know enough to answer questions intstead of just  
leeching answers myself. ;)

So heres the situation this time.  We have a TreeView, which has multiple  
selection enabled, and a handler setup for button-press-event, which is  
only concerned about right clicks.

However, whenever we have multiple things selected (for example by hold  
ctrl down and left clicking) and then right click, our selection  
disappears to be replaced by only the row we are currently clicking on.  
If we are still holding down ctrl then the row we clicked on is removed  
 from the selection, but the rest remain.  I'm wondering if there is a way  
to obtain more MS like behaviour where you can right click on any of the  
selections to retain that selection, and right click elsewhere to first  
select that object, and then emit the button press event.

Thanks in advance.

Jody

P.S.  I just checked another GTK app (The GIMP), and the Open Image dialog  
works pretty much as I explained.

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
_______________________________________________
pygtk mailing list   [hidden email]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Reply | Threaded
Open this post in threaded view
|

Re: TreeView + Multiple Selection + Right Click == Lose Selection

Danny Milosavljevic
Hi,

Am Sonntag, den 05.06.2005, 03:48 -0400 schrieb Jody Steele:

> Hello again. ^^
>
> I swear eventually I'll know enough to answer questions intstead of just  
> leeching answers myself. ;)
>
> So heres the situation this time.  We have a TreeView, which has multiple  
> selection enabled, and a handler setup for button-press-event, which is  
> only concerned about right clicks.
>
> However, whenever we have multiple things selected (for example by hold  
> ctrl down and left clicking) and then right click, our selection  
> disappears to be replaced by only the row we are currently clicking on.  
return True in the button-press-event, that will stop others from
receiving the click (I think), and your selection will go unharmed

>  
> If we are still holding down ctrl then the row we clicked on is removed  
>  from the selection, but the rest remain.  I'm wondering if there is a way  
> to obtain more MS like behaviour where you can right click on any of the  
> selections to retain that selection, and right click elsewhere to first  
> select that object, and then emit the button press event.

Hmm.

>
> Thanks in advance.
>
> Jody
>
> P.S.  I just checked another GTK app (The GIMP), and the Open Image dialog  
> works pretty much as I explained.

really ? Which part ?

I cant see anything that can do multiple selection and right click
there...

cheers,
   Danny

--
www.keyserver.net key id A334AEA6


_______________________________________________
pygtk mailing list   [hidden email]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

signature.asc (196 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: TreeView + Multiple Selection + Right Click == Lose Selection

Jody Steele
>> However, whenever we have multiple things selected (for example by hold
>> ctrl down and left clicking) and then right click, our selection
>> disappears to be replaced by only the row we are currently clicking on.
>
> return True in the button-press-event, that will stop others from
> receiving the click (I think), and your selection will go unharmed
>

Excellent!

Thank you very much!

>>
>> If we are still holding down ctrl then the row we clicked on is removed
>>  from the selection, but the rest remain.  I'm wondering if there is a  
>> way
>> to obtain more MS like behaviour where you can right click on any of the
>> selections to retain that selection, and right click elsewhere to first
>> select that object, and then emit the button press event.
>
> Hmm.
>

I think the way for me to attain this would be as follows (in the button  
press handler):

figure out what row the button was pressed in
check to see if that row is selected
if not unselect all rows, and select only that row

>> P.S.  I just checked another GTK app (The GIMP), and the Open Image  
>> dialog
>> works pretty much as I explained.
>
> really ? Which part ?
>
> I cant see anything that can do multiple selection and right click
> there...

In The GIMP File-> Open...

The TreeView in the middle of the screen is multiple selection enabled,  
AND you can right click on it as well.  I assume this is probably a gtk  
common dialog (also assuming those exist ^^_


Thank you so much.  I figured it would turn out to be a fairly simple  
solution that we were just overlooking :)


Jody Steele


--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
_______________________________________________
pygtk mailing list   [hidden email]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/