Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lezione 12 Proprietà degli oggetti

Similar presentations


Presentation on theme: "Lezione 12 Proprietà degli oggetti"— Presentation transcript:

1 Lezione 12 Proprietà degli oggetti
Obiettivi di apprendimento: A. I property nodes B. Proprietà di graph e chart E. How to use control references F. About LabVIEW run-time menus G. About intensity plots Page 2-1: Remind the class that they were briefly introduced to clusters in the graphing exercises in the Basics I course. This lesson will cover: The definition of clusters. Some cluster functions. How to use error clusters. How to convert clusters to arrays. Using a Boolean cluster as a menu State machines How to do arithmetic with clusters using polymorphism. Approximate time to complete lesson: Lecture: 55 min. Exercises: 1 hr. Additional/Optional Exercises: 1 hr. Total: 2 hrs, 55 min.

2 Property Nodes Le Proprietà sono le “qualità” di un oggetto
I Property nodes permettono di impostare e leggere programmaticamente le proprietà di un oggetto del front panel, incluso il valore Esempi di proprietà: Colori di un oggetto del front panel Visibilità di un oggetto del front panel Menu selections per un ring control Scales e cursori dei graph Dimensioni e posizione dell’oggetto Page 4-2: Attributes are all the qualities of a front panel object, except for the data it contains. With attribute nodes, you can set or read such attributes as foreground and background color, data formatting and precision, visibility, descriptive text, size and location on the front panel, and so on. Read examples of attributes from the slide.

3 Creare Property Nodes Right-click di un oggetto del front panel o del suo terminale nel diagram: Create >> Property Node Uso dell’Operating tool per selezionare quale property leggere o scrivere Page 4-2: To create an attribute node for a given front panel object, pop up on either the object on the front panel or its associated block diagram terminal, and select Create >> Attribute Node. If the front panel object had an owned label associated with it, the attribute node will also have that label. You can change the attribute node’s label. Note that the label of the Attribute node does not need to be the same as the label for the object, although keeping them the same enhances readability of the block diagram. A default attribute will be displayed. To change to a different attribute, use the same procedure as with local variables: Pop up on the node and choose the desired attribute from the Select Item menu, or click on the node with the Operating tool and select a new item.

4 Uso dei Property Nodes Right-click sul property node per selezionare Read o Write Si possono aggiungere terminali ridimensionando il property node Alcune proprietà sono clusters - usare le funzioni Bundle e Unbundle Le Proprietà in un singolo property node sono aggiornate top-to-bottom Pages 4-2 to 4-5: After you have selected the desired attribute of the front panel object, you can either set (write) the attribute or read its current value (similar to local and global variables). To change from write to read, follow the same procedure as for variables. Pop up on the node and select Change to Read or Change to Write. Some attributes are read only. To access several attributes at once, resize the node to display additional terminals and then change to the correct attribute (similar to local variables). Some attributes are bundled together into clusters. You will need to Bundle attribute values together when writing these attributes and Unbundle them when reading (explain the example on the slide). Attribute nodes can have more than one terminal; thus, they can affect more than one attribute of a front panel object. The reads and writes are executed in top-to-bottom order in multiterminal attribute nodes.

5 Uso del Context Help La finestra del Context Help e le Online Reference sono utili tools nell’uso dei property nodes Con il Context Help attivo, passare il cursor sulle proprietà per vederne le caratteristiche Page 4-5: There are dozens and dozens of attributes for the various front panel objects. We will not have time to cover all of them in this course. The Help window contains useful information for implementing attribute nodes. With the Help window active, pass the mouse cursor over the terminals of an attribute node. The window will display a summary of the information relevant to the attribute under the cursor. Mention that the online reference also discusses the attributes and their parameters for each type of object in detail.

6 Properties comuni Visible Property Rendo l’oggetto del front panel visibile o invisibile Disabilita l’uso del control senza modificarne l’appearenza Disabilita l’accesso all’oggett e lo rende grayed-out Imposta o legge il key focus – se TRUE, il cursore è attivo all’interno di un oggetto numeric o text Disabled Property Pages 4-6 to 4-7: Some attributes are common to all LabVIEW front panel objects. We will discuss these. Read the attributes from the slide and explain the wiring. Key Focus Property

7 Properties comuni Impostano o leggono la locazione di un oggetto nel front panel Cluster di 2 Long Page 4-7: Read the attributes from the slide and explain the wiring. The Position attribute takes units of pixels for the left and top of the object, relative to the left and top edges of the panel window. The Blinking attribute causes the object to flash. The blink rate and colors can be set from the LabVIEW preferences. Causa il lampeggio di un oggetto se TRUE Blink rate e colori configurati nelle LabVIEW Preferences Blinking Property

8 Properties comuni Restituiscono i confini di un oggetto del front panel in Pixels (Read-only property) Cluster di due valori: Width e Height Bounds Property Value Property Impostano o leggono il valore di un oggettodel front panel Page 4-8: If students ask about the sizing attributes, explain that there are usually at least two attributes that deal with control/indicator size information. All objects have a read-only Bounds attribute, which provides the location and size of the bounding rectangle of an object. The bounding rectangle is the smallest rectangle that completely contains all of the control’s visible parts, including its owned label. Other size attributes that can be set depend on the object.

