On 14-May-07, at 10:44 AM, Tomas Camin wrote:

> Hi,
>
> under Windows and Mac (linux not tested) when
> mylistbox.selectiontype=Listbox.SelectionMultiple current row
> selection will be lost when right clicking (or cmd clicking):
>
> start an empty project
> add a listbox and populate it with a couple of items
> set selectiontype=Listbox.SelectionMultiple
> add some items to the contextual menu
>
> run the app
> select some rows
> right click (or cmd click)
> previous selection is lost and only one row is selected.
>
> Is this a bug or am I doing something wrong?
>
> Instead of constructcontextualmenu I've been using a workaround
> suggested by Karen in an older post (calling menuitem.popup in
> mousedown) but there is a bug under Windows that force me to use the
> constructcontextualmenu.
>
> Now some code:
>
> -- mylistbox.constructcontextualmenu:
> dim m as MenuItem
>
>
> m=New MenuItem
> m.text="menuitem test"
> base.append m
>
> return true
>
> -- mylistbox.open:  
> dim i as integer
>
>
> for i=0 to 100
> me.AddRow "test"
> next
>
> me.SelectionType=Listbox.SelectionMultiple
>

if you check I think you'll find you get both the cellclick and  
mousedown and that's what seems to be deselecting everything

you can catch this by inserting, in the cellclick, something like

   if Keyboard.AsyncControlKey or IsContextualClick then
     return true
   end if

and the selection will not be changed BUT the ConstructContextualMenu  
will not be called either

If you could use the menuitem.popup then you could have the  
contextual menu show up

You could use something like

   if Keyboard.AsyncControlKey or IsContextualClick then
     dim base as New MenuItem
     dim m as MenuItem


     m=New MenuItem
     m.text="menuitem test"

     base.append m

     m = base.PopUp

     return true
   end if


Not sure how you get this effect if you have to use  
ConstructContextualMenu


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to