Monday, February 25, 2013

Modal and Modeless Dialog Box and Winodws Common Controls


Modal & Modeless Dialog Box:
1.     Model Dialog box:
The model dialog box is a kind of dialog box, which need response from the user before program continue or First we need to close the dialog box (Child window) window then only other part of the window can be activated.
The model dialog box is created by calling DoModal() function of the dialog class (CDialog). This function does not return back control to the caller unit until the dialog is closed.
Ex:
Void projView::OnDraw(CDC *pDC)
{
            CDialog dlg:
            dlg.DoModal();
}
2.     Modeless Dialog box:
It allows focusing the other part of the window even if dialog box window is active.
The modeless dialog box can be created using the Create function of dialog class. The create call return as soon as dialog box is created. The control returns back to the caller application and the user is able to continue using the application.
Ex:
Void projView::OnDraw(CDC *pDC)
{
            CDialog *dlg=new Cdialog;
            dlg->Create(IDD_Dialog1,this);
            dlg->ShowWindow(SW_SHOW);
}

Windows Common Controls
There are some important Windows control used in Windows95 and Windows NT. Progress indicator, trackbar, spin button control, list control and tree control are to windows common controls.
                                                        i.            The Progress Indicator Control:
This control used to display any progress like a copy is being performed.It is represented by the MFC CProgressCtrl class and it is generally used only for output. It is initialized by calling SetRange and SetPos functions in OnInitDialog function. SetPos is called in message handler to show continuing progress.
Ex:
 

                                                      ii.            The Trackbar Control:
In this control a tracker is moved along a vertical or horizontal line. Volume controller and screen resolution changer are the examples of it. As we move the tracker along the line volume increases or decreases in a windows operating system.
Ex:

                                                    iii.            The Spin Button Control:
The spin button is also known as spin control’s buddy. Spin button control has a spin control to increase or decrease value in the edit control.
Ex:


                                                   iv.            The List Control:
Using this control we can create a list view of small icons or bitmaps. This list items are arranged in a grid. When user select any element or item from the list the control sends a notification message. 
Ex:


                                                     v.            The Tree Control:
It also uses icon or bitmap to show its element or items. User can expand and collapse elements by clicking the + and – button respectively. When user selects an item in the tree view control will expand a sub tree view automatically.
Ex:

0 comments:

Post a Comment

Powered by Blogger.