Change from child window to popup window (and back)


.

A window can be created as either a child or a popup. A child window can be moved only within its parent's rectangle area. Let's say one wants to do just the opposite, that is, to move a child window out of its parent's area, it is hard to switch its style without destroying and creating a new one. That is the original motivation for creating the CPopChildWnd.

CPopChildWnd is based on MFC's CWnd class, it actually uses two CWnd derivatives(one is created as child and the other as a popup) to give the appearence of its switchable style. To use it, user embeds a CPopChildWnd(or often time, its derivative) as a data member, and call its Create(...) function. When CPopChildWnd's create function is called, it creates two windows, as mentioned before, one is visible and the other is hidden. User then will be able to drag the window around by mouse, when it is in the parent's rectangle area, it is a child(actually the child window is shown), when it is outside of the parent's area, it is a popup window(the popup window shown). Because the drawing stuff is all handled by CPopChildWnd itself, therefore the two switchable windows appear to be the same.

I used it first as a hot-spot picture, where a portion of a view window's drawing is movable by mouse dragging, if you double-click(or right click) that portion, some action will take place. If you drag that portion out of the view window, it dangles on the desktop, yet it still is a hot-spot.

I also used it as a banner where some text and graphs were shown, user can move that banner out of the way to have more screen real estate to work with still be able to see the banner.

I can also imagine it be used as some sort of short cut bar where user can conveniently place it anywhere on the desktop.

Download Project 1.8 MB



Comments

  • There are no comments yet. Be the first to comment!

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Live Event Date: October 29, 2014 @ 11:00 a.m. ET / 8:00 a.m. PT Are you interested in building a cognitive application using the power of IBM Watson? Need a platform that provides speed and ease for rapidly deploying this application? Join Chris Madison, Watson Solution Architect, as he walks through the process of building a Watson powered application on IBM Bluemix. Chris will talk about the new Watson Services just released on IBM bluemix, but more importantly he will do a step by step cognitive …

  • Businesses are moving more and more of their customer transactions to the web. Security is understandably a top concern as online transactions increase, so it is important to make sure your electronic signature provider meets the highest security standards. That means more than simply passing a security audit or obtaining a certification. This white paper provides recommendations for taking a broader view of e-signature security, and answers key questions that help identify the security requirements against …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds