Jump to content

Listbox event - SubObj parameter


Graeme

Recommended Posts

Hi all,

I have a Listbox for a user to input numerous strings at run-time (lists of recipients for one of the SMTP VIs). Double-click allows editing of a row. Right-click brings up a user menu, some of whose selections are row dependant. Thus, I have to calculate (albeit simply) in which row the mouse pointer was when the menu was brought up. It seems to work.

I have two questions regarding this technique, though, both vaguely related, although only one is LabVIEW, the other is OS. First, LabVIEW. In the Listbox event "Shortcut Menu Selection (User)" there is available the reference "SubObj". I'd hoped that this might be a reference to the row where the menu was brought up, thus sparing me the maths. However, although I can wire this reference to various nodes, they all produce the run-time error "Object reference is invalid". I can't do anything with it. Can someone tell me what this refrence is and how it should be used? Second, a right click on an object in an OS (say a folder): does the OS return a reference to the object or do you still have to calculate the mouse pointer position to determine which object has been clicked on? I'm really looking for best practice techniques to employ in LabVIEW, where available. I attach my listbox VI.

Regards, Graeme,

Link to comment

QUOTE(Graeme @ Jan 4 2008, 02:14 PM)

I have a Listbox for a user to input numerous strings at run-time (lists of recipients for one of the SMTP VIs). Double-click allows editing of a row. Right-click brings up a user menu, some of whose selections are row dependant. Thus, I have to calculate (albeit simply) in which row the mouse pointer was when the menu was brought up. It seems to work.

I have two questions regarding this technique, though, both vaguely related, although only one is LabVIEW, the other is OS. First, LabVIEW. In the Listbox event "Shortcut Menu Selection (User)" there is available the reference "SubObj". I'd hoped that this might be a reference to the row where the menu was brought up, thus sparing me the maths. However, although I can wire this reference to various nodes, they all produce the run-time error "Object reference is invalid". I can't do anything with it. Can someone tell me what this refrence is and how it should be used? Second, a right click on an object in an OS (say a folder): does the OS return a reference to the object or do you still have to calculate the mouse pointer position to determine which object has been clicked on? I'm really looking for best practice techniques to employ in LabVIEW, where available. I attach my listbox VI.

Regards, Graeme,

[0] I believe starting in LV 8.0(?) you can just use a method on the listbox to retrieve the clicked row (and column) using the mouse coordinates.

[1] SubObj refers to the control actually clicked on. May be a member of a cluster. http://zone.ni.com/reference/en-XX/help/371361D-01/lvprop/vi_shrtct_menu_activation/' target="_blank">See here.

[2] The OS doesn't return anything to LabVIEW. I am not sure what you are referring to here. You can poll the mouse for movement and clicks, but you will not receive any event notifications from mouse events that occur outside LabVIEW windows.

David

Link to comment

Hi JDave,

Thanks for the prompt response.

[0] Looking into it.

[1] That's what I thought, but it doesn't do it for me. I'll investigate further, particularly your link, thanks (although the list box looks like an array to me, not a cluster - willing to be corrected)

[2] Very badly worded question on my part, and I shouldn't've asked it here. I know the OS doesn't return to LV, but I just wondered if, say, Windows, programmers had to calulate a right-click event, do they have to work out co-ordinates or do they simply get returned a reference to the right-clicked control automatically? Idle curiosity, really.

Thank you again JDave.

Link to comment

QUOTE(Graeme @ Jan 4 2008, 03:09 PM)

Hi JDave,

Thanks for the prompt response.

[0] Looking into it.

[1] That's what I thought, but it doesn't do it for me. I'll investigate further, particularly your link, thanks (altough the list box looks like an array to me, not a cluster - willing to be corrcted)

[2] Very badly worded question on my part, and I shouldn't've asked it here. I know the OS doesn't return to LV, but I just wondered if, say, Windows, programmers had to calulate a right-click event, do they have to work out co-ordinates or do they simply get returned a reference to the right-clicked control automatically? Idle curiosity, really.

With regards to [1], the SubObj only applies to objects that do have sub-objects -- such as clusters.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.