Search the Community
Showing results for tags 'dynamic'.
Found 6 results
Merge Class Data
CraigC posted a topic in Object-Oriented ProgrammingHello, Bit of an odd one and I am probably doing something fundamentally wrong however I am fairly new to OOP. Essentially I have a hierarchy of 3 items say A, B and C. I have a DD VI called "ModifyUI.vi" in each class and I am calling this VI and its parents in parrallel (Probably not a great idea but it is my end goal). After each "ModifyUI.vi" has completed doing what it needs to I would then like to collect each VI's data as they were all run in parrallel back into the initial class that called them all. I have attached an overview of what I am trying to achieve in a mockup of my problem. I am willing to change tack as long as the same goal is reached (Modify all class data in parrallel). Thanks in advance Craig Lava Temp.zip
Hello, Before, going any further let me answer the question that I know you will ask: "Why would you want to do THAT?" We are creating a LabVIEW instrument driver for a new instrument. The instrument manufacturer wants to provide also an instrument driver in the form of a dll. They are aware that if the DLL is built with LabVIEW the end users will need the LabVIEW RunTime Engine and they are OK with this. (At least for now). So, LabVIEW users will get a LabVIEW palette API installed in their palettes that will let them communicate with the instrument. Other developers would get the DLL directly. We figured that it would be best to "eat our own dog food" and use the same dll we will create for the C developers as the basis for our instrument driver. This way we can test the dll as we go and if there is push back from the instrument manufacturer's customers to move away from requiring the LabVIEW RunTime Engine, we could replace the DLL built in LabVIEW by one created in C and the rest of the LabVIEW palette API code would still be the same. Cool, now, what do you need from the great LAVA community? We have been looking for documentation on how to do this and there is not much we can use. Our main question is What's the best way to configure the function prototype for a DLL built in LabVIEW so that a string (or U8 array) output of unknown size will not require arbitrarily-sized pre-allocation by the caller? Is this even possible? The main problems we have encountered so far: 1) Getting only the first two bytes of a string output from the DLL function --> Solution: even if the DLL function call has the string inputs and outputs defined as "C String pointers", when we call it in LabVIEW we change the function node call parameters definition to expect an array of 8 bits Unsigned Integers. This lets us initialize an array of uint8 of the size we expect and then use the byte array to string from the output. However it requires that we pre allocate an array by initializing the array of uint8. Question: Would defining the string as a "Pascal String Pointer" remove the need to know in advance how large the string needs to be. We haven't been able to make this work. Is the use of Pascal String Pointer recommended? If it is, how should we handle the DLL source code and the "Call Library Function Parameters"? 3) We have found on several NI forum posts reference to LabVIEW.dll calls that could make our life easier by providing us access to the LabVIEW Memory Manager (for example DSNewPtr()). These functions are documented in some places, we even found one of them in the LabVIEW 2012 manual (http://zone.ni.com/reference/en-XX/help/371361J-01/lvexcode/aznewptr_dsnewptr/) Question: Do we need these functions? If we do, would they be used inside the DLL source code or to manage the inputs/outputs of the "Call Library Function Node". If we need them where can we find more documentation about the use of these functions? 4) We are defining the VI Prototypes for our DLL to use "C Calling Conventions" the other option is "Standard Calling Conventions". The help says: Standard Calling Conventions—Sets the function prototype to use standard calling conventions. C Calling Conventions—Sets the function prototype to use C calling conventions. This radio button is enabled by default. Question: Despite the accuracy of the help description ... well ... are we doing the right thing by using the C Calling Conventions? Any help will be appreciated. Thanks in advance for your time, Fab
Accessing the Middle Class Data
John Lokanis posted a topic in Object-Oriented ProgrammingI have a hierarchy of classes. Call them Grandparent, Parent and Child. I have a dynamic dispatch VI in grandparent that child overrides. In the child implementation, I want to access data in the parent class control. The template in the grandparent has two inputs of type grandparent. The dynamic one and a static one. The dynamic one is used to dispatch to the correct child. (this is because grandparent has more than one parent sub class and these have more than one child subclasses) The static one is used to pass in a parent object so the child has access to its data between calls. (the child is actually a message not spawned from the original parent object and therefore does not contain this persistent parent data) What I need to do is cast the grandparent wire to the type of parent so I can access the parent's data. I could use the child to do this but how do I extract the parent class type from the child and use it to cast the grandparent to type parent? I need to do this statically as design time, not at runtime. thanks for any ideas. -John An alternative solution would involve having the child (message) object inherit the data in the parent object so I could access it via property nodes. Not sure if that is possible.
Dynamic UI Elements using HTML & CSS - Thumbnail Grid
Ravi Beniwal posted a topic in User InterfaceWe often need to let our users select an item from a list. When it comes to making UI elements to achieve this that are a bit more sophisticated than a table, listbox or tree, LabVIEW's current capabilities leave a lot to be desired. Here's an alternative using HTML and CSS. The current example provides an interface for selecting an item from a thumbnail grid, similar to Windows Explorer. Run "Thumbnail Grid .NET Browser.vi" or "Thumbnail Grid ActiveX Browser.vi" from the attached code folder. The .NET version provides a cleaner interface as it provides a bit more control over its behavior. You can select any number of images and any size of the pane (read Web Browser control). You can set any thumbnails as disabled, which will appear grayed out. I have included some images for demo from the Open Icon Library. The code calculates the best grid pattern (the one with the smallest aspect ratio) and generates html code for displaying the images as a table and then generates CSS code for styling the elements. The web browser takes care of the visual effects and LabVIEW maps mouse cursor position to the calculated grid pattern for detecting the selected thumbnail. We could get fancier and use web services to trigger a selection, but that may be an overkill for this case. This approach can be extended to displaying dynamically created tabs or list boxes with bigger symbols than the current 16px limit for list box symbols. I will create examples of these over the next few days. The only issue I've noticed with this approach is that every time we change/refresh the browser, we hear the "Start Navigation" sound that is part of the Explorer shell. It may or may not be OK to disable that in all cases. I guess we can find a clean solution as we experiment more with this code. Thumbnail Grid.zip
Firing Events from External VIs
NelsonUWP posted a topic in LabVIEW GeneralI'm trying to create some monitoring software that can monitor 20-30 clones. Each clone does the reading and tracking of a particular unit. I have a central VI that should launch and kill the various clones. I know it's nothing that hasn't been done before and it seems simple enough, but I've been having problems with "Error Code 1: Generate User Event in (name of VI)" which apparently means the Event isn't firing properly. I'm not seeing the error in this set of VIs though, which is good and bad because a) it works but b) I don't know what the problem is when it doesn't. I'm fairly positive that events aren't stored properly in functional global variables. I've uploaded an example of the framework I'm using and I'm looking for some feedback on possible better solutions or how to fool-proof this approach. Obviously I haven't put the innards which monitor the UUT in there yet; baby steps. To run the example all you have to do is open Controller.vi (after opening the project) and then set the Minion number to any number (this would be the UUT #) and set the enum to "Launch". If you click run, a clone will launch and if you click run again the original clone will close and a new one will run again. You can do this for however many minions you want open. To kill a clone, set the enum to "Kill" with the minion # and click run. To kill all clones set the enum to "Mass Destruction" and click run. Mass Destruction only kills clones 0-16 at the moment, however it's easy enough to bump that up. My main thought is that I should fire some sort of central server that each clone registers with and the controller controls that. Maybe I'll give that a go and post it up here later. Dynamic Events With Clones.zip
Dynamic Control Instantiation and Docking
Cyberius posted a topic in User InterfaceHi all, I have a Labview application in which I want the user to be able to create any number of floating panels that could be [value displays/interactive panels/status information]. Different panel types can be different sizes. I also need these panels to be dockable and the dock area must be scrollable if there are too many panels. I have done something similar already, where I clone any number of template VIs. However, this only gets me a fraction of the way. Is there still no way to instantiate controls dynamically? I have played with panes and drag and drop, but this didn't get me far either. The best I have so far is to drag controls into an array, but of course all the controls must be identical in type and size. Is there a way to instantiate a VI from a template and then transfer the created controls from the instantiated VI to the main VI? I have seen the example that does docking with SubPanels, but that doesn't help much either. Many thanks, Christie