BZUPAGES.COM Visual Programming Lecture – 5 Miss. SADAF MAJEED SIAL Computer Science Department...

23
BZUPAGES.COM Visual Programming Lecture – 5 Miss. SADAF MAJEED SIAL Computer Science Department Bahauddin Zakariya University Multan.

Transcript of BZUPAGES.COM Visual Programming Lecture – 5 Miss. SADAF MAJEED SIAL Computer Science Department...

Page 1: BZUPAGES.COM Visual Programming Lecture – 5 Miss. SADAF MAJEED SIAL Computer Science Department Bahauddin Zakariya University Multan.

BZUPAGES.COM

Visual Programming

Lecture – 5 Miss. SADAF MAJEED SIAL

Computer Science Department Bahauddin Zakariya University Multan.

Page 2: BZUPAGES.COM Visual Programming Lecture – 5 Miss. SADAF MAJEED SIAL Computer Science Department Bahauddin Zakariya University Multan.

BZUPAGES.COM

Wizard• It’s a Software tools with which using step by

step procedure.• Wizard creates a full environment for application

designs. • For dialog based programming Wizard

programming is used.• In which we design applications with using such

types of applications as – SDI (Single document)– MDI (Multiple Document)– Dialog Based

Page 3: BZUPAGES.COM Visual Programming Lecture – 5 Miss. SADAF MAJEED SIAL Computer Science Department Bahauddin Zakariya University Multan.

BZUPAGES.COM

SDI

• SDI stands for Single document interface. An Application which perform operation on one document at one time….eg Notepad

• In which data is used as Text, Graphics, Sound etc

• For used SDI programming we want to help with the AppWizard.

• AppWizard is used to write a great deal of code in our program.

Page 4: BZUPAGES.COM Visual Programming Lecture – 5 Miss. SADAF MAJEED SIAL Computer Science Department Bahauddin Zakariya University Multan.

BZUPAGES.COM

MDI• Simultaneously more than one files can be

opened in one application.• In which the programs will automatically create a

new document object for each new object.• This means that pure data storage and display.• Eg….. MS-WORD• Using two different window type raises as

interesting issue in MDI programming when the user is working on the document and also want certain menus as File, Edit….etc

Page 5: BZUPAGES.COM Visual Programming Lecture – 5 Miss. SADAF MAJEED SIAL Computer Science Department Bahauddin Zakariya University Multan.

BZUPAGES.COM

Dialog Based Programming• This is one of the rectangle area that is used for a

purpose of input.• Graphics tools are used in it.• For dialog based programming also used

AppWizard.• In dialog Based programming controls are used

for input and create our own application through Wizard.

• These controls are of many types. Such as Buttons, Radio, Check Boxes …etc

Page 6: BZUPAGES.COM Visual Programming Lecture – 5 Miss. SADAF MAJEED SIAL Computer Science Department Bahauddin Zakariya University Multan.

BZUPAGES.COM

Classes

• For create application through Wizard two classes are used in which

• CWinApp• CDialog

• CWinApp in used for the handle the full application and next CDialog Class is used for handle the dialog boxes.

• These are the base classes of Wizard.

Page 7: BZUPAGES.COM Visual Programming Lecture – 5 Miss. SADAF MAJEED SIAL Computer Science Department Bahauddin Zakariya University Multan.

BZUPAGES.COM

eg.

• “Test” name of application• Wizard will design this using 2 base classes.– CTestApp (derived from WinApp)

– Test.h– Test.cpp

– CTestDlg (derived from WinApp)– Testdlg.h– Testdlg.cpp

Page 8: BZUPAGES.COM Visual Programming Lecture – 5 Miss. SADAF MAJEED SIAL Computer Science Department Bahauddin Zakariya University Multan.

BZUPAGES.COM

AppWizard

• Is automatically generates a basic framework for the windows programs. Infect, the framework is itself a complete, executable windows programmes.

• In Wizard, further capabilities for managing , modifying and extended code is provided by the Wizard bar, Which is optionally displayed in the toolbar area of Vc++ window.

• It’s a particularly used in the context of MFC and API based programming

Page 9: BZUPAGES.COM Visual Programming Lecture – 5 Miss. SADAF MAJEED SIAL Computer Science Department Bahauddin Zakariya University Multan.

BZUPAGES.COM

Class Wizard

• Classes are the most important language feature of c++ and are fundamental to Windows programming with Visual C++.

• The class wizard provides an easy means of extending the classes by AppWizard as a part of basic windows application and also helps to add new classes based on MFC Classes.

• And also the ClassWizard neither recognizes nor deals with the classes that are not based on MFC Classes.

Page 10: BZUPAGES.COM Visual Programming Lecture – 5 Miss. SADAF MAJEED SIAL Computer Science Department Bahauddin Zakariya University Multan.

BZUPAGES.COM

Steps to create Windows Application through Wizard.

Page 11: BZUPAGES.COM Visual Programming Lecture – 5 Miss. SADAF MAJEED SIAL Computer Science Department Bahauddin Zakariya University Multan.

BZUPAGES.COM

Dialog Based Programming

• Dialog: this is one of the rectangle area that is used for the purpose of input.

• In dialog based programming such controls are used.

• Apart from these forms of input, then also supply input through user interface objects like.

Page 12: BZUPAGES.COM Visual Programming Lecture – 5 Miss. SADAF MAJEED SIAL Computer Science Department Bahauddin Zakariya University Multan.

