07-09-2021 09:11 AM
I'm attempting to use the LabVIEW web module 5.1 to build a web page.
My web page is going to be a schematic for a fluids system. So, naturally, I need to be able to use lines and shapes and decorations to represent things like tanks and plumbing and off-page fluid connections. (Very LabVIEW-y sounding, right?)
Unfortunately, the web module doesn't have native support for decoration elements. This is making me very sad. Here is the Decorations palette on the web module:
I figured: ok, I'll try to create my own decorations using HTML and CSS! Surely this is the way.
Disclaimer: I have zero HTML/CSS/JavaScript experience. (If I had experience with these things, I suspect that I wouldn't be trying to use the LabVIEW Web Module.)
After a bit of learning and discovery, I've gotten very close to creating my own decorations. However, I'm stumbling at the 5-yard line.
If anyone is able to provide input and suggestions, they would be very welcomed.
Anyways, if you want to add custom shapes to your web page, here is how-ish:
If you do all of this, then you can create some pretty cool things. For example, I made this:
You can see that the "decorations" can be dragged around since they live inside of the blank text box objects.
Unfortunately, this is where I need help.
The screenshots above are from the LabVIEW preview window. When I hit the RUN arrow, this happens:
Both text boxes with CSS shapes in them jump around. 😠
I've tried to play with various options to fix this, but I've had no luck. The box always moves its absolute position when I hit the RUN arrow.
Any thoughts or advice would be great. Surely it can't be this hard to add shapes to a web page in a way that lets me click and drag them around like traditional LabVIEW decorations.
07-12-2021 10:39 AM
I found a related forum post:
https://forums.ni.com/t5/LabVIEW/Decoration-is-missing-in-LV-NXG-web-module/td-p/4031234
Notables:
I've confirmed that the jumping behavior occurs for all UI elements linked to CSS shapes.
I'm definitely at a loss here 😞
07-12-2021 04:09 PM
😉
07-13-2021 09:41 AM
omg, I think I figured it out.
I was including "width" and "height" in my CSS shapes. Example:
.rectangle_shape{
width: 200px;
height: 20px;
border-bottom: 5px solid red;
border-right: 0px solid red;
}
This was "fighting" with the size of the text box:
The box wouldn't jump so long as the width and height matched perfectly.
It also seems that it's possible to remove width and height from the CSS sheet and let these properties get defined by the textbox size in LabVIEW