ImageGadget()

Syntax

Result = ImageGadget(#Gadget, x, y, Width, Height, ImageID [, Flags])
Description
Creates an Image gadget in the current GadgetList. If #PB_Any is used as '#Gadget' parameter, the new gadget number will be returned as 'Result'. The ImageID represents an image and can be obtained with ImageID() from the Image library. If the ImageID is 0, then no image will be displayed. The gadget dimensions autofit to the image size.

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

- SetGadgetState(): Change the current Image of the gadget. A valid ImageID can be easily obtained with the ImageID() command. If the ImageID is 0, then the image is removed from the gadget.

The following events are supported through EventType():
  #PB_EventType_LeftClick
  #PB_EventType_RightClick
  #PB_EventType_LeftDoubleClick
  #PB_EventType_RightDoubleClick
'Flags' are always optional and can be composed of one of the following constants:
  #PB_Image_Border : display a sunken border around the image.

Example:
  If OpenWindow(0, 0, 0, 245, 105, "ImageGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) And CreateGadgetList(WindowID(0))
    If LoadImage(0, "map.bmp")    ; change 2nd parameter to the path/filename of your image
      ImageGadget(0,  10, 10, 100, 83, ImageID(0))                      ; imagegadget standard
      ImageGadget(1, 130, 10, 100, 83, ImageID(0), #PB_Image_Border)     ; imagegadget with border
    EndIf
    Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
  EndIf

Supported OS

All

<- IPAddressGadget() - Gadget Index - IsGadget() ->