01-28-2009 12:00 PM
I have a general question about whether there are precautions related to copying and pasting source code. The IDE is a licenced LabWindows 8.1.0 full development package running on XP.
When I started my project, I was able to copy snippets of source code from three different projects in small steps and compile it without error between each step. The resulting project had multiple tab panels of controls, with callbacks that Get and Set attributes for controls on all the other panels, using the GetPanelHandleFromTabPage. It was working fine at that point.
An engineer familiar with other C programming environments then sat down at my desk, opened all three projects and freely copied large sections all at once into my project's source file, and left me to debug the code. I was horrified, because I have previously seen header and uir files become crippled with the kind of cutting and pasting that is commonly done in other programming environments. Sure enough, from that moment on, all the previous tab panels misbehaved, even ones that were unrelated to the edits. All the right-click utilities, such as View Control Callback and Generate Control Callback, misbehaved on each panel except the one the engineer modified. The View Control Callback goes to the wrong place in the source and fails to highlight any name, though the names exist elsewhere. The Generate Control Callback generates to a new, blank source file instead of the one set as the target file.
What are the precautions for copy and paste in Labwindows? My own rule is to let the IDE generate at least the frameworks of all callbacks to ensure the header file is updated correctly. People keep telling me it should be a simple matter to hack these three projects into one, just copy and paste. Am I wrong?
01-30-2009 10:25 AM
Hi Frank,
From what I understand, the UIR file stores the line number of the callback in the source code, so if you were to copy and paste code around, there is a possibility that there would be a problem with maintaining that information. To guarantee that the View Control Callback functionality will work, you are correct, the best way is to just generate the callback and enter your code into the function.