LaurenH Posted January 11, 2009 Report Share Posted January 11, 2009 Attached is a project I started and quickly realized that I’m not sure how to efficiently create an interactive user interface, and currently programming this is quite tedious. How can the attached project be written faster and in a more efficient way? Task: 1 – Create any number of buttons (or other front panel objects) by reading an Excel (or table) in which the number of rows is the number of buttons that need to be created. The first column is the text shown on those buttons. The second, third, forth… column could be tied to that button (i.e. concatenate strings and saving it to the buttons' description). 2 – Allow the user to click or hover their mouse over a button (or other front panel objects) and have information “pop up” or show information that is related to that button (…). LabVIEW Version: I wrote this in 8.6 and saved for 8.0. I can post an older version if you would like to help. I currently have access to versions: 6.1, 7.0, 7.1, 8.2.1, 8.5.1, and 8.6 through my work. Can anyone show me or point me to techniques to make programming this faster? Thank you in advance, Lauren Quote Link to comment
Francois Normandin Posted January 11, 2009 Report Share Posted January 11, 2009 Hi Lauren, there are indeed tricks you can use to simplify your coding. One of those is to use a cluster containing all your buttons. You can then iterate the cluster's controls references and set the boolean text, description and tip strips. There are probably more, including dynamic event registration, but I'll leave that to other to explain. However, if you'd like to create an undeterminate number of buttons automatically from file, I'm afraid you'll need "Scripting" to do this. QUOTE (LaurenH @ Jan 10 2009, 06:32 PM) Task: 1 – Create any number of buttons (or other front panel objects) by reading an Excel (or table) in which the number of rows is the number of buttons that need to be created. The first column is the text shown on those buttons. The second, third, forth… column could be tied to that button (i.e. concatenate strings and saving it to the buttons' description). See the modified files... I've created a cluster typedef with your button position. You can then fill from Excel file content. Download File:post-10515-1231632726.zip QUOTE (LaurenH @ Jan 10 2009, 06:32 PM) 2 – Allow the user to click or hover their mouse over a button (or other front panel objects) and have information “pop up” or show information that is related to that button (…). Use the "TipStrip" property. That's exactly what it does. When you hover over the buttons, "tipStrip" text is displayed. Quote Link to comment
Jeffrey Habets Posted January 12, 2009 Report Share Posted January 12, 2009 For what you seem to be doing here (do the same action with just a slight difference depending on what item is selected) I think buttons are the wrong controls to use for your use-case. Typically I would use a (multi-column) listbox (if you also want to categorize, use a tree-control) and fill it with the data from your Excel sheet. Then, the only event you need to catch is the double-click in the list and read the values from the clicked row. Quote Link to comment
shoneill Posted January 13, 2009 Report Share Posted January 13, 2009 QUOTE (Jeffrey Habets @ Jan 11 2009, 12:31 PM) For what you seem to be doing here (do the same action with just a slight difference depending on what item is selected) I think buttons are the wrong controls to use for your use-case. Typically I would use a (multi-column) listbox (if you also want to categorize, use a tree-control) and fill it with the data from your Excel sheet. Then, the only event you need to catch is the double-click in the list and read the values from the clicked row. I did something which would probably work quite well for something like this. I had an application with a large number of images to be processed which belonged to a single production run wafer. I needed to read in the images, perform analysis on them and give some kind of a visual feedback. I did this by using an image control, drawing the objects at the appropriate positions (after reading the size of the picture visible and using these as bounds). It's then possible using the "mouse move" and "mouse down" and so on Events to make the individual objects (not in a LVOOP sense) dance as you would like. For me, it showed a preview of the image being analysed by simple moving the mouse over the wafer and at the same time highlighting the relevant object in the picture. Clicking on an item highlighted it and locked the display to that image until un-selected..... The whole thing took me a few days to implement, but if done right (as a component communicating asynchronously) then it's very re-usable. Depending on the functionality sou require, you can link all kinds of events to respond to user interaction. It requires a bit of advanced programming, but the results are cool. A logical step is making the displayed objects real LVOOP objects (Draw, Highlight methoids and so on) to allow for custom displays. Shane. Quote Link to comment
LAVA 1.0 Content Posted January 13, 2009 Report Share Posted January 13, 2009 QUOTE (LaurenH @ Jan 10 2009, 06:32 PM) Attached is a project I started and quickly realized that I'm not sure how to efficiently create an interactive user interface, and currently programming this is quite tedious. How can the attached project be written faster and in a more efficient way?Task: 1 – Create any number of buttons (or other front panel objects) by reading an Excel (or table) in which the number of rows is the number of buttons that need to be created. The first column is the text shown on those buttons. The second, third, forth… column could be tied to that button (i.e. concatenate strings and saving it to the buttons' description). 2 – Allow the user to click or hover their mouse over a button (or other front panel objects) and have information "pop up" or show information that is related to that button (…). LabVIEW Version: I wrote this in 8.6 and saved for 8.0. I can post an older version if you would like to help. I currently have access to versions: 6.1, 7.0, 7.1, 8.2.1, 8.5.1, and 8.6 through my work. Can anyone show me or point me to techniques to make programming this faster? Thank you in advance, Lauren Hi Lauren, First thing we should settle is the question "Are the req's bounded?" eg Is there a limit to the number of options so we can use an "provide more than enough and only show what we need approach" (this could be done with LV objects, controls cluster that are configured and shown when required) OR Are the req's unbounded in that we have to support everything and can never anticipate a worse case. These types of apps can be developed using a Picture Control but they require much more work since we can not take advantage of the functionality built into the LV objects. So.... Bounded on un-bounded? Ben 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.