home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / tpw / owldemos / bitbtn.doc < prev    next >
Text File  |  1991-05-20  |  3KB  |  84 lines

  1.                         Bitmapped Button
  2.  
  3. BITBTN.DLL allows your applications to have bitmapped buttons
  4. similar to the ones found in Turbo Pascal Integrated Development
  5. Environment (TPW.EXE). Bitmapped buttons are direct replacements
  6. to standard Windows push buttons.
  7.  
  8. A demo program, BITBNAPP.PAS shows how to use this BITBTN.DLL.
  9.  
  10. Here is a summary of how to use a bitmapped button:
  11.  
  12.   Using an .RC file
  13.     Replace the class "Button" with "BitButton" for any push
  14.     buttons that have an ID code of idOk, idCancel, idYes, or
  15.     idNo.
  16.  
  17.   Using the Whitewater Resource Toolkit
  18.     Create a custom control with the class "BitButton" and give
  19.     it the ID of idOk (1), idCancel (2), idYes (6) or idNo (7).
  20.     To make a bit button the default, check the "Bit 0" control
  21.     in the style dialog.
  22.  
  23.   Using Object Windows (non-template dialog)
  24.     Create an object type like the following:
  25.  
  26.       PBitButton = ^TBitButton;
  27.       TBitButton = object(TButton)
  28.         constructor Init(AParent: PWindowsObject; AId, X, Y: Integer;
  29.           Default: Boolean);
  30.         function GetClassName: PChar;
  31.       end;
  32.       .
  33.       .
  34.       .
  35.       constructor TBitButton.Init(AParent: PWindowsObject;
  36.         AId, X, Y: Integer; Default: Boolean);
  37.       begin
  38.         TButton.Init(AParent, AId, X, Y, 0, 0, Default);
  39.       end;
  40.  
  41.       function TBitButton.GetClassName: PChar;
  42.       begin
  43.         GetClassName := 'BitButton';
  44.       end;
  45.  
  46.     This class also allows a bitmapped button to be placed in a
  47.     window:
  48.  
  49.       Win := New(PWindow, Init(@Self, 'My Window'));
  50.       Btn := New(PBitButton, Init(Win, idOk, 50, 50, False));
  51.  
  52.     If you wish to attach an object to the button, attach a
  53.     TButton object to it. For example:
  54.  
  55.       D := New(PDialog, Init(nil, 'My Dialog'));
  56.       C := New(PButton, InitResource(D, idOk));
  57.       Application^.ExecDialog(D);
  58.  
  59.  
  60.  
  61. Custom Bitmaps
  62. --------------
  63. The BITBTN.DLL calculates the bitmap to use by using the ID of
  64. the button. If you wish to create your own bitmaps for buttons,
  65. you need to create a least three bitmaps: button up, button up
  66. with focus, button down with focus. You'll need additional copies
  67. of these for each video adapter you wish to support (VGA, EGA,
  68. Herc, CGA, etc.). Examine the
  69.  
  70. View BITBTN.RES using the Whitewater Resource Toolkit for an
  71. example of all the bitmaps. (Note: a button cannot be pressed
  72. down without the focus.) The bitmap numbers are calculated as
  73. follows,
  74.  
  75.                         VGA        EGA
  76.       Up w/o focus      1000 + ID  2000 + ID
  77.       Down /w focus     3000 + ID  4000 + ID
  78.       Up /w focus       5000 + ID  6000 + ID
  79.  
  80. If the ID for a bit mapped button does not have all the bitmappes
  81. associated to it, it will not opperate properly. Once the bitmaps
  82. are created they need to be added to the BITBTN.DLL resource.
  83. This can be done using the Whitewater Resource Toolkit.
  84.