We would like to build a community for Small Basic programmers of any age who like to code. Everyone from total beginner to guru is welcome. Click here to register and share your programming journey!


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Button with icons
#4
Nice example originally from Papa Lapub, who was a big contributor to the original SB MS forum.

For me I had to make a couple changes, see PPWP247.000-0.  First the crop size was too big for the W7Orb.png image (causing an error) as I downloaded them, and second the GW size (with resizing set off) was too small to show the buttons (I doubled it size).

The main parts are:

LDShapes.BrushImage - to make an image brush
LDControls.SetButtonStyle - to set different styles for mouseover, click etc - the styles are defined by brushes that can be of several different types, including image

Interestingly I also found this FDNW187.000, by you Martmen I think using SetButtonStyle, just with colours, not images

Finally, a super simple example to run:

Code:
GraphicsWindow.Show()
LDNetwork.SetSSL()
LDGraphicsWindow.PauseUpdates()
button = Controls.AddButton("Press Me",50,50)
brush1 = LDShapes.BrushGradient("1=Yellow;2=Red;3=Yellow;","H")
brush2 = LDShapes.BrushImage("https://litdev.uk/game_images/uploads/bee.png")
LDControls.SetButtonStyle(button,brush1,"Orange",brush2,"Black","Gray","Transparent",10,"True")
Controls.SetSize(button,80,80)
LDGraphicsWindow.ResumeUpdates()
[-] The following 2 users Like litdev's post:
  • AbsoluteBeginner, Scout
Reply


Messages In This Thread
Button with icons - by martmen - 02-08-2026, 11:07 AM
RE: Button with icons - by Scout - 02-08-2026, 08:05 PM
RE: Button with icons - by AbsoluteBeginner - 02-09-2026, 08:11 AM
RE: Button with icons - by litdev - 02-09-2026, 10:08 AM
RE: Button with icons - by martmen - 02-09-2026, 01:37 PM
RE: Button with icons - by litdev - 02-09-2026, 04:25 PM
RE: Button with icons - by martmen - 02-09-2026, 06:33 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)