Developing User Interfaces with Event-driven Programming - PowerPoint PPT Presentation

1 / 24
About This Presentation
Title:

Developing User Interfaces with Event-driven Programming

Description:

Title: Slide 1 Author: nmcgarry Last modified by: jphillip Created Date: 4/18/2003 12:11:29 AM Document presentation format: On-screen Show Company – PowerPoint PPT presentation

Number of Views:146
Avg rating:3.0/5.0
Slides: 25
Provided by: nmc77
Category:

less

Transcript and Presenter's Notes

Title: Developing User Interfaces with Event-driven Programming


1
Developing User Interfaces with Event-driven
Programming
2
Session Focus
  • Improve application performance for UI-intensive
    applications
  • Modularize code making it easier to read

3
Overview
  • What are effective user interfaces
  • Developing user interfaces
  • LabVIEW Event Structure
  • Event programming tips

LabVIEW Event Structure
4
Effective User Interfaces
  • Display information intuitively and
    professionally
  • Descriptive labels on controls
  • Limit your VI to 3 standard fonts
  • Provides easy control of the user interface
  • Enter values
  • Change parameters
  • Drag-n-drop

NI Style Guide
5
Elements of Interactive Interfaces
  • Reacting to button clicks
  • Entering data and reacting to it
  • Drag and drop
  • Right-click menus

6
Developing Interactive Interfaces with Polling
  • While loop checks the value of controls
  • Code executes based on the control value
  • Drawbacks of polling
  • Processor intensive
  • Code must process the control value each loop
  • Application can appear unresponsive or sluggish
  • Can miss user actions
  • Reaction of the code is dependent on data flow

7
User Interfaces with Polling Demonstration
8
UI Development with Event-driven Programming
  • Increases application responsiveness
  • Easier to read and manager your code

9
Event-driven Programming Demonstration
10
What is an Event?
  • An event is an action that triggers a change in
    state
  • User initiated
  • button press
  • mouse click
  • OS initiated
  • timeout
  • Software initiated
  • message from another program
  • variable reaches a specific value

11
What is an Event Handler?
  • Mechanism for communicating with Operating System
  • Interprets low-level registry information for
    each event
  • Asynchronous callback routine

12
The LabVIEW Event Structure
Placed on the Block Diagram like all other
LabVIEW Structures
13
Configuring an Event Demonstration
14
Parts of an Event Structure
Event Selector Label identifies currently shown
event case
Timeout - value in milliseconds to wait for
eventsdefault value is 1 (indefinite)
15
Parts of an Event Structure
Event Filter Node - allows you to change or
discard event data for a Filter event before the
event is completely processed
Event Data Node - data unique to each event case
16
Configuring an Event
Right-click
17
Event Specifiers
Front Panel Controlsand Indicators
Available Events
18
Types of Events
Control
This VI
Application
19
Notify and Filter Events
  • Notify Events
  • Notifies LabVIEW that a user action has already
    occurred available only in the Event Data Node
  • Filter Events
  • Validates or changes the event data before the
    user interface can process it preventing the
    change from affecting the VI available in the
    Event Filter Node and Event Data Node

20
Additional Events
  • Right-click Menus
  • Registers events based on right-click menu
    activation or selection
  • Works with user-defined right-click menus or the
    default application menu
  • Drag and Drop
  • Drag and drop data between controls and
    indicators
  • Useful alternative to copy and paste

21
Additional Events Demonstration
22
LabVIEW Event Structure Review
  • Sleeps until an event occurs
  • Executes the appropriate event case
  • Does not implicitly loop
  • Queues all events
  • Executes events in order of occurrence

23
Use Templates for the Event Structure
  • User Interface Event Handler
  • Producer/Consumer (Events)
  • State Machine
  • Parallel Loop VI Architecture
  • Queued Message Handler
  • Producer/Consumer (Data)
  • Combine or Expand Architectures as Needed

24
Event-driven Programming Tips
  • Make sure Event Structures are always in loops to
    handle events
  • Put Latched Booleans inside of the event case
    handling it
  • Programmatic changes DO NOT generate events
  • An event-handling loop is not a state machine
  • Use a Stop event when in a loop
  • Never place an event structure inside of another
    event structure

25
Other Resources
  • Event Driven Programming in LabVIEW
  • LabVIEW Help - Caveats and Recommendations when
    Using Events in LabVIEW
  • NI Style Guide
  • www.ni.com/info - eventdriven

26
Experienced User LabVIEW Intermediate I LabVIEW
Intermediate II
Advanced User LabVIEW Advanced I
Courses
New User LabVIEW Basics I LabVIEW Basics II
  • Skills learned
  • Modular application development
  • Structured design and development practices
  • Inter-application communication and connectivity
    techniques
  • Skills learned
  • LabVIEW environment navigation
  • Basics application creation using LabVIEW
  • Basics of data acquisition and instrument control
  • Skills learned
  • Large application design
  • Advanced development techniques
  • Implementing multideveloper projects
  • Certified LabVIEW Architect Exam
  • Skills tested
  • LabVIEW application development mastery
  • Certified LabVIEW Developer Exam
  • Skills tested
  • LabVIEW application development expertise
  • Certifications
  • Certified LV Associate Developer Exam
  • Skills tested
  • LabVIEW environment knowledge

27
Connect with the LabVIEW Community
28
Questions?Thank You
Write a Comment
User Comments (0)
About PowerShow.com