Download presentation
Presentation is loading. Please wait.
Published byLindsay Barton Modified over 9 years ago
1
BZUPAGES.COM Visual Programming Lecture – 6- 7 Miss. SADAF MAJEED SIAL Computer Science Department Bahauddin Zakariya University Multan.
2
BZUPAGES.COM 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
3
BZUPAGES.COM 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.
4
BZUPAGES.COM 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
5
BZUPAGES.COM 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
6
BZUPAGES.COM 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.
7
BZUPAGES.COM “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
8
BZUPAGES.COM 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
9
BZUPAGES.COM 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.
10
BZUPAGES.COM
11
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.
12
BZUPAGES.COM Controls/Button s WNDCLASS 1. Buttons 2. List Boxes 3. Edit Controls 4. Combo Boxes 5. Scroll bars 6. Static Controls 7. Check Box 8. Slider 9. Radio Buttons BUTTON LISTBOX EDIT COMBOBOX SCROLLBAR STATIC BUTTON SLIDER BUTTON MFC ClASS CBUTTON CLISTBOX CEDIT CCOMBOBOX CSCROLLBAR CSTATIC CBUTTON CSLIDER CBUTTON
13
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.
14
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.
15
BZUPAGES.COM 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),
16
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 2 nd 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.
17
BZUPAGES.COM Controls:-
18
BZUPAGES.COM button controls are of four types 1.Push button 2.Check boxes 3.Radio buttons 4.Group boxes
19
BZUPAGES.COM 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.
20
BZUPAGES.COM Onchkclick() { Update data (true); If (m-chk ==) m-text = “checkbox checked”; Else m-text = “unchecked”; update data (false); }
21
BZUPAGES.COM 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.
22
BZUPAGES.COM 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.
23
BZUPAGES.COM 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.
24
BZUPAGES.COM A list box is used to display a list of text strings called Items. An item can be anything that we can describe with the string, a file, name, rno, address…etc A list box can have capabilities like sorted strings or scroll bars if required. When the no of choices in list are extended on dialogue box becomes difficult then list box is used. It takes less area. List box can also be used as radio buttons or checkboxes of selection point of view.
25
BZUPAGES.COM For a List boxes, in there properties checked in the selection check box is extended. A list box is very useful for presenting a list of items and enabling the user to select items from the list. A standard list box displays strings in a vertical column and allows only one item to be selected at a time. The currently selected item in a list box is highlighted usually with blue color.
26
BZUPAGES.COM For list boxes such functions will be used for add,, selection, get text and counting…etc These functions are used with the control variables. Without attach variables with these functions the functions can’t work properly.
27
BZUPAGES.COM Used for add elements in list boxes. m_list.AddString(string) Eg: m_list.AddString(“one”); m_list.AddString(“two”); m_list.AddString(“three”);
28
BZUPAGES.COM Used for get text of particular elements through index number. m_list.GetText(index,string); Eg: m_list.GetText(3, str); m_list.GetText(2, str);
29
BZUPAGES.COM Used for get current selection. This will return index of currently selected element. If single selection option is used. m_list.GetText();
30
BZUPAGES.COM This will count total number of elements in the list. m_list.GetCount();
31
BZUPAGES.COM This will be used to delete a particular element whose index is passed as parameter. m_list.DeleteString(index); Indexes are rearranged after deleting.
32
BZUPAGES.COM A function is used to check which element is selected. This will return 0 or 1. int= GetCount(index);
33
BZUPAGES.COM This will return the number of currently selected elements. m_list.GetSelCount(index);
34
BZUPAGES.COM This is a dropdown list. A combo box control is a combination of a single line edit control and a list box. The edit control sits on the top of the listbox. There are three types of combo boxes. 1.Simple 2.Drop-Down 3.Drop-down list
35
BZUPAGES.COM The list is displayed permanently. When the user selects an item from the list box, the item is automatically copied in the Edit control. Text may also be typed in the simple combo box.
36
BZUPAGES.COM Is similar to a simple combo box. but the list box is displayed only when the user clicks the downward pointing arrow to the right of the Edit box.
37
BZUPAGES.COM Works similar but does not permit text to be typed in the edit control. As a result, the user’s selection is restricted to only items that appearing in the list box.
38
BZUPAGES.COM The functions of combo box is same as list box control, Just for text another function is used. m_list.GetLBText(index, str)
39
BZUPAGES.COM Edit controls are used for text entry and editing. These controls have built-in support for operations like cut, copy, paste, undo..etc Edit control can be either single or multi line. Single line edit control are usually used to receive one line text strings like name, password……etc Multi-line edit control are used to accepting longer text strings like addresses, product info ……etc
40
BZUPAGES.COM Static controls come in three varieties : Text strings Rectangle Images
41
BZUPAGES.COM Text Strings: ◦ Are usually used alongside other controls like Edit Boxes or list boxes describing their purposes. Rectangles: ◦ Are used to group together related controls by drawing rectangle around them. Images: ◦ Static controls can also be used to display images formed from bitmap, icons, cursors, or metafiles.
42
BZUPAGES.COM Scroll bar controls are similar to the scroll bars attached to the window. The difference is that the scroll bars attached to the window are obtained by specifying a window style. ScrollBar::Create()
43
BZUPAGES.COM For manage the controls on Dialog Box with respect to the specific application variables are attached with these controls to following such steps.
44
BZUPAGES.COM
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.