Custom Buttons.

An OP was asking about making buttons that looked like those conventionally used in PC interfaces.

To run the code you need to download these five images. Clicking the buttons just changes the colour, as an example.

- - - -


Code


  nomainwin

  WindowWidth  =260
  WindowHeight =200

  graphicbox #w.gb, 20, 20, 200, 50

  bmpbutton #w.L2stop, "L2stop.bmp", L2stopClicked, LR, 150, 10
  bmpbutton #w.L2,     "L2.bmp",     L2Clicked,     LR, 120, 10
  bmpbutton #w.pause,  "pause.bmp",  pauseClicked,  LR,  90, 10
  bmpbutton #w.R2,     "R2.bmp",     R2Clicked,     LR,  60, 10
  bmpbutton #w.R2stop, "R2stop.bmp", R2stopClicked, LR,  30, 10

  open "Button Example" for window as #w
  wait

sub L2stopClicked bttnHandle$
  #w.gb "fill 255 0 0"
end sub

sub L2Clicked bttnHandle$
  #w.gb "fill 0 255 0"
end sub

sub pauseClicked bttnHandle$
  #w.gb "fill 40 40 40"
end sub

sub R2Clicked bttnHandle$
  #w.gb "fill 0 0 255"
end sub

sub R2stopClicked bttnHandle$
  #w.gb "fill 220 220 80"
end sub

sub quit h$
    close #w
    end
end sub