DrDialog Control
From EDM2
DrDialog Control is an extension DLL intended for use with the DrDialog. It provides a few new dialog functions including a progress bar and also flyover help which is missing in the base package. DrDialog Control allows to freely set colours, fonts and labels of the dialogs, and the fly over help you can set the initial display delay and overall display time as well.
Contents
Features
- An incremental percentage bar (DRD_PERCENTBAR) - Allows you to show the progress of a task
- A fly-over help control (DRD_BUBBLEHELP)
- An image control (DRD_IMAGE) which displays any image file supported by OS/2.
- A directory picker
- Image histogram control showing the histogram of an image
- Some new functions are included to set the parent-child relationship between dialogs.
Versions
- 0.1.1
- 0.1.2
- 0.1.5 - released as a full package, complete with sources
- 0.1.6 - bug fix
- 0.1.7 - only released as bug fixed DLL without sources, but there were no feature changes (apart from a few undocumented features) so you can just swap the DRCTL017.DLL.
Articles
- Thomas Klein: DrDialog, or: How I learned to stop worrying and love REXX - Part 14 contains more info on how to use DrDialog Control
Functions
- DRCtrlLoadFuncs
- Load all functions of this DLL and make them available to Rexx.
- DRCtrlDropFuncs
- Drop all registered functions.
- DRCtrlRegister
- Register the new controls with DrDialog so they can be used.
- Example Code: In your init function register the new Rexx function "DRCtrlRegister" with Rexx and then call it to register the new controls with your DrDialog application. The controls must be registered in every application because this call is local to the calling process.
- NOTE: The DLL must be in the current directory, the libpath or where the DrRexx.exe is.
- The default DrDialog installation sets the working dir for DrRexx.exe to the installation directory. So loading may fail if you start your app with a double click. Copy the DLL to your DrDialog installation directory or change the working directory then.
/* Register the new function with Rexx */ /* This means make the function available to Rexx */ rc=RxFuncAdd("DRCtrlRegister", 'drusrctl' , "DRCtrlRegister") /* Register the new controls with your application */ /* This means make the controls available to DrDialog */ call DRCtrlRegister ...
- DRCtrlVersion
- Query the release.
- Syntax
SAY DRCtrlVersion() - Return Code: returns "0.1.3" (or any other version number)
- DRCtrlPickDirectory
- Open a dialog to pick a directory.
- Syntax
theDir=DRCtrlPickDirectory("x:\the_path\directory", "Title of directory") - Parameters:
- Path: Full path of the directory that is going to be picked.
- Title of Directory: This parameter may be omitted. The default Title is "Find directory".
- Return Code: The function returns the chosen directory or an empty string if the user selected cancel or an error occurred.
- Remarks: Use this REXX function to pick a directory.
- theDir=DRCtrlPickDirectory("x:\the_path\directory", "Title of directory")
- When the first parameter is given, the directory dialog will be populated with the given path. The second parameter may be omitted. The default Title is "Find directory". The function returns the chosen directory or an empty string if the user selected cancel or an error occurred.
- DRCtrlSetParent
- Set the parent of a dialog. Normally all dialogs created by DrDialog are children of the desktop. You may set the owner of these dialogs using a built-in function but not the parent.
- Why do you want to change the parent? For example if you create a dialog containing a lot of controls on top of another dialog the top dialog doesn't move with the bottom dialog when it is dragged using the mouse. If you click into the top dialog the focus switches to that dialog and the titlebar of the bottom dialog becomes inactive even if the top dialog doesn't has a titlebar. That is very confusing to the user. Using this new function it's possible to connect the top dialog to the bottom one eliminating these problems.
- Syntax
- rc=DRCtrlSetParent( dialogID, newParentID)
- Return Code
- Returns:
- 1: success
- 0: failure
- Remarks
- Note: The dialogs MUST be main dialogs. This means they're children of the desktop. This is true for all dialogs created by DrDialog. If you want to change parents for other dialogs use DRCtrlSetParentFromHWND(). If you change the parent of a dialog hints and bubblehelp no longer work for that dialog.
- DRCtrlGetHWND
- Get the window handle of a dialog. This handle is used internally by PM.
- Syntax
- rc=DRCtrlGetHWND( hwnd, ID)
- Parameters
-
- hwnd:
- ID:
- Return Code
- Returns:
- 0: failure
- other: the window handle (HWND)
- Remarks
- Note: If hwnd==0 it's assumed the dialog is a child of the desktop. This is the case for dialogs initially created by DrDialog.
- DRCtrlSetParentFromHWND
- Sets the parent<->child relationship of dialogs using window handles.
- The dialogs may be child dialogs of a dialog. Use DRCtrlGetHWND() to query the HWND of a dialog.
- Syntax
- rc=DRCtrlSetParentFromHWND( hwnd, newParentHWND)
- Parameters
- hwnd :
- newParentHWND :
- Return Code
- Returns:
- 1: success
- 0: failure
- Remarks
- Note: If you change the parent of a dialog hints and bubble help no longer work for that dialog.
- DRCtrlGetHistogram
- Gets the histogram of an image.
- Syntax
- rc=DRCtrlGetHistogram("x:\images\example.jpg", 'hist.')
- Return Code
- Returns:
- 1: success
- 0: failure
- Remarks
- Note: The stem 'hist.' contains the histogram. hist.0 is 256 or 0 in case of an error. For each possible brightness level the number of pixels with that value is in hist.a._grey with an index from 1 to 256.
DO a=1 to hist.0 SAY hist.a._grey END
- This function can only be used with 24bit images.
- Undocumented API calls
- DRCtrlQueryPrinterInfo
- DRCtrlQueryImageInfo
- DRCtrlConvertImage
- DRCtrlQuerySysValue
- DRCtrlQueryFreemem
- DRCtrlSleep
Licence
- Open source software released under the three clause BSD license.
- Author: Chris Wohlgemuth