Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

[Function] InfoGUI v0.4 - Display a Pop-Up Info Window


  • Please log in to reply
2 replies to this topic
jballi
  • Members
  • 1029 posts
  • Last active:
  • Joined: 01 Oct 2005
Introduction
This script was inspired by the "CreateInfoGui" subroutine in AGU's BBCodeWriter.

If developing a reasonably complex GUI application, you will inevitably want to use a pop-up window for displaying context or application level help, tips, a list of shortcuts, etc., etc. To insure that window doesn't get lost or interfere with other application functions, the window should pop-up over the parent GUI and must be closed before control is returned to the parent window.

The most direct way to accomplish this task is to write a subroutine to display the new window. In addition to the specifics of the window (size, buttons, content, etc.) the subroutine needs to know the parent window so that it can disable it before the new window is created and to re-enable it after the new window is closed.

Like AGU, I wanted to create a "generic" routine for displaying an "Info" window. My idea is to put this type of code into a function so that most of the window specifics could be defaulted and so that the routine could be easily included into any script.

Screenshots
Posted Image

The Code
Source: InfoGUI.ahk
Documentation: InfoGUI.html
Examples: InfoGUI - Examples.ahkReferences
[Function] PopupXY
InfoGUI calls this function (optional)
http://www.autohotke...pic.php?t=20885

HTML DialogBox
An excellent alternative to InfoGUI. As the name implies, allows HTML formatting.
http://www.autohotke...pic.php?t=60215
Final Thoughts
This function can be customized ad nauseam. Feel free to make any changes you want. If you have any ideas for improving or correcting the process, please make a noise.

I hope someone finds this useful.
---------------------------------------------------------------------------
Release Notes

v0.1

Original release.

v0.2
A small number of minor modifications to improve usability:
- Function does not exit until the GUI window is closed.
- p_Bold parameter replaced with p_FontOptions to support a lot more font changes. See the documentation for more information.
- Default font changed to system default font.
- Updated documentation.
- Updated examples.

v0.3:
AutoHotkey v1.0.44.09+ is required.
- GUI window number is no longer fixed. Static GUI labels removed.
- Multiple InfoGUI windows are now possible but are not recommended. See the documentation for more information.
- GUI margins set to 0,0 to improve look especially when a large font size is used.
- "OK" button is now centered.

v0.4
Important: Parameters and return value have changed. Please read the documentation before using.

Additions, Updates, & Fixes:
- Fix: Multiple InfoGUI windows are no longer allowed. Improves reliability.
- Update: PopupXY function is now optional.
- Window Width and/or Height can be dynamic (determined by the text).
- If ObjectType is "Text", Ctrl+C will copy all text to the clipboard.
- Added context menu that will show if ObjectType is "Text"
- Updated documentation.
- Created external documentation.
- Updated examples.


jballi
  • Members
  • 1029 posts
  • Last active:
  • Joined: 01 Oct 2005
Developing this script has turned into a learning experience on how to create and interact with a GUI inside of a function. I picked up some good ideas from Rajat's and Toralf's functions to create/edit configuration files -- http://www.autohotke...pic.php?t=11327. The only thing I haven't been able to do is get rid of the static GUI number and the GUI labels because of my requirement to close the GUI if the Escape key is hit. Without the 92GUIEscape label, the Escape key is ignored. This issue might turn into a "Wish List" post.

Since I use this script myself, I thought I would bump this post to let you know of the changes. The script has been modified to improve usability and in turn, to act more like a function. Modification log in the 1st post.

20060809 Edit: With AHK v1.0.44.09, static labels are no longer required. The 1st post has been updated to reflect the new features.

jballi
  • Members
  • 1029 posts
  • Last active:
  • Joined: 01 Oct 2005
I redesigned/rewrote this function a long (long) time ago. I have been updating some other scripts recently so I decided it was time to give this one an update.

v0.4
The functionally remains the same (displays a read-only text window) but the function has been rewritten to include additional flexibility. See the bottom of the top post for a list of changes.