I'd like to use increment/decrement buttons in numeric control field to quickly span wide range of values. In order to do this I would like increment/decrement buttons to work as multiply/divide by constant.
One example would be to choose resistor values. In order to choose values in E12 series one would start with 1 and multiply it over and over by 10^(1/12). 12 being how many values per decade you need.
Is there a way to change the function of up/down buttons or do I need to write my own control?
Keeping it simple, just have the numeric control as an integer (say N), and wire up 10^(N/12).
You can do this by listening to "Value changed" event, that detects if increment or decrement was used, and force the appropriate value:
LabVIEW 2010 example VI
If you want the user to choose from a fixed list of values like the E12 resistor series, consider using a ring or enum instead of a numeric control (the list in a ring can be changed at runtime, the list in an enum cannot). Use the value of the ring or enum to look up the numeric value from an array.
If you want the user to be able to type an arbitrary value in the numeric control but also use increment/decrement buttons to scale the value upwards or downwards, you could use a numeric control whose increment/decrement buttons are visible but hide the numeric entry field behind a second numeric control with no buttons. Use the Value Changed event for the hidden control as shown in CharlesB's answer to update the value in the visible control when the user increments or decrements the hidden control.
Related
I made this boolean array.
I want change the color of first boolean component as red, and second as blue.
This picture is what I want.
But when I change color property, three booleans change their color with together.
Is there any way to change color of boolean components, respectively?
Short answer: Just replace the boolean with a color box, as shown in the links in the other reply. It will simply be an array of color boxes instead of an array of booleans.
Long answer: An Array control contains an inner element control. The only property that can differ between elements of the array is the Value property. All other properties are rendered identically across elements of the array. If you need to differentiate the elements based on something other than the Value, you need to either use a different control that renders the graphical aspect that you want as its Value (i.e. replacing the Boolean with a Color Box) or you need to break out the N elements that you want to display as N separate independent controls and manage the updating of the display by yourself through code on the block diagram. This generally means creating your own scrollbar control or numeric control for controlling the index of the array.
You can always try to change your approach a little, try using clusters and if you need to use array, then create array of clusters. Here and here are similar subjects that should help you solving the problem with colors.
How could I change max and min values in control "fill slide" by code?
Here is my program and it should take max and min values from CSV file and change scale range in fill slide's properties. How could i get access to fill slide's properties?
https://drive.google.com/file/d/0B7eFfQuRzPgASHQtNTY0LVpmY0k/view?usp=sharing
In the diagram, right click on the control and create a property node. Select the Data Entry Limits property, min and max can be set. The property node must be writable to set properties.
after creating property node, right click on it, choose Properties, Scale, Range, and Minimum (or Maximum) to set the visible data range for the fill slide. Let me know if you need more help.
In VB Win-forms Application a NumericUpDown Control is used for only to scroll numbers. Its definition is:
The Windows Forms NumericUpDown control looks like a combination of a text box and a pair of arrows that the user can click to adjust a value. The control displays and sets a single numeric value from a list of choices. As Shown here.
I want to use strings instead of numeric values. For example, Grades: "A","B","C", etc. I think I will need to use UserContorl to code another custom "StringUpDown" Control.
You can't add String values to Numeric Drop down. instead for this you can use DomainUpDown here is the code to place a DomainUpDown in your form that contains A - Z characters
Dim domainUpDown1 As DomainUpDown
domainUpDown1 = New System.Windows.Forms.DomainUpDown()
For i As Integer = 65 To 90
domainUpDown1.Items.Add(Chr(i))
Next
Controls.Add(domainUpDown1)
Note : This control is available in Tool box also
You can change values using the ByRef=""
e.g. RefValues="Red;Blue;Green;Brown"
Hope this is what you were looking for
Link: mindStick
i have a listbox that contains the words "week1", "week2", ..... all the way up to "week52" and when i select a week from the listbox it will retrieve a value from a mysql database that will represent a progress bar value. my progress bar has a range of 0-120 and i would like to have all the weeks that have values higher than 100 to be highlighted or marked somehow, in the listbox. so my question is, "is there a way to set the background color of certain weeks in the listbox to orange based on the value that they represent on the database?
for example for "week1", the value is 114, so when the listbox loads, i want the background color of the item "week1" in the list to be orange (indicating that it's current value is higher than 100)? i know that this requires me to implement a user defined drawing function for the listbox items but i dont know where i would even start. i would like this to be somewhat automatic so that it checks the values and changes the background colors of any value higher than 100, instead of me specifying a name of the item.
Thanks in advance!
I don't believe you can do this with a Listbox (at least not without creating your own implementation/subclassing/overriding/whatever of a Listbox).
Pretty sure you could do it with a ListView (in Detail mode), though, if that helps.
In the context of a data-bound ComboBox whose ValueMember and DisplayMember properties are appropriately set:
Is there a difference between the SelectedIndexChanged and the SelecetedValueChanged events? Are they fired simultaneously when an item is selected from the drop-down list of the ComboBox?
Well, just because your index changes doesn't necessarily mean that your value must change.
This also may not be the most realistic scenario because design-wise this implementation would be bad.
Let's say you are displaying a ComboBox where you are displaying body parts. However, you may be exporting or storing this information in a format mapped to integer values. Therefore, your ComboBox may display "Left Arm" and "Right Arm" which are mapped to a value of 5, which defines (5 = Upper Body) in its mapping. Then, if the user switched "Right Arm" to "Left Arm" there is no value change; however the SelectedIndex has changed.
So I guess it is a case by case basis, but these events surely could function differently depending on the case.
The difference is that SelectedItemChange will be -1 if you edit the combobox ea its not part of the indexed values. However as soon as you start typing in the combobox it will fire value change event.
ea you could use value change to fire events that will reformat text input in a domainupdown control. And if someone edits a domainupdown control and it value becomes -1 you could collect new items to its list (by press of a button and using domainupdown.text property.