This class was originally designed to be similar to Window 8’s shell Flyouts; however, it has become something quite different.
CFlyout is intended to be a pretty dynamic class that can be window or control, much like the way ListView’s are used in this manner all over Windows OS (such as in right clicking on TaskBar icons). Internally, it consists of three main controls:
- A ListBox (m_vLB). The ListBox is used internally to help keep track of what text selection – it is hidden.
- A Text control (m_vFlyoutText). This is what is actually seen. The font may be customized completely. Wrapping of text and necessary adjustments to the GUI size are handled by the CFlyout.
- A GroupBox (m_vSelector). A highlighter for when CFlyout is not set to ReadOnly. It is not especially aesthetic as, whenever it is moved, as moving it requires a MoveDraw.
The file is not stdlib compliant and this is deliberate. This is because the class is fully capable of running multiple CFlyouts at once, was designed to work as a module, and can be created based on presets in the Flyout_Config.ini file. With separate files comes separate inis, and with separate inis come better customization.
Note: Flyout_Config.ini is important, though not absolutely necessary, for the inner-workings of CFlyout. It is not completed in the download because a default ini file is stored in the class file, and it will automatically be created the first time you use the class.
Global helper functions:
- AnchorAt: Currently, the anchoring is pretty primitive. Since the Y coordinates need to be absolute, so it is easy to break. The absolute best way I can think of incorporating this functionality is to actually subclass the window to whatever thread it needs to be “anchored” to.
- Convert to GDIP. I am not sure if this requires a ton of work or just a little. What I hope to accomplish by converting to GDIP is a way to avoid the flashing of the background picture everytime a redraw needs to happen. I also hope to incorporate a nice, rounded-rectangle GUI instead of the boring “–Caption” right-angle edge-ness of standard GUIs.
- Convert CFlyout text/listbox controls to single, transparent ListView. I have already started work on this (see hyperlink). With this comes other great things such as, the removal of the GroupBox control that is used to highlight a selection – instead, a custom highlight color could be used; not only so, but it would also rectify the need to manually wrap text, like CFlyout does now.
How to use:
Requires one call to set up. Such as
#Include CFlyout.ahk g_vFlyout := new CFlyout(0, 0, true, true, A_ScreenHeight / 2 + 270, A_ScreenWidth / 2-400, 300)
It is VERY IMPORTANT to remember that, if CFlyout.ahk is not in the same directory as the script which is calling it, you MUST set the working directory to the location of CFlyout. If you do not, then CFlyout will crash. I will try to fix this ASAP, but I have no idea where or where it crashes.
__New does the best it can to auto-assign any variable that is not assigned through the constructor, but creation can still fail if there is not enough information specified, specifically in Flyout_Config.ini. It is recommended that users read above the __New function (outlined in the functions list above).
First time users need to remember that a valid path to a picture must be specified in order to avoid having a plain, black background. It also important to remember that the class includes a nifty GUI for interactively customizing the flyout while being able to visualize the changes. For more info, see GUIEditSettings (outlined in the functions list above).
Output parser (Requires DynaRun)