No announcement yet.

Custom message Discussion

  • Filter
  • Time
  • Show
Clear All
new posts

  • Custom message Discussion

    I've been playing around with the custom message box here:
    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.
    (see function TextLen(...)

    It also demonstrates using DIALOG SET/GET USER to pass values to the dialog callback rather than using globals.

  • #2
    Howdy, Stuart!

    Yes, I use the imagelist parameters to resize toolbar image images - its a very easy method and particularly minimal!

    And even when I'm not using a Graphic control, having one available in the app (even out of sight) gives access to the Graphic(Text.Size.X) feature. Very convenient!


    • #3
      Just added Ctrl+C = copy to clipboard to latest version.


      • #4

        Nice customizable alternative to API and PB message box.


        • #5
          I've just updated the last Source Code post: Ctrl+C wasn't handling UNICODE such as Greek or Russian text properly.