Re: List view, editable renderers and popupmenus



On Sun, Feb 23, 2003 at 07:10:47PM +0100, Remco Poelstra wrote:
How can I make sure that the right mouse button only selects the row 
and not turns it in edit mode? And how can I make sure that the row is 
selected before the menu is displayed.

I tried connecting the "button-press" event with 
g_signal_connect_after(), but then the menu isn't displayed at all.
To determine the current row, I connected a handler to the "changed" 
signal of the list selection.

Yes, I encountered that too.  I can't remember if I put it into
bugzilla.

I worked around it by connecting to button-press-event but returning
FALSE from it, so the event passes through to the list and eventually
selects the item in the list, which then updates the menu that has been
popped up.  That means the menu originally pops up with the wrong item
selected, but in practice it happens so fast you can't see it.

That won't really work in your case, though, because what you really
want to do is return TRUE from the event handler so that the button
click doesn't go through.  This would fix the editing problem...

You might be able to do something like this to hack around it:

my_button_press_handler:
  if right mouse button:
    block the edit somehow (block the signal or turn off the setting)
  return FALSE   // let it fall through to the gtk one

my_button_release_handler
  if right mouse button:
    fix up the above change back to normal
  return FALSE

-- 
      Evan Martin
martine cs washington edu
  http://neugierig.org



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