Please enable JavaScript to view this site.

A-Shell Consolidated Reference

Button icon controls are typically used for icons intended to be clicked on to perform some action, as in this sample (TSTICB, which uses the subroutine ICOBAR. SBX):

ashref_img118

Button icons use the ctype combination MBF_BUTTON + MBF_ICON. In most cases, you would also add the MBF_KBD type to specify a string to be sent when the button is clicked.

Button icons can be loaded individually from .ICO files, or via resource names from a DLL. (As of build 919, they do not support the Windows internal icon resources such as "#question.") To load an icon into a button from an ICO file, just specify the ICO filespec in the ctext parameter, either using AMOS or native syntax, for example:

xcall AUI, AUI_CONTROL, CTLOP_INFO, id, ".\control panel.ico", MBST_ENABLE, MBF_BUTTON + MBF_ICON, cmd$, "",  status, srow, scol, erow, ecol, -2, -2,  0, 0, "",  "", grpid1

To use an icon resource from a DLL, use the same syntax as for static icons, i.e.:

xcall AUI, AUI_CONTROL, CTLOP_INFO, id, "navigate_down::ashico1.dll", MBST_ENABLE, MBF_BUTTON + MBF_ICON, cmd$, "", status, srow, scol, erow, ecol, -2, -2, 0, 0, "",  "", grpid1

Unlike static icons, button icons are scaled to fit the button. However, this can sometimes result in a distorted look if the button is not square. (In the example above, the buttons are slightly taller than they are wide, which results in a slightly "squeezed" look.) To prevent that kind of distortion, you can add the flag MBF_NODISTORT, which forces it to retain the original square aspect ratio. The example below illustrates some icons from the ashico1.dll displayed as buttons with the MBF_NODISTORT flag (all except the last icon, which illustrates what it would look like without the MBF_NODISTORT.

ashref_img119

See Also

The sample dialogs under Groupbox + MBF_ALTPOS for a good example of how using an icon on a button can be much easier to understand than text in a foreign language (which may be how your application appears to even native users.)