ListPresenter and ContetxMenu

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

ListPresenter and ContetxMenu

Bruno Brasesco
Hi,

I have a ListView that has a dynamic Context Menu, it depends on selected
item.
But when I use the Right Button to change the selection, the context menu it
is the context menu of last selection not the current.
Example:
MyPresenter
onSelectionChanged

    listPresenter hasSelection ifTrue:[listPresenter view contextMenu:
listPresenter selection contextMenu.].

After this, the context menu for the selected item is wrong, and is the
context menu of previous selected item.

Any idea ?

Best Regards
Bruno Buzzi Brasesco


Reply | Threaded
Open this post in threaded view
|

Re: ListPresenter and ContetxMenu

Bill Dargel
Bruno wrote:

> I have a ListView that has a dynamic Context Menu, it depends on selected
> item.
> But when I use the Right Button to change the selection, the context menu it
> is the context menu of last selection not the current.
> [ Snip ]
>
> Any idea ?

I don't have an answer to the problem. But I did report a bug a couple of weeks
ago that appears to be caused by the same underlying problem. Since there was no
response to that message, I'm including it here again.

-Bill

-----------------
<previous message>

Subject:  Bug in menu enables
Date: Tue, 28 May 2002 17:11:20 -0400
From: Bill Dargel <[hidden email]>

Was adding an bit of an extension to Steve Waring's extensions to the
SUnitBrowser, and ran into some anomalies in the enabling/disabling of
menu items. I was able to reproduce the problem in a clean image.

    Open SystemBrowser.
    Find class Scribble. (in the Class List).
    Right click on Scribble. Note that "Views" menu item is enabled.
    Esc menu.
    Right click on ScaledDecimal. See that "Views" menu item is still
enabled, though it shouldn't be.

Did some Transcript tracing in ClassSelector>>queryCommand: and
determined that when it's called due to the right click, the
selectionOrNil (aka class) is still the old value (Scribble in the
example), rather than what the menu will be acting upon (ScaledDecimal
in the example).

Obviously some issue with the the fact that the right-click needs to
first select the list item and then pop up the context menu. Not sure
what the problem is, but it seems like maybe some event is not being
triggered, or is getting triggered in the wrong order.

I'm curious to see what the fix turns out to be. (I know I'll learn
something).

-------------------------------------------
Bill Dargel            [hidden email]
Shoshana Technologies
100 West Joy Road, Ann Arbor, MI 48105  USA