Presentation is loading. Please wait.

Presentation is loading. Please wait.

Fundamentals of GUI Programming. Objectives: At the end of the session, you should be able to: describe the guidelines that are used for creating user-friendly.

Similar presentations


Presentation on theme: "Fundamentals of GUI Programming. Objectives: At the end of the session, you should be able to: describe the guidelines that are used for creating user-friendly."— Presentation transcript:

1 Fundamentals of GUI Programming

2 Objectives: At the end of the session, you should be able to: describe the guidelines that are used for creating user-friendly graphical user interfaces; ascertain steps in creating applications; define variables and data types; and construct and execute applications by correctly following syntax and semantics.

3 Guidelines for GUI Design Give priority to the user Design for clarity Design for consistency Provide visual and audio feedback Provide keyboard support Use of appropriate controls

4 KEYBOARD Support

5 Steps in Creating Simple Applications Create the User Interface (GUI) Set the Properties of the Objects Enter the appropriate Source Code Run the Program

6 Create the User Interface

7 Set the Properties of the Objects

8 Enter the Source Code

9 Run the Program

10 GUI Controls Used to interact with the application. A control is defined by: – Property – Event – Method

11 Property It refers to the characteristic or parameter of a control –Control’s properties determine its name, color, size, location and appearance on the screen

12 Types of Properties Properties of a control can be classified into the following categories: –Design time property - This type of property can be changed only during the design phase of the program. –Runtime property - This type of property will only take effect when the program is running. –Design time/Runtime property - This type of property can be changed during the design time as well as during the runtime.

13 PROPERTIES TEXT of a LabelBox TEXT of a TextBox BackColor of a Form

14 Event It refers to an action that happens during the program’s execution – clicking of a button, pressing a key, changing the text of a textbox Method It refers to the function of a control It commands the control on what it should perform once an event occurs. –open, close, move, refresh

15 Naming a Visual Basic Control SYNTAX: Control Prefix Label BoxlbllblHelloWorld Command ButtonbtnbtnExit Text BoxtxttxtRemarks FormfrmfrmProgram

16 Naming a Visual Basic Control

17 Variables Variable – a named memory location capable of storing values based on its definition –Numeric: used to store a value which is numeric in nature –String: used for storing strings

18 RULES IN NAMING VARIABLES 1.It must start with an alphabetic character. 2.It can contain letters, numbers and an underscore (_). 3.It should not exceed 255 characters. 4.It should not contain any special character and a space.

19 Data Types Data Type – an element of a variable that verifies the kind of data it can store. –Boolean- Short (9) –Integer- Long (17) –Single- Double –String ** the value of string must be enclosed within “ ”

20 Variable Declarations SYNTAX: Dim as OR: Dim Suffixes: Integer( % )Double( # ) Single( ! )Long ( & ) String( $ )

21 Sample Variable Declarations Ex 1. X and Y are of integer data type. DimX as integer Dim Y% Ex 2. Name is of string data type. Dim Name$

22 The Assignment Statement SYNTAX: ObjectName.PropertyName = Value WHERE: ObjectName – name of the control PropertyName – property of the control Value - a constant or a variable Ex: lblDisplay.text = “Hello!”

23 Assignment Statement Example1: Assign the value “Sophomores” in the textbox named as Remarks. ANS: Remarks.Text = “Sophomores” Example2: Assign the value Num1 in the textbox named txtNum1. ANS: TxtNum1.Text = Num1

24 Example3: Delete the text in the textbox named as Remarks. ANS: Remarks.Text = “ ”

25 (Save As: Info)

26 Source Code:

27 HANDS-ON Activity #1 Save As: StudInfo Create a program that will accept the name, school, and address of a student using textboxes. Once the display button is clicked the student information supplied in the textboxes will be displayed in a single message box.

28 Sample output:

29


Download ppt "Fundamentals of GUI Programming. Objectives: At the end of the session, you should be able to: describe the guidelines that are used for creating user-friendly."

Similar presentations


Ads by Google