Aitor Solar Posted February 15, 2007 Report Share Posted February 15, 2007 Let's say you make a XControl of a graph. Graphs are polymorphic (for example, a Waveform Graph can accept 1D or 2D-array data), but the XControl doesn't. Any workaround? Saludos, Aitor Quote Link to comment
Ton Plomp Posted February 15, 2007 Report Share Posted February 15, 2007 QUOTE(Aitor Solar @ Feb 14 2007, 01:23 PM) Let's say you make a XControl of a graph. Graphs are polymorphic (for example, a Waveform Graph can accept 1D or 2D-array data), but the XControl doesn't. Any workaround? Saludos, Aitor Variant? I don't think there is an easy work around since the datatype is defined with the data ability, which is a typedef, and the beauty of typedefs is that they restrict the data type. Moreover you should be able to handle all kinds off data inside your facade VI, quite hard I can imagine! Ton Quote Link to comment
Tomi Maila Posted February 15, 2007 Report Share Posted February 15, 2007 With LVClasses you can pass many kinds of data, but not built-in datatypes. Quote Link to comment
Aristos Queue Posted February 15, 2007 Report Share Posted February 15, 2007 QUOTE(Tomi Maila @ Feb 14 2007, 07:04 AM) With LVClasses you can pass many kinds of data, but not built-in datatypes. Passing different types of data isn't what makes the graph change. It's a compile time decision based on the data type provided. So, no, there is no workaround. Quote Link to comment
Tomi Maila Posted February 15, 2007 Report Share Posted February 15, 2007 QUOTE(Aristos Queue @ Feb 14 2007, 06:06 PM) Passing different types of data isn't what makes the graph change. It's a compile time decision based on the data type provided. So, no, there is no workaround. But you can detect the runtime type of an input. Based on this type you can choose one of different graphs, at runtime. Simply put multiple graphs of different type on a transparent tab control and select which tab to show based on the runtime type of the data. Tomi Quote Link to comment
Ton Plomp Posted February 15, 2007 Report Share Posted February 15, 2007 This is not about the display of the XControl, but about the terminal and datatype of the XControl, and I think Aitor knows his way with Xnodes... Maybe this can be gold pot under the rainbow? Ton Quote Link to comment
Tomi Maila Posted February 15, 2007 Report Share Posted February 15, 2007 QUOTE(tcplomp @ Feb 14 2007, 07:19 PM) This is not about the display of the XControl, but about the terminal and datatype of the XControl, and I think Aitor knows his way with Xnodes... Maybe this can be gold pot under the rainbow? One thing that could work is to force a control on XNode generated front panel visible somehow. By default both the XNode generated code and the front panel elements are all hidden. Tomi Quote Link to comment
Ton Plomp Posted February 15, 2007 Report Share Posted February 15, 2007 QUOTE(Tomi Maila @ Feb 14 2007, 07:52 PM) One thing that could work is to force a control on XNode generated front panel visible somehow. By default both the XNode generated code and the front panel elements are all hidden.Tomi Well now my sick twisted mind kicks in..... What we need is an Xnodes\XControls twin.... It will be kind of hard, but let's handle the xnode do the polymorphism, and convert the data into the generic datatype you'd like to use and port that into the XControl, maybe together with a datatype changed? signalling boolean. One other thought is just a normal polymorphic VI '1' (one) pixel wide stitched to the XControl, and have a merge VI contain both, maybe that is better, but true XControl polymorphism would be wonderfull!!! Ton Quote Link to comment
Aitor Solar Posted February 23, 2007 Author Report Share Posted February 23, 2007 Yes, using an XNode would be great, but we'd need a lot on info about them we still don't have. I've tried a simpler solution, an XControl that is replaced with another one if the input type changes, something very similar to a polymorphic VI. The example is limited to two cases: I32 and String input. Create a new VI and put some of the provided XControls (Str_poly.xctl and I32_poly.xctl) in the front panel. Make them indicators and try to connect an I32 wire to the string XControls and strings to the I32 ones. But is not a solution I really like 'cos it relies on a hidden daemon checking continuosly the XControls. We would need an event fired when something is connected to the XControl, but I think LV doesn't give us something like that . BTW: Keep in mind this is just a proof of concept. Is not perfectly done (for example, if you save and reload a VI with these XControls, the polymorphism will be lost since is included in the init ability) and you'll probably end up with an unstable LV, so be careful. Saludos, Aitor Quote Link to comment
Michael Aivaliotis Posted February 23, 2007 Report Share Posted February 23, 2007 Nice work. QUOTE(Aitor Solar @ Feb 22 2007, 06:18 AM) BTW: Keep in mind this is just a proof of concept. Is not perfectly done (for example, if you save and reload a VI with these XControls, the polymorphism will be lost since is included in the init ability).Saludos, Aitor Init Ability always runs when XControl instance is loaded. The problem is you put your code in the 0.0.0.0 frame. You need to put it in the default frame. Delete the 0.0.0.0 frame altogether. Quote Link to comment
Aitor Solar Posted February 24, 2007 Author Report Share Posted February 24, 2007 QUOTE(Michael_Aivaliotis @ Feb 22 2007, 06:11 PM) Init Ability always runs when XControl instance is loaded. The problem is you put your code in the 0.0.0.0 frame. You need to put it in the default frame. Delete the 0.0.0.0 frame altogether. OK, stupid mistake. I have uploaded an updated version, more robust. Saludos, Aitor 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.