DBitmapButton

From Dabo Wiki
Jump to: navigation, search

dBitmapButton is much like dButton in that its purpose is to allow the user to trigger an action by clicking on it. Unlike dButton, though, it can display images instead of text. Actually it can display both, but since they both get centered on the control, it doesn't make sense to use both at the same time.

Additionally, you can set a different image than the primary image in two situations: when the button is depressed, and when the button has focus but is not depressed. You don't need to specify these special cases, since the default image will be displayed. Also, these special images are not supported on OS X, so if you plan on running your app on OS X, don't rely on these special-case images.


Some of the more useful properties for dBitmapButton:

  • Picture - (str): Path to the default image to be displayed. Can also be the name of a Dabo standard image.
  • Caption - (str): The text that appears on the button
  • CancelButton - (bool): When True, the button responds to an Escape keypress as though it had been clicked. Default=False.
  • DefaultButton - (bool): When True, the button responds to an Enter or Return keypress as though it had been clicked. Default=False.
  • DownPicture - (str): Path to the image to be displayed when the button is depressed. Can also be the name of a Dabo standard image.
  • FocusPicture - (str): Path to the image to be displayed when the button has focus and is not depressed. Can also be the name of a Dabo standard image.
  • AutoSize - (bool): Determines whether the button resizes when the Picture changes. Default=False.
  • BitmapBorder - (int): Space in pixels added to the size of the Picture when determining AutoSize dimensions. Default=10px.

Some of the more useful events for dBitmapButton:

  • Hit - Generated when the user clicks on the button.

See the Dabo Class Documentation for an exhaustive documentation of this control's Properties, Events and Methods. (Note that this documentation is no longer live, but it's still available via the Internet Archive).