Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

Turbo Pascal 7.0 / TP7 / OWLDEMOS / BITBTN

.DOC
Скачиваний:
13
Добавлен:
28.06.2014
Размер:
2.94 Кб
Скачать
                        Bitmapped Button

BITBTN.DLL allows your applications to have bitmapped buttons
similar to the ones found in Turbo Pascal Integrated Development
Environment (TPW.EXE). Bitmapped buttons are direct replacements
to standard Windows push buttons.

A demo program, BITBNAPP.PAS shows how to use this BITBTN.DLL.

Here is a summary of how to use a bitmapped button:

  Using an .RC file
    Replace the class "Button" with "BitButton" for any push
    buttons that have an ID code of idOk, idCancel, idYes, or
    idNo.

  Using the Whitewater Resource Toolkit
    Create a custom control with the class "BitButton" and give
    it the ID of idOk (1), idCancel (2), idYes (6) or idNo (7).
    To make a bit button the default, check the "Bit 0" control
    in the style dialog.

  Using Object Windows (non-template dialog)
    Create an object type like the following:

      PBitButton = ^TBitButton;
      TBitButton = object(TButton)
        constructor Init(AParent: PWindowsObject; AId, X, Y: Integer;
          Default: Boolean);
        function GetClassName: PChar;
      end;
      .
      .
      .
      constructor TBitButton.Init(AParent: PWindowsObject;
        AId, X, Y: Integer; Default: Boolean);
      begin
        TButton.Init(AParent, AId, X, Y, 0, 0, Default);
      end;

      function TBitButton.GetClassName: PChar;
      begin
        GetClassName := 'BitButton';
      end;

    This class also allows a bitmapped button to be placed in a
    window:

      Win := New(PWindow, Init(@Self, 'My Window'));
      Btn := New(PBitButton, Init(Win, idOk, 50, 50, False));

    If you wish to attach an object to the button, attach a
    TButton object to it. For example:

      D := New(PDialog, Init(nil, 'My Dialog'));
      C := New(PButton, InitResource(D, idOk));
      Application^.ExecDialog(D);



Custom Bitmaps
--------------
The BITBTN.DLL calculates the bitmap to use by using the ID of
the button. If you wish to create your own bitmaps for buttons,
you need to create a least three bitmaps: button up, button up
with focus, button down with focus. You'll need additional copies
of these for each video adapter you wish to support (VGA, EGA,
Herc, CGA, etc.). Examine the

View BITBTN.RES using the Whitewater Resource Toolkit for an
example of all the bitmaps. (Note: a button cannot be pressed
down without the focus.) The bitmap numbers are calculated as
follows,

                        VGA        EGA
      Up w/o focus      1000 + ID  2000 + ID
      Down /w focus     3000 + ID  4000 + ID
      Up /w focus       5000 + ID  6000 + ID

If the ID for a bit mapped button does not have all the bitmappes
associated to it, it will not opperate properly. Once the bitmaps
are created they need to be added to the BITBTN.DLL resource.
This can be done using the Whitewater Resource Toolkit.
Соседние файлы в папке OWLDEMOS