How can I display a value in a textbox indicator and a slider in LabVIEW? - labview

Is there a way to link two indicators on a LabVIEW front panel, so that they always have the same value? Right now I'm setting both to the same value every time, but it'd be much easier if there were a way to set up one to mirror the other.

You can make the digital display visible. Right-click on the slider and select "Digital Display" from Visible Items.

There are a few ways to achieve this, depending on how you are trying to display the data.
If you are just trying to update a slider and make a textbox indicator display the numeric value then by right clicking on the slider and selecting 'Visiable Items -> Digital Display' you will have a numeric indicator showing the value of the slider. This can then be repositioned as required. You should see if this meets your requirements as other methods will add complexity to your Block Diagram.
An alternate method would be using a network shared variable and binding the data although I think from your question this would be over kill.
You can also create an event structure to look for a value change event for the slider and update the text indicator accordingly. You would have to be careful how you update the slider as just wiring a value to the slider will not trigger an event for use a property node linked to the slider for the property 'value(signalling)'. Again this may be over the top for your application.

Strictly speaking, no, you can't do that automatically. What you can do is set up an Event Structure and use the Value Changed events for each of the two controls to update the other. Just realize that the slider fires value changed events many times while the user is sliding it around, rather than just one event at the end. That may be what you want in this situation, however.

I think this is not easily done, however there are some possibilities (as discussed).
The general question is why?
You have an indicator with the same info at two places. (or are they actual controls?)
If you have two indicators, just place there terminals next to each other, just remember when you alter one of the two (via a local or by ref) to mimic the action for it's twin.
Using a value change event for both controls should work, just remember that you might get race conditions if you don't process the event directly.
Could describe a little bit further why you need two controls for the same action/value?
Ton

Related

How to show slider current value with Cloudflare Apps UI?

My question is related to the development of a [Cloudflare app][1].
The options allow defining a slider with min and max values. However, when displayed, the slider does not show what the current value is. That's really annoying, especially if the slider controls an offset value where you need to know the pixel value.
Is there a property to control whether or not the current value is displayed?
There is no way to use the slider option format and also have the value be presented. You could use one of the other number types to have the user able to set an option based on a specific number

VB Form Not Holding Format

In the design window, I have my controls formatted one way, but when I run my program, the formatting changes. The window looks larger and the digit button is no longer aligned. I have no clue how to fix this. I am taking an intro level course, so I can't fix this with code. When I wrote my first couple of programs, I didn't have an issue with resizing, but for the last two or three, they never hold their size.
My Program
the above issue please check the anchor tag of each control it should be Top left.
To hold the control position
1 Add panel control to form then dock it to form
2 Add the other
control it will hold the control position as well

LabVIEW disabled Slider is enabled

I have a large problem disabling a slider in LabVIEW. Here is my minimal example:
I have a simple Slider, which is disabled and grayed out if the value is higher than 5. Otherwise the Slider is enabled.
If I drag the slider higher than 5, the Slider gets grayed out. But I am still able to move the slider around and change the value. Only after I dropped the Slider, the Slider is disabled to use.
In my opinion, this is a large bug of LabVIEW. Is there any way to disable the Slider correct during drag?
Thank you for your answers!
Additional information:
Like I said, the snippet is only my minimal example to show the basic problem. In my application the following is happening:
I have s statemachine with a state that enables the Slider and a state that disables my Slider. The state can change every moment, so it´s possible, the user is using the slider at the moment of statechange --> moment of disabling. At this moment the slider should be disabled (it only gets grayed out) directly ... not after releasing it. So limiting the maximum is not real target. I want to prohibit all slider actions for a user.
"Link to question asked on NI Discussion Forums"
As suggested by Alexander_Sobolev on the NI forum (but I promise I thought of it independently!), you can end the slider drag by generating a mouse up event. On Windows you can do this with Simulate Mouse.vi from the NI site, which calls mouse_event from user32.dll:
Note that one of that VI's mouse position inputs is erroneously marked as 'Required'; I fixed that before creating the code above.
I do think this is a UI technique that should only be used if it's really justified by the requirements of the system, and if the users will understand why it works like that; otherwise it could make for a frustrating and annoying user experience. I don't think it's a bug, rather a design decision, because the opposite behaviour could be equally undesired in other circumstances.
I guess you could set the slider value to 5 inside the case structure, alongside the greying out, by adding another property node. This should keep the slider stuck at 5, if the user tries to pull it above.
This appears to be strange behavior as the Value Change event is triggered while the mouse button is held down even when the control is Disabled & Grayed Out.
One way I can think of to limit the value would be to update the Data Entry Limits Maximum property for this control and setting the Response to Value Outside Limits for Maximum to be Coerce.

Optimizing QListView update

I'm writing a logging application which is using a QListView with custom QStandardItems to display the log data. I have implemented filters in the app that will color the matching rows differently and when changing a filter I have to manipulate every item in the list, which after a while gets very slow. I'm not sure what's causing this yet, but I wonder if it could be that it repaints after every item change. If that is the case, could I somehow tell QT to not repaint until I'm done manipulating all the items?
Thanks for any help!
For helping others, I could add that I fixed this by implementing my own view that handles the paint event itself and only paints the rows currently visible on screen. This makes it extremely fast and no internal QT view seem to be able to do something similar.

Adding drag and drop functionality to metro style app buttons with C# and XAML

I'm trying to implement a sort of drag functionality into my app. As a simplistic example imagine I have a 2x2 square of buttons, so four buttons total. Clicking a button will perform some other functionality however I want when they hold and drag one of these buttons for it to do something else (ideally if you drag one button and drop it while in the space of another button the two buttons will swap places, as long as I can get dragging and dropping working the swap should be easy).
I've done some research and followed a few tutorials but seemed to get errors at one step or another with all of those. It seems ListViews and GridViews have some drag and drop functionality in them already , but I had trouble properly arranging my buttons (there are many more than four and they are in very specific positions, like a diagram) inside these views, let alone getting drag and drop working with them.
How would I go about doing this? Ideally I could just tag these buttons as draggable, and then on a drag-drop event check for a drop position, then if the position is valid perform a swap method. I just can't seem to figure out how to make them draggable or how to have an event that checks a drop position.
Thanks.
Easy peasy, create a custom control that looks the way you want it to, set ManipulationMode to TranslateX|TranslateY, handle manipulation delta events to update positioning with something like a Canvas or TranslateTransform and when manipulation completes - either make it click or animate to the new position. From my experience - getting any other manipulations to work with a regular Button class just isn't working and since a button is a really simple control - it is easier to create your own than try to extend the existing one in such cases.