Tuesday, 14 February 2017

WINDOWS COMMON CONTROL

Ø Windows 95 provides a set of 15 additional controls called ‘Common Controls’.
Ø These controls are implemented in the file COMCTL32.DLL
Ø The magnifying glass that moves in a circle while ‘find’ performs a search, the piece of paper that fly across the screen when files are copied, tree like structures of directory whose branches expand and collapse in response to mouse clicks, the details of files shown in the explorer, etc., are all implemented via common controls.
Ø  
Control
MFC Class
Animation
CAnimateCtrl
Image list
CImageList
List view
CListCtrl
Progress
CProgressCtrl
Property Sheet
CPropertySheet
Rich Edit
CRichEditCtrl
Slider
CSliderCtrl
Status Bar
CStatusBarCtrl
Tab
CTabCtrl
ToolTip
CToolTipCtrl
Toolbar
CToolBarCtrl
Tree View
CTreeCtrl
Ø They can be used either in a window or a dialog box.
Ø The header file ‘afxcmn.h’ needs to be included since it contains the declaration of common control classes.
Ø For example to get a progress control in a window we do the following:
#include<afxcmn.h>
CProgressCtrl p;
p.Create(WS_CHILD|WS_VISIBLE|WS_BORDER,CRect(x1,y1,x2,y2),this,IDC_PROGRESS1);
Animation Control:
This control is used to create the animation.
Class: CAnimateCtrl is used to create this control.
Function:
CAnimateCtrl::Create():to create a control as a child window of any app.
CAnimateCtrl::Open(): Load an AVI clip in the animation control.
CAnimateCtrl::Play(): Play the clip file that is to loaded.
CAnimateCtrl::Stop(): Stop the playing of AVI clip file.
CAnimateCtrl::Close(): close the AVI clip and remove from memory.
Image List Control:
An image list is a collection of same size bitmap images joined into one object.
Class: CImageListis used to define this control.
Function:
CImageList::Create(IDB_BITMAP1,100,1,CLR_NONE):
                           1st Parameter is used for bitmap’s resource ID.
                             2nd Parameter is used for width.
                             3rd Parameter is the grow size.
                             4th parameter is used for creating unmasked image list.
CImageList::Draw(&d,i,pt,ILD_NORMAL):
                             1st specify the DC where the image should be drawn.
                             2nd specify the image number
                             3rd specify the x & y co-ordinate of the point in the DC.
                             4th is used as flag that tells the Draw() function to draw a masked image using the current background color.
List View Control:
List view controls provide a powerful way to present complex data. As we know, tree view controls ideal for showing hierarchical relationships. Against this, list view controls are best suited for presenting records of data.
Class: CListCtrl class is used to implement it.
Function:
CListCtrl::Create(): this function is used to create the list view control.
CListCtrl::InsertColumn(): add the column to the list view control.
CListCtrl::InsertItem(): add the item to the list view control.
CListCtrl::SetItemText(): assign the text string to the item



Progress bar:
This control allow to display the visual clue to the user about the status of the task.
Class: CProgressCtrl is used to implement it.
Function:
CProgressCtrl::Create(): create the progress bar control.
CProgressCtrl::SetRange(): set the range of the control. Default 0-100.
CProgressCtrl::SetStep(): set the step size of the control.
Slider Control:
A slider control consist of a scale and a thumb, which the end user can manipulate using mouse or arrow keys. We can dynamically reset the value of the control.
Class: CSliderCtrl is used to implement it.
Function:
CSliderCtrl::Create(): create the control.
CSliderCtrl::SetRange(): set the range of the control.
CSliderCtrl::SetPos(): set the current position of the thumb.
CSliderCtrl::SetSelection(): set the selection range.
CsliderCtrl::GetPos(): get the current position of the thumb.
Spin Button Control:
Spin button control are small windows containing arrows that point up and down or left and right. Increment the current position by click on up arrow and decrement the current position by click on down arrow.
Class: CSpinButtonCtrl is used to implement it.
Function:
CSpinButtonCtrl::Create(): for create this control.
CSpinButtonCtrl::SetRange(): Set the range.
CSpinButtonCtrl::SetPos(): set the current position.
CSpinButtonCtrl::GetPos(): get the current position.
Tree View Control:
This control is used to create a tree like structure of the text or image. The item can have sub items or subtrees which can be expanded and collapsed to display or hide the information.
Class:CTreeCtrlis used to implement it.
Function:
CTreeCtrl::Create(): create this control.
CTreeCtrl::InsertItem(): add the item to the controls.
ToolTip Control:
A tooltip is a small help-text window that appears when the cursor pauses over a tool such as a button or a slider control.
Class:CToolTipCtrl is used to implement it.
Function:
CToolTipCtrl::Create(): create the tooltip button.
CToolTipCtrl::addtool(&b,”Hello”): apply the tooltip text to the appropriate control.
                           It takes two parameter
                            1st specify the window with which the tooltip is get associated.

                           2nd specify the text that is to be appear in the tooltip window. 

No comments:
Write comments