You have all used the push buttons OK and Cancel in dialog boxes. Now we would like to add some of our own push buttons. In addition rather than have just a push button with some writing, we would like to have a push button with a face.
Icons like the icon in the About Dialog are created in two parts. First place a button in the dialog. Change the identifier of this button to a number that is less than 1000 or a number with even thousands digit (2345, 4724, etc.). Also change the button type to bitmap.
Next create the icon in theresource workshop. Label icon with the button number plus 1000. If you go back to the dialog and test, you will see the button now has the icon on its face.
| Summary | |
| Create the button with an appropritate number and check the bitmap button type. | |
| Create the icon for the button and label it with the button number plus 1000. | |
| When you run "test", the icon appears. | |
The problem with this process is that the buttons we have created are in fact
just icons, not buttons. We need to overlap the icon with a button. First create
a button using the ok button. This button can be resized to coincide with the
size of your icon. Next place it near your icon and choose the number tool and number
the button with a number that is one smaller than the icon.
Now the button should be selected when you press on the icon.
Once you have created your button, return to the project ide (c++) and create your handler for the button.
The complete program in this case is not complete. The handler for the pumpkin button is installed and buttons for the witch and the vampire are in place. One more icon (skull) has been created. You should see if you can create buttons for the existing icons and create a new icon for skull. To get the incomplete version click here.