BZUPAGES.COM

Controls/Buttons

1. Buttons2. List Boxes3. Edit Controls4. Combo Boxes5. Scroll bars6. Static Controls7. Check Box8. Slider9. Radio Buttons

WNDCLASS

• BUTTON• LISTBOX• EDIT

COMBOBOX• SCROLLBAR• STATIC• BUTTON• SLIDER• BUTTON

MFC ClASS

• CBUTTON• CLISTBOX• CEDIT

CCOMBOBOX• CSCROLLBAR• CSTATIC• CBUTTON• CSLIDER• CBUTTON

Page 13: BZUPAGES.COM Visual Programming Lecture – 5 Miss. SADAF MAJEED SIAL Computer Science Department Bahauddin Zakariya University Multan.

BZUPAGES.COM

• For any application, we have to attach variables with IDs in control.

• IDs can’t directly be process so we attach variables as: variable name, category and type.

• Data to be stored in variables from controls & variables are then attached.

Page 14: BZUPAGES.COM Visual Programming Lecture – 5 Miss. SADAF MAJEED SIAL Computer Science Department Bahauddin Zakariya University Multan.

BZUPAGES.COM

• For that, functions which used for that processing.

UpdateData(true)– Transfer data from control to be respected

variables.

UpdateData(false)– Transfer data from variable to controls.

Page 15: BZUPAGES.COM Visual Programming Lecture – 5 Miss. SADAF MAJEED SIAL Computer Science Department Bahauddin Zakariya University Multan.

BZUPAGES.COM

Creating Controls.• MFC provides for creating and communicating. This

involves constructing an object from a control class and calling that object’s create () function.

• All the MFC control classes override the create () function inherited from cwnd to simplify creation of control.

• E.g. mybutton in an object of the type cbutton, mybutton.

• Create (“ok”, WS-CHILDIWS-VISIBLE BS-PUSHBUTTON, CRECT (100, 100, 150, 150), This 1),

Page 16: BZUPAGES.COM Visual Programming Lecture – 5 Miss. SADAF MAJEED SIAL Computer Science Department Bahauddin Zakariya University Multan.

BZUPAGES.COM

• This statement create a push button control.

1.The first parameter in the text that will appear on the face of button.

2.The 2nd in the button style.3.Third parameter specifies the control’s

location and size.4.‘this’ identifies the parent window.5.‘1’ in the identifier for the control. This value

in abo knows as child window ID.

Page 17: BZUPAGES.COM Visual Programming Lecture – 5 Miss. SADAF MAJEED SIAL Computer Science Department Bahauddin Zakariya University Multan.

BZUPAGES.COM

Controls:-

Page 18: BZUPAGES.COM Visual Programming Lecture – 5 Miss. SADAF MAJEED SIAL Computer Science Department Bahauddin Zakariya University Multan.

BZUPAGES.COM

Buttons

• button controls are of four types1. Push button2. Check boxes3. Radio buttons4. Group boxes

Page 19: BZUPAGES.COM Visual Programming Lecture – 5 Miss. SADAF MAJEED SIAL Computer Science Department Bahauddin Zakariya University Multan.

BZUPAGES.COM

Push button• Push buttons are 3D rectangle that appear to

go up and down when clicked as if they were push buttons on a control panel.

Check boxes•Check boxes are small squares in which check marks can be toggled on and off.

Page 20: BZUPAGES.COM Visual Programming Lecture – 5 Miss. SADAF MAJEED SIAL Computer Science Department Bahauddin Zakariya University Multan.

BZUPAGES.COM

Onchkclick(){Update data (true);If (m-chk ==)m-text = “checkbox checked”;Elsem-text = “unchecked”;update data (false);}

Page 21: BZUPAGES.COM Visual Programming Lecture – 5 Miss. SADAF MAJEED SIAL Computer Science Department Bahauddin Zakariya University Multan.

BZUPAGES.COM

Radio buttons:-

• Radio buttons are small circles that are checked with a solid dot when clicked. Radio buttons are usually used to present a list of mutually exclusive option to the user. That is , checking one radio button unchecks the others in the group.

• Radio buttons are provide multiple selection b/w catagories.

Page 22: BZUPAGES.COM Visual Programming Lecture – 5 Miss. SADAF MAJEED SIAL Computer Science Department Bahauddin Zakariya University Multan.

BZUPAGES.COM

Q- Handling and grouping of radio buttons in one window.

• Ans• For handling and grouping of radio buttons, in one line all

radio buttons are considered in one group and If we want to make a group, in an application then we make different groups in this dialog box to select more then one radio buttons at atime. But each in every group. That’s because the three radio buttons already function as a group automatically. They are all in the same window, so they are already coordinated. When the click one of these radio buttons, the program de-selects the other automatically, because they are all share the same window.

• In that variable is of into type & is attached only with the group’s checked button which is checked in a particular group.

Page 23: BZUPAGES.COM Visual Programming Lecture – 5 Miss. SADAF MAJEED SIAL Computer Science Department Bahauddin Zakariya University Multan.

BZUPAGES.COM

Group boxes:

• Group boxes are nothing but rectangles used for visual effect.

• A button can be clicked with the left mouse button or the spacebar works only if the button has the input focus. A button indicates that it has the input focus by displaying a thin dotted rectangle known as a focus rectangle.