ButtonImageGadget()

Syntax

Result = ButtonImageGadget(#Gadget, x, y, Width, Height, ImageID [, Flags])
Description
Create a button gadget in the current GadgetList.

If #PB_Any is used as '#Gadget' parameter, the new gadget number will be returned as 'Result'. #Gadget will be the number returned by EventGadget() function.

The 'Flags' parameter can have be #PB_Button_Toggle to create a toggle button.

You can add a 'mini help' to this gadget by using GadgetToolTip().

- GetGadgetState() can be used to get the toggle state of the gadget.
- SetGadgetState() can be used to set the toggle state of the gadget.
- GetGadgetAttribute() with the following values:
  #PB_Button_Image       : Get the displayed image.
  #PB_Button_PressedImage: Get the image displayed when the button is pressed.
- SetGadgetAttribute() with the following values:
  #PB_Button_Image       : Set the displayed image.
  #PB_Button_PressedImage: Set the image displayed when the button is pressed.
To get a valid ImageID to display in this gadget, ImageID() from the Image library can be used. If ImageID is set to 0, then no image will be displayed.

Example:

  If OpenWindow(0, 0, 0, 120, 100, "ButtonImage", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    If LoadImage(0, "map.bmp")    ; change 2nd parameter to the path/filename of your image
      ButtonImageGadget(0, 10, 10, 100, 83, ImageID(0))
    EndIf
    Repeat
    Until WaitWindowEvent() = #PB_Event_CloseWindow
  EndIf

Supported OS

All

<- ButtonGadget() - Gadget Index - CalendarGadget() ->