Dec 262017
 
Example source code on BitMap Buttons for TPW.
File BUTONS.ZIP from The Programmer’s Corner in
Category Pascal Source Code
Example source code on BitMap Buttons for TPW.
File Name File Size Zip Size Zip Type
BUTNTEST.PAS 3219 948 deflated
BUTNTEST.RES 16608 1396 deflated
BUTTONS.PAS 14379 2741 deflated
README.TXT 3313 1552 deflated

Download File BUTONS.ZIP Here

Contents of the README.TXT file


Bitmap Buttons by Daniel Thomas Donated to the public domain
CIS: 72301,2164


You should have 4 files:

ReadMe.txt this file
Buttons.pas Bitmap Buttons unit
ButnTest.pas sample program
ButnTest.res sample resource file


EXPLANATION:
-----------

The Buttons Unit defines 2 objects for use in creating and handling Bitmap
Buttons. A button has 3 general appearances:

Normal ("up")
Pressed ("down")
Disabled ("grayed")

note: the other states, "selected" and "default" are not currently
handled - see the NOTES section, below

The tSingleBitmapButton object uses one bitmap, and draws lines to simulate
the three states. You create a single bitmap for the button, with a gray
background. You do not paint the "edges" or the border, but leave room for
them in the gray background. You can create the button bitmaps in virtually
any size (within reason) - this holds true for tMultiBitmapButtons, also.

The tMultiBitmapButton object uses 3 bitmaps, one for each state. The
purpose for this object is to allow you complete control over how the
button will look in each of its states. For instance, a "pressed" button
doesn't have to look like every other pressed button - be imaginative!
You create each button in its entirety (don't you wish TPW had a spelling
checker?), including the border and edges. It would be advisable to make
them all the same size (the object assumes that they are).


EXAMPLES:
--------

The sample program ButnTest.pas includes examples of both types of buttons.
Just compile it and run. In the sample program, clicking on one button will
disable and re-enable the other button, so you can see what a "disabled"
button looks like.

The ButnTest.res file has the bitmaps for these buttons.


THINGS LEFT TO DO:
------------------

There isn't a keyboard interface.

There is nothing to differentiate a "default" button. My suggestion
would be for tSingleBitmapButtons to draw a thicker border (thicker

towards the inside, not the outside), and tMultiBitmapButtons to have
an additional bitmap for this state - remember that the purpose of
tMultiBitmapButtons is to give total control to the programmer.

There is nothing to show a "selected" button. In normal buttons, this is
shown by a dotted-line box around the text. I would recommend something
like a dotted line box for tSingleBitmapButtons, and an additional bitmap
for tMultiBitmapButtons.

Painting on dialogs is not currently supported. If you're going to take
into account changing system font sizes, etc, it can get complicated.
Have fun.


FINAL NOTES:
-----------

Finally, you are free to use this code in any way you wish. No
restrictions (although if you change something and post it to a BBS, please
indicate your changes - I don't want someone blaming me for your lousy
code
If you make any improvements, for instance the "things left to do", I would
really appreciate it if you'd send them to me. Some day I hope that this
unit will be complete. Right now, it does what *I* need it to do .

Dan Thomas
2301 N. Huron Circle
Placentia, CA 92670
(714) 524-5625

Compuserve: 72301,2164
Prodigy: CWRF01A

God bless.


-Dan


 December 26, 2017  Add comments

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)