cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
nkelleh
Level III

Trouble with mousebox behavior?

Hi All,

I'm trying to implement a drag and drop behavior for two list boxes in JSL. Basically, I'm trying to replicate the drag and drop behavior that already exists for colListBox objects for normal list boxes, i.e. that a user can click on any item in a list box, click, drag and drop it to another list box. I have successfully implemented the behavior want for the receiving drop box, however, I'm struggling with the source drop box. Basically, I'm not sure how to implement the behavior I want. The closest I've got is leaving the set click function disabled for the list box's parent mouse box, enabling drag,  and putting the following code in the << set drag begin and << set drag end functions:


<< Set Drag Begin(



    Function( {this, clickpt},




           If( N Items( (this << child) << Get Selected  ) == 0,


      


                (this << child) << Set Selected(1);



                    0;



                ,//Else



                    test = ( (this << child) << Get Selected );



                    test[1];



            );



    );



);


and this


<< Set Drag End(



    Function( {this, clickpt, how},


        If( how == "move",


            (this << child) << Remove Selected;


        )


    );



);


But doing this, means that single clicks don't work to select an item in the list box, a user would have to double click, otherwise the first item will be selected. This isn't ideal but its all I have been able to get working. Any help or pointers to more information on this would be greatly appreciated.

On a second note, occasionally when I do drag something across from the first list box, sometimes the item I dragged does not delete. This only happens very intermittently, but I have no idea why its happening, or how to fix it. Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Craige_Hales
Super User

Re: Trouble with mousebox behavior?

I put a script here

Craige

View solution in original post

2 REPLIES 2
Craige_Hales
Super User

Re: Trouble with mousebox behavior?

I put a script here

Craige
nkelleh
Level III

Re: Trouble with mousebox behavior?

Apologies for not getting back sooner. I was pulled onto other projects and did not get a chance to revisit JSL for a while. This worked great for me. Really good comments too. Just wondering is there more documentation on MouseBox available on the web? I haven't had much success tracking it down and would love more info on the mechanics of MouseBox, drop commit, etc. Cheers!