07-27-2012 06:55 PM
07-28-2012 11:01 AM
07-28-2012 02:56 PM
07-28-2012 03:48 PM
Well, let me think...
These are two issues that crossed my mind immediately after reading your post. I might have not understood your idea perfectly, but my first argument is pretty solid no matter what is your actual intention - x-controls are just GUI elements, not a part of program logic.
07-28-2012 05:03 PM
@PiDi wrote:
Well, let me think...
These are the two main reasons I thought it may not work, but I tried for it anyways
07-28-2012 05:54 PM
- x-controls are made to extend GUI functionality. Implementing network communication inside x-control is the same (or worse) as implementing parallel loops communication using local variables. You can do it, yes, but you shouldn't.
- x-control facade logic is fired in response to user actions on GUI (they are "event-driven"), and should end immediately after this action has been handled. You cannot just drop parallel loop into x-control and let it run its way, this would lock the whole VI using your x-control. So, you would need some logic to actually start another thread (loop) which would be run in different VI (i.e. use asynchronous dynamic call); and then you would still have some means to communicate with this thread... And STILL would have to "simulate" action on x-control to update the data showed in it (if you don't want user to click some "update" button all the time)
These points are correct but by no mean that it shouldn't be done. On the contrary, I think it's a good idea provided it's implemented properly.
Shane.
07-29-2012 11:02 AM
@Intaris wrote:
These points are correct but by no mean that it shouldn't be done. On the contrary, I think it's a good idea provided it's implemented properly.
Shane.
Precicely what I was thinking. I think that this can be done without locking up the GUI. But this is coming from a guy who has never written an x control and only has a general idea of what they are.
07-29-2012 12:31 PM - edited 07-29-2012 12:32 PM
I agree with the "no" crowd here.
@for(imstuck) wrote:
Id like to create an x control that is purely for reading and displaying udp messages. This way I can drop this in different apps and have the communication included...
You haven't really specified what you mean by "network communication". What is the direction?
Only #2 is potentially doable. For example it could (on demand) display some information from a weather service, etc. Since x-controls don't poll, the dsplayed information will be potentially stale until the user operates the x-control once more. So what's the point???
(#1 and #3 will not work, because to act as a server it would need to listen on a well-known port and you will get a conflict once you drop the second instance, because the port is already in use. You would need to listen forever, which would prevent the x-control from completing, stalling the entire code)
X-controls are special. They react even if the VI is in edit mode. (silly example).
Maybe I am completely misunderstanding what you want to do. So please clarify. 🙂
07-29-2012 12:50 PM
I understood this to mean #2 with no user interaction. That is what I thought would be cool. Drop an indicator and get weather updates even in edit mode
07-29-2012 07:02 PM