Jump to content

XControl upcasting


Recommended Posts

It seems automatic upcasting doesn't work with XControls (see attached image), it's necessary to explicitly upcast to Control class. But I don't know if it's a bug or another strange XControl thing particular of my machine. Anybody else?

Saludos,

Aitor

Umm, it seems if the XControl reference is connected to the first terminal of the build array node, it works, but if it's on another, it fails...

:throwpc:

Saludos,

Aitor

Link to post
Share on other sites

QUOTE(Aristos Queue @ May 23 2007, 09:03 PM)

Thanks, Aristos.

Now I have found an ugly bug with XControls. XControl value property doesn't work if the XControl is disabled. I've looked in the NI forums and is a known issue: http://forums.ni.com/ni/board/message?board.id=170&message.id=177819' target="_blank">http://forums.ni.com/ni/board/message?boar...ssage.id=177819

Now the question is: has been this bug corrected in LV 8.2.1? I have my app almost finished and so I haven't updated to 8.2.1, but I'd do it if that's the solution. If not... If not this would be a big, big problem, since I need to update an XControl value from another VI when that XControl is disabled :(

I have attached a very simple test VI. If anybody can test it in LV8.2.1 I would be grateful.

Saludos,

Aitor

Link to post
Share on other sites

Well there is an easy work around:

- Enable you control

- Update value

- Disable control

You might even benefit from using deferring the panel update (this might hide the fact that you are enabling your control briefly)

PJM

Link to post
Share on other sites

QUOTE(PJM_labview @ May 24 2007, 08:48 PM)

Well there is an easy work around:

- Enable you control

- Update value

- Disable control

True, but there are also some minor problems with that:

1) If you try to change a disabled XControl, not only fails but, after that, keeps failing even if you enable it again, until the user interacts with it (or until you close the VI and open it again). I'm assuming the XControl remains in some kind of internal bad state. So if you are not careful enough and forget to remove just one case of "set value while disabled", you can make your XControl useless for the rest of the application.

2) My XControl is not disabled itself, but inside a disabled tab control. So I have to carry around the tab control refnum to enable and disable it (or get the XControl owner object to enable / disable it). It can be done, but doesn't seem very efficient since there are a lot of XControl instances (almost all the numerical controls/indicators) and I don't know if they are enabled or not :wacko: .

Anyway, I'll implement some similar solution and hope not to forget anything ;) . Thanks.

Saludos,

Aitor

Link to post
Share on other sites

QUOTE(Aitor Solar @ May 25 2007, 02:12 AM)

True, but there are also some minor problems with that:

1) If you try to change a disabled XControl, not only fails but, after that, keeps failing even if you enable it again, until the user interacts with it (or until you close the VI and open it again). I'm assuming the XControl remains in some kind of internal bad state. So if you are not careful enough and forget to remove just one case of "set value while disabled", you can make your XControl useless for the rest of the application.

2) My XControl is not disabled itself, but inside a disabled tab control. So I have to carry around the tab control refnum to enable and disable it (or get the XControl owner object to enable / disable it). It can be done, but doesn't seem very efficient since there are a lot of XControl instances (almost all the numerical controls/indicators) and I don't know if they are enabled or not :wacko: .

Anyway, I'll implement some similar solution and hope not to forget anything ;) . Thanks.

Saludos,

Aitor

Hmmm... you might consider as a workaround creating your own property for your XControl called myDisable. It would have the same inputs (0, 1, 2) as the regular Disable property for a control, but all it would do is turn around and disable the actual controls on the Xcontrol panel instead of disabling the XControl itself. It would have the same affect, but technically your XControl itself would not be disabled, so the Value property wouldn't be affected.

Obviously the problem with this approach is that if you're disabling a number of controls together using an array of references, then you'd have to check which references aren't normal controls and call your version of the disabled property node instead of the regular one.

Just a thought...

Link to post
Share on other sites

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.