I've been playing around with the custom message box here:https://forum.powerbasic.com/forum/u...box#post823695
and have made a few additions to the original.
A couple of things that it took me a while to work out how to do which may be useful in other places:
1. Scaling of a system icon by:
2. Getting the required size of a textbox to fit a text string with a proportional font by:
It also demonstrates using DIALOG SET/GET USER to pass values to the dialog callback rather than using globals.
and have made a few additions to the original.
A couple of things that it took me a while to work out how to do which may be useful in other places:
1. Scaling of a system icon by:
- Creating an ImageList with IMAGELIST NEW ICON ,setting the desired size to display the icon
- Using LoadIcon() to get a standard system icon
- Adding the icon in the IMAGELIST so that it is scaled
- Creating a GRAPHIC control
- Using GRAPHIC IMAGELIST.... to place the sized icon in the graphic.
2. Getting the required size of a textbox to fit a text string with a proportional font by:
- creating a bitmap
- setting the font
- using GRAPHIC(TEXT.SIZE.X) to get the length in pixels
- using DIALOG PIXELS.... TO UNITS to get the required length in Dialog Units.
It also demonstrates using DIALOG SET/GET USER to pass values to the dialog callback rather than using globals.

Comment