9 Numeric Properties Impostano o leggono il format and precision
Format and Precision Property Impostano o leggono il format and precision Entrambi i valori impostati con un cluster, o individualmente utilizzando unsigned byte integers Format può essere notazione: Decimal, Scientific, Engineering, Binary, Octal, Hex, o Relative Time Page 4-9: There are specific attributes for handling numeric objects. For example, Format and Precision. The Format attribute takes the following values. These are also listed in the manual: 0 Decimal Notation 1 Scientific Notation 2 Engineering Notation 3 Binary Notation 4 Octal Notation 5 Hexadecimal Notation 6 Relative Time Notation

10 Colors for False states
Boolean Properties Strings Property Impostano le stringhe per True, False, True Tracking, e False Tracking Impostano colori di sfondo e primo pianoper True, False, True Tracking e False Tracking Colors Property Pages 4-9 to 4-10: Read the attributes from the slide and explain the wiring. Students are easily confused by True and False Tracking for Boolean controls. Explain the concept as follows: When a Boolean control’s mechanical action is set to Switch When Released or Switch When Pressed, the control is suspended in a transitional state while the mouse button is pressed. If you change the control from True to False, the control is in the True Tracking state while the mouse button is pressed. If you change the control from False to True, the control is then in the False Tracking state while the mouse button is pressed. The True Tracking and False Tracking strings and colors are displayed during these transitional states. You may want to drop a Boolean control onto a LabVIEW panel to explain the tracking states. Colors for True states Colors for False states

11 String Properties Display Style Property Impostano o leggono come i caratteri in una stringa devono essere mostrati: Normal, ‘\’ Codes, Password, o Hex Display Pages 4-11 to 4-12: Read the attributes from the slide and explain the wiring. Display Style takes the following values: 0 Normal Display 1 ‘\’ Codes Display 2 Password Display 3 Hex Display

12 Esercizio Realizzare un VI che da programma modifica le proprietà position, disabled e value degli oggetti del front panel Approximate time to complete: min. Pages 4-13 to 4-16: This exercise uses the new Blinking attribute, as well as the Visible and Disabled attributes. Remind the students that they can test the VI by using the Operator tool to set the value of the large Boolean control before running the VI. (The Boolean control is called Verified, and is either red with the text “Access Denied” or green with the text “Access Granted”).

13 Graph and Chart Properties
(Graph only) Pages 4-17 to 4-19: Attribute nodes especially enhance the programmatic flexibility of graphs and charts. Read from the slide. You might want to create a graph and show how to enable a cursor for it or how to resize the plotting area. To explain the difference between Cursor Position and Cursor Index, create a graph of 10 random numbers, but adjust the x-axis so that the first point occurs at an x-value of 5 and the x-increment is 10. Then show how the cursor position reflects the x and y values of a point, but the cursor index corresponds to the index of the array point the cursor is on. Make sure the students understand the Active Plot and Active Cursor attributes. Le funzionalità di graphs e charts sono controllabili con i property nodes.

14 Graph and Chart Properties
X (or Y) Range Properties Comprendono Properties per Colore del grafico Informazioni sull’asse X e Y Visibilità delle palettes Cursori X (or Y) Range – impostano o leggono il range e l’incremento di un asse specifico Pages 4-17 to 4-19: Attribute nodes especially enhance the programmatic flexibility of graphs and charts. Read from the slide. You might want to create a graph and show how to enable a cursor for it or how to resize the plotting area. To explain the difference between Cursor Position and Cursor Index, create a graph of 10 random numbers, but adjust the x-axis so that the first point occurs at an x-value of 5 and the x-increment is 10. Then show how the cursor position reflects the x and y values of a point, but the cursor index corresponds to the index of the array point the cursor is on. Make sure the students understand the Active Plot and Active Cursor attributes. Plot Area Size Property Impostano o leggono la dimensione dell’area di disegno del graph o chart in pixels

15 Graph and Chart Properties
Active Plot and Plot Color Properties Impostano o leggono il colore o il grafico attivo Properties per la posizione del cursore Cursor Properties Pages 4-17 to 4-19: Attribute nodes especially enhance the programmatic flexibility of graphs and charts. Read from the slide. You might want to create a graph and show how to enable a cursor for it or how to resize the plotting area. To explain the difference between Cursor Position and Cursor Index, create a graph of 10 random numbers, but adjust the x-axis so that the first point occurs at an x-value of 5 and the x-increment is 10. Then show how the cursor position reflects the x and y values of a point, but the cursor index corresponds to the index of the array point the cursor is on. Make sure the students understand the Active Plot and Active Cursor attributes.

16 Control References E’ un refnum a un control o indicator
Usato per accedere Ai property nodes all’interno di un subVI Creabile tramite right-clicking sul terminal del control e selezionando Create >> Reference

17 Riepilogo Property Nodes sono strumenti potenti che consentono di manipolare programmaticamente le caratteristiche degli oggetti del front panel Si possono istanziare i property nodes tramite la voce Create del menu contestuale di un object o del suo terminal Si possono creare diversi property nodes per un singolo object, in posizioni diverse del diagram Si possono usare i Control References e i refnums per accedere ai property nodes all’interno di un subVI Page 2-36: Do not immediately display this slide. Suggested questions for review: How does a cluster differ from an array? Where might you use a cluster? How are error clusters and handlers useful? What structure can we use to control program flow? Review the points on the slide.


Download ppt "Lezione 12 Proprietà degli oggetti"

Similar presentations


Ads by Google