BrokenArrow Posted February 19, 2007 Report Share Posted February 19, 2007 Hello all! My first post , although I've lurked a bit. This is a great site, and I look forward to participating. On to the question: I'm looking for tips and tricks, examples, and methods of creating custom controls. In my position, I have to do this a lot, and have had some success, but the code is messy. A typical example of something I've implemeted a dozen times is a simple octagon, which will turn red on the side you click on. In my case, this simple looking device contains multiple custom controls, transparent buttons, and Visible property nodes. This takes up a lot of space, and I'm wondering if thinks there's an easier way. I'll post my octagon when I'm on my other computer. Anyway, any tips are appreciated, or links to examples. Please note I use 7.1 as default because I don't always have access to 8.X. - Richard Quote Link to comment
Jim Kring Posted February 19, 2007 Report Share Posted February 19, 2007 Richard, Welcome to LAVA! I'm sure you'll find this a great place to discuss user interface and custom control tricks. In fact, Michael (LAVA's admin) is a wizard in this area (as are many of LAVA's members) and, every once in a while, he shares some of his secrets. <shameless plug> Also, if you keep your eye on LAVA's general annoucements forum, we'll be posting links to periodic articles written by Michael (and others) about how some VIPM user interface features are implemented. In the future, this will include some exciting stuff on XControls. </shameless plug>Cheers, -Jim Quote Link to comment
crelf Posted February 19, 2007 Report Share Posted February 19, 2007 QUOTE(BrokenArrow @ Feb 19 2007, 03:23 AM) Hello all! My first post , although I've lurked a bit. This is a great site, and I look forward to participating. Welcome to LAVA - great alias! http://lavag.org/old_files/monthly_02_2007/post-181-1171823729.jpg' target="_blank"> Quote Link to comment
Jim Kring Posted February 19, 2007 Report Share Posted February 19, 2007 QUOTE(crelf @ Feb 18 2007, 10:35 AM) Welcome to LAVA - great alias! Any relation to this person? Quote Link to comment
Yair Posted February 19, 2007 Report Share Posted February 19, 2007 You might wish to check out the picture control which can allow you to do basically anything you want. There are several threads both here and on the NI forums with all kinds of examples. In the case of your octagon example, I would suggest making the background of the control transparent and use the Mouse Down event to feed a reference and a position into a subVI which will control this. If you really want to abstract this, you can run this is as a seperate process which will register the mouse down event, but you will also need some way to stop the process. This can allow you to create any kind of control you like, but you won't see the control at edit time and the control itself will not have any value. Quote Link to comment
BrokenArrow Posted February 19, 2007 Author Report Share Posted February 19, 2007 QUOTE(Jim Kring @ Feb 18 2007, 02:25 PM) Any relation to http://forums.ni.com/ni/view_profile?user.id=5189' target="_blank">this person? Yes, that's me Jim! Just never really ventured outside NI too much until now. Glad I did -- responses on a Sunday! BTW, I'm a big fan, and appreciate your response. VIPM rocks! ------------- Thanks for the responses. Crelf, my run arrow is broken more often than not, hence the name. -------------- Yen, I've used the MouseDown event in the past, but it gave me trouble on EXE's. I think it had to do with resizing the window before I made the VI - the mouse no longer had a reference. That experience put a bad taste in my mouth, and I haven't gone back, but I'm willing to try again. My upcomming projects will involve schematic-based user controls --- the "buttons" will look nothing like buttons -- so the Mouse Down is a good vehicle for that. Thanks for reminding me. The Picture Ring is great, but you can't "click on it". I hope to have my Octagon downloaded soon so you guys can laugh at.. I mean help me Quote Link to comment
Jim Kring Posted February 19, 2007 Report Share Posted February 19, 2007 QUOTE(BrokenArrow @ Feb 18 2007, 12:18 PM) Yes, that's me Jim! Just never really ventured outside NI too much until now. Glad I did -- responses on a Sunday! BTW, I'm a big fan, and appreciate your response. VIPM rocks! That's great! I'm sure you're going to love it here, outside of the walls of ni.com (LAVA is all about fun, which is why we love to hang out here, on the weekends). That said, make sure to keep an eye out for http://forums.lavag.org/Rusty-Nails-f87.html' target="_blank">Rusty Nails Thanks for the kind words -- there will surely be many more shameless plugs to come, but I'll always try to keep them of very high-value Cheers, -Jim Quote Link to comment
Yair Posted February 19, 2007 Report Share Posted February 19, 2007 QUOTE(BrokenArrow @ Feb 18 2007, 10:18 PM) ...responses on a Sunday!Don't beat the NI forums. This place is usually more active over the second half of the weekend, but there are some users there who will post answers in the weekend as well.QUOTE Yen, I've used the MouseDown event in the past, but it gave me trouble on EXE's. The Picture Ring is great, but you can't "click on it". I'm not sure which problem you've had. For detecting click positions you should use the front panel coordinates you can get from the property nodes and the position and size of the control itself. The size and position of the window should have nothing to do with it. Note that I refered to the picture control, not the picture ring, but in any case, even if you did mean the picture control, you can most definitely "click on it", you just need to use the data from the mouse down event to find out where. If by "click" you mean that it is not a control which will respond at all times to your interaction, you are absolutely correct (although maybe it would work with XControls. I don't have any experience with them myself). Quote Link to comment
BrokenArrow Posted February 20, 2007 Author Report Share Posted February 20, 2007 QUOTE(yen @ Feb 18 2007, 05:18 PM) Don't beat the NI forums..... T Wouldn't dream of it! That forum has saved me time and angst more times than I can count. QUOTE(yen @ Feb 18 2007, 05:18 PM) I'm not sure which problem you've had. For detecting click positions you should use the front panel coordinates you can get from the property nodes.... Nope, didn't do that. It ws the physical resizing of the window, and moving of some controls that caused my mouse clicks to be ill-received once I EXE'd it all. Had I used PN's, I'd been golden. =================== OK, so attached is a sample of a custom control that is in one of my (older) programs. I've extrated the fluff and esoteric junk, and left it with just the basic octagon I mentioned. This is pretty typical Property Node Hell that I encounter when doing this stuff. There's NINE total custom controls, consisting of the basic octagon and eight red lines that appear on the octagon as things are selected. The important feature (and the hardest to do) is to let the user click on any side of the octagon to select that side. The users don't like to select from a drop-down box - which is easy. Anyway, you'll get the idea. How would a "real pro" do this? Richard Quote Link to comment
Aristos Queue Posted February 20, 2007 Report Share Posted February 20, 2007 On your original question of custom controls: In LV7.0 and later, open Example Finder and search for "animated gifs". There are examples showing integration of animated gifs into custom controls. Just one of many fascinating things you can do with custom controls, but one that is less well known. Quote Link to comment
Yair Posted February 20, 2007 Report Share Posted February 20, 2007 QUOTE(BrokenArrow @ Feb 19 2007, 03:50 AM) How would a "real pro" do this? That doesn't look all that bad. If you could encapsulate it into a subVI using references it will be out of your way.XControls are probably another option, but I have no experience with them. As I said, I would probably use the picture control to do this. You will need a VI which draws the octagon (with the ability to have 0 or more lines red) and a VI which will tell you which line you clicked on (if any). This would require some initial work, but you would probably be able to reuse some of the VIs for other work with the picture control. QUOTE(Aristos Queue @ Feb 19 2007, 12:33 PM) In LV7.0 and later, open Example Finder and search for "animated gifs". I have seen several VIs with embedded animated GIFs, but I can not find the example you're talking about. Can you upload it? Quote Link to comment
Aristos Queue Posted February 20, 2007 Report Share Posted February 20, 2007 QUOTE(yen @ Feb 19 2007, 01:20 PM) I have seen several VIs with embedded animated GIFs, but I can not find the example you're talking about. Can you upload it? See correction to my earlier post. Quote Link to comment
BrokenArrow Posted February 20, 2007 Author Report Share Posted February 20, 2007 Thanks to all - excellent suggestions - you've got me thinking outside the box a little. I still think the transparent buttons on top of custom indicators is the most obvious route, although probably the most messy insofar as the sheer mass of back panel things to keep track of. I have, in the past, bundled these things into VI's, but the references are almost as clumsy, and editing is a chore. Also, there's the anti Property Node (cousin to anti Local Variable) thing nagging at me. Ah I see Lava has it's own User Interface section - should have put this there! <noob> Anybody want to make my vi :thumbup: prettier? Quote Link to comment
Darrell Posted April 6, 2008 Report Share Posted April 6, 2008 Bob, I don't know if this is still on the table or not, but that's exactly what I'm looking for. Quote Link to comment
Michael Aivaliotis Posted April 7, 2008 Report Share Posted April 7, 2008 This is pretty much what the User Interface forum is for. We also have an XControls category and a User Interface category in the CR. We also have User Interface Portal on the Wiki which includes content on XControls. If anyone has any techniques or ideas to contribute along these lines please use the above mentioned resources to post your content. Especially the Wiki. 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.