Text Methods

The following methods are used to display text dynamically in a window area and to modify the state of a device context. See GetWindowDC, GetDC, and GetButtonDC for information on how to retrieve a device context.

Write

>>-aBaseDialog~Write(--xPos--,--yPos--,--text---------------------------------->

>--+------------------------------------------------------------------------+-->
   |    +-"SYSTEM"-+                                                        |
   +-,--+----------+--+---------------------------------------------------+-+
        +-fontName-+  |    +-10-------+                                   |
                      +-,--+----------+--+------------------------------+-+
                           +-fontSize-+  |       +-----------------+    |
                                         |       V +-OPAQUE------+ |    |
                                         +-,--"----+-THIN--------+-+--"-+
                                                   +-EXTRALIGHT--+
                                                   +-LIGHT-------+
                                                   +-MEDIUM------+
                                                   +-SEMIBOLD----+
                                                   +-EXTRABOLD---+
                                                   +-BOLD--------+
                                                   +-HEAVY-------+
                                                   +-UNDERLINE---+
                                                   +-ITALIC------+
                                                   +-STRIKEOUT---+
                                                   +-TRANSPARENT-+
                                                   +-CLIENT------+

>--)--------------------------------------------------------------------------><


The Write method enables you to write text to the dialog in the given font and size, to the given position. This method does not take a handle or an ID; it always writes to the dialog window.

Arguments:

See WriteToWindow for a description of the other arguments.

ScrollText

>>-aBaseDialog~ScrollText(--hwnd--,--text--,--+----------+--,--+----------+-->
                                              +-fontName-+     +-fontSize-+

>--,--+--------------------------+------------------------------------------->
      |    +----------------+    |
      |    V                |    |
      +-"----+-THIN-------+-+--"-+
             +-EXTRALIGHT-+
             +-LIGHT------+
             +-MEDIUM-----+
             +-SEMIBOLD---+
             +-EXTRABOLD--+
             +-BOLD-------+
             +-HEAVY------+
             +-UNDERLINE--+
             +-ITALIC-----+
             +-STRIKEOUT--+

>--,--displaceY--,--step--,--sleep--,--color--)-----------------------------><


The ScrollText method scrolls text in a window with the given size, font, and color. The text is scrolled from right to left. If the method is started concurrently, call it a second time to stop scrolling.

Arguments:

The arguments are:

hwnd

The handle of the window in which the text is scrolled

text

A text string that is scrolled

displaceY

The vertical displacement of the text relative to the top of the window's client area (default 0)

step

The size of one step in screen pixels (default 4)

sleep

The time in milliseconds that the program waits after each movement (default 10). This determines the speed.

color

The color of the text (default 0, black)

See WriteToWindow for a description of the other arguments.

Example:

The following example scrolls the string "Hello world!" from left to right within the given window. The text is located two pixels below the top of the client area, one move is 3 screen pixels, and the delay time after each movement is 15 ms.

MyDialog~ScrollText(hwnd, "Hello world!", , , , 2, 3, 15)

Note: Only one sleep interval can be set for multiple scrolling texts within one process. All scrolling text in one process is synchronized with the first given interval.

ScrollInButton

>>-aBaseDialog~ScrollInButton(--id--,--text--,--+----------+--,-->
                                                +-fontName-+

>--+----------+--,--+--------------------------+---------------->
   +-fontSize-+     |    +----------------+    |
                    |    V                |    |
                    +-"----+-THIN-------+-+--"-+
                           +-EXTRALIGHT-+
                           +-LIGHT------+
                           +-MEDIUM-----+
                           +-SEMIBOLD---+
                           +-EXTRABOLD--+
                           +-BOLD-------+
                           +-HEAVY------+
                           +-UNDERLINE--+
                           +-ITALIC-----+
                           +-STRIKEOUT--+

>--,--displaceY--,--step--,--sleep--,--color--)---------------><


The ScrollInButton method scrolls text within a button. It is similar to the ScrollText method, except that you have to pass an ID instead of a window handle.

ScrollButton

>>-aBaseDialog~ScrollButton(--id--,--xPos--,--yPos--,--left--,--top-->

>--,--right--,--bottom--)-------------------------------------><


The ScrollButton method moves the rectangle within a button. It is used to move bitmaps within buttons.

Arguments:

The arguments are:

id

The ID of the button

xPos, yPos

The new position of the rectangle (in pixels)

left, top, right, bottom

The extension of the rectangle

SetItemFont

                                                    +-1--------+
>>--aBaseDialog~SetItemFont(--id--,--fonthandle--,--+----------+--)--><
                                                    +--redraw--+


The SetItemFont method changes the font for a particular dialog item.

The best place to call this method is within InitDialog. If the font is no longer needed, for instance, when the dialog is closed or another font has been assigned to the dialog item, you should free the font resource by calling DeleteFont. A good place to do this is the Leaving method.

Arguments:

The arguments are:

id

The ID of the dialog item.

fonthandle

The handle returned by createFontEx.

redraw

0

Do not redraw the item.

1

Redraw the item, which is the default.

Example:

The following example sets a 12-point Arial font for item 101.

::method InitDialog
     .
     .
     .
   hFont=self~createFontEx("Arial",12)
   self~SetItemFont(101,hFont,0)

GetTextSize (deprecated)

Note: This method is deprecated. It is maintained for compatibility to versions of ooDialog previous to 4.0.0. It's functionality is replaced by the getTextSizeDlg() method. Do not use this method in new code. Try to migrate existing code to use the getTextSizeDlg() method. This method may not exist in future versions of ooDialog.

This method never worked correctly, the previous documentation for this method was incorrect and / or misleading. That has been fixed with with getTextSizeDlg(). The documentation for getTextSizeDlg() correctly explains how the method works and, hopefully, is not misleading.