[]
        
(Showing Draft Content)

FarPoint.Win.PopupWindowHelper

PopupWindowHelper Class

A class to assist in creating popup windows like combo box drop-downs and menus. This class includes functionality to keep the title bar of the popup owner form active while the popup is displayed, and to automatically cancel the popup whenever the user clicks outside the popup window or shifts focus to another application.

Inheritance
PopupWindowHelper
Implements
Namespace: FarPoint.Win
Assembly: FarPoint.Win.dll
Syntax
public class PopupWindowHelper : NativeWindow, IWin32Window
Public Class PopupWindowHelper
    Inherits NativeWindow
    Implements IWin32Window

Constructors

Name Description
PopupWindowHelper(Control)

Default constructor.

Methods

Name Description
ClosePopup()

Called when the popup is being hidden.

OnPopupCancel(PopupCancelEventArgs)

Raises the PopupCancel event.

OnPopupClosed(PopupClosedEventArgs)

Raises the PopupClosed event.

ShowPopup(Control, Form, Point)

Shows the specified Form as a popup window, keeping the Owner's title bar active and preparing to cancel the popup should the user click anywhere outside the popup window.

Typical code to use this message is as follows:

frmPopup popup = new frmPopup();
                                                      Point location = this.PointToScreen(new Point(button1.Left, button1.Bottom));
                                                      popupHelper.ShowPopup(this, popup, location);

Put as much initialization code as possible into the popup form's constructor, rather than the Load event as this will improve the visual appearance.

WndProc(ref Message)

Subclasses the owning form's existing Window Procedure to enables the title bar to remain active when a popup is show, and to detect if the user clicks onto another application whilst the popup is visible.

Events

Name Description
PopupCancel

Raised when the Popup Window is about to be cancelled. The Cancel property can be set to true to prevent the form from being cancelled.

PopupClosed

Raised when the popup form is closed.