Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/17/2016 in all areas

  1. I put together a series of articles while working on an AF 101 presentation for our local CLD summit. Check them out and let me know what you think or if you have any questions/improvements. Part 1 – The Background Part 2 – The Actor Part 3 – Launching and Communicating Part 4 – Being Productive With Actors Basic Walkthrough – Creating a Logger
    1 point
  2. So this code is not polished at all, but it was something I did as a fun pet project and realize I won't be able to finish it any time soon. It is a ribbon interface done in a way that could be scaled up. Ribbon like UIs have been done in LabVIEW here. But these UI's relied on button controls, to be configured and made a specific way, and if you needed to update tabs, buttons, or groups, it had to be done manually. So I wanted to come up with a way to make a ribbon like UI, but all that was required, was to provide the tabs, groups, and buttons, and the UI would be drawn. The end goal was to make an XControl with value change events when the user presses one of the buttons, but for now this is just a demonstration of what is possible. The idea was the XControl would also be smart enough to only redraw the parts of the image that were changed. Like if I changed the top tab background color it wouldn't have to redraw all the bottom parts of the UI. Here is a video demonstration. Here I show the default settings, then change some of the color and text settings. http://screencast.com/t/daan9D78vqV Some of the challenges that you don't really think about, that the API needs to be able to handle, is the text being of an unknown length, and number of rows. Things like the top tabs needed to be able to expand right, or down as needed, and all other tabs, and images needed to shift to compensate. Same thing when it comes to the button and group text. Here you also have the added complications with the fact that the text might fit in the space already needed, like if the button is wider than the text. Images are scaled using .NET and the GDI resize. This is also where images are combined, since some may have alpha layers, much like the included images do. I knew image scaling might take a while, and wouldn't be the type of thing I would want to redraw as a mouse moved over a button. So for that reason I draw all the button states on startup, and then just combine the appropriate images for when the mouse is over, or down on a group, button, or tab. This means a pretty fast response on the UI but means more memory is needed to hold all the button states in memory. Doing the gradients efficiently for me meant doing them natively in LabVIEW. I found some .NET code that would do it, but much slower than LabVIEW just drawing horizontal lines, and using math to determine the next color of the line. Several times images or parts of images needed to be shifted and translated. Instead of converting a picture back into image data, then performing the move, then converting back, I used the code posted by Norm here. It needed to be updated for a few opcodes but for the most part is fantastic and made the image processing quicker. Other than mashing this into an XControl, I also didn't get around to creating a way to disable or disable and grey out buttons. This would take more image manipulation magic and possibly more images to hold in memory. Since disabled buttons are probably going to be somewhat rare, I thought I might draw these on-the-fly instead of on init like all the other button states. Anyway I hope someone finds something in this helpful, because I doubt I'll be able to do anything with it for a while. Back saved to 2013, and remember this is very unfinished code, be gentle. EDIT: Attachment removed, re-uploaded with example images below.
    1 point
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.