Daklu Posted February 17, 2011 Report Share Posted February 17, 2011 I'm trying to use a pair of MC Listboxes and drag-and-drop to create test sequences. One listbox has all the available steps listed, the other is where the sequence is assembled and edited. It's slowly coming around to how I want it to work, but I can't figure out how to deselect the rows in either listbox when it loses focus. I can change the selection programmatically, I'm just not sure what set of events I need to watch for before clearing the selection. Anyone have a clue they're willing to share? Quote Link to comment
Yair Posted February 17, 2011 Report Share Posted February 17, 2011 You might wish to ask yourself whether you actually need the lines to be deselected. Is there any harm in leaving them selected? If not, then here are some obvious candidates: Drag end on either LB (it's possible that you would need to use the event to deselect just the other LB). Mouse up on the VI (or on all the controls in the VI minus the LB you released on). Key Down on the VI? There may be others. This is just off the top of my head. Quote Link to comment
hooovahh Posted February 17, 2011 Report Share Posted February 17, 2011 I can't figure out how to deselect the rows in either listbox when it loses focus. If you're asking for what I think you are, all you need to do is write -1 to the local variable of the listbox and it will deselect the row. Quote Link to comment
Daklu Posted February 17, 2011 Author Report Share Posted February 17, 2011 If you're asking for what I think you are, all you need to do is write -1 to the local variable of the listbox and it will deselect the row. THAT part I got. It's a question of *when* to write that value to get the behavior I'm looking for. You might wish to ask yourself whether you actually need the lines to be deselected. Is there any harm in leaving them selected? It's not harmful, but it will go a long ways toward making the UI intuitive. I've added code to keypress handlers to delete the selected rows in the sequence builder when the delete key is pressed and the listbox has focus. Unselected the rows (or changing the highlighting color) is a good visual indicator for the user to know whether the delete key will work or not. If not, then here are some obvious candidates: Thanks for the suggestions. I guess I'll have to intercept every event that possibly can change the focus, compare the active object to the listboxes, and set listbox value if it's not selected. I was hoping for something a little more elegant and simple, but it is what it is. Quote Link to comment
Yair Posted February 17, 2011 Report Share Posted February 17, 2011 Thanks for the suggestions. I guess I'll have to intercept every event that possibly can change the focus, compare the active object to the listboxes, and set listbox value if it's not selected. I was hoping for something a little more elegant and simple, but it is what it is. For the "active object" part, I would suggest having a single shift register with a "LB 1, LB2, Other" enum and just set it whenever you make a selection in one of the LBs. Quote Link to comment
ShaunR Posted February 17, 2011 Report Share Posted February 17, 2011 For the "active object" part, I would suggest having a single shift register with a "LB 1, LB2, Other" enum and just set it whenever you make a selection in one of the LBs. Or just pass the refnum since they are all the same (only have to be similar). Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.