# Suggestions for adding ImageButton components

**URL:** https://forum.castle-engine.io/t/suggestions-for-adding-imagebutton-components/734
**Category:** Uncategorized
**Created:** [January 31, 2023, 11:16am UTC](https://forum.castle-engine.io/t/suggestions-for-adding-imagebutton-components/734 "2023-01-31T11:16:52Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![soastao](https://forum.castle-engine.io/letter_avatar_proxy/v4/letter/s/67e7ee/32.png) [@soastao](https://forum.castle-engine.io/u/soastao)
#### Post date: [January 31, 2023, 11:16am UTC](https://forum.castle-engine.io/t/suggestions-for-adding-imagebutton-components/734/1 "2023-01-31T11:16:52Z")

</div>

I hope CGE can add a imagebutton component， there are four status：normal、hover 、pressed、disable (corresponding to 4 images)，support text display on the image

This component is very common and can greatly improve the beauty of the UI

RPG GUI contruction kit v1.0 Made by Lamoot, released under CC-BY 3.0, all images used in the process are self made or from public domain sources.  
Found at [https://opengameart.org/content/rpg-gui-construction-kit-v10](https://opengameart.org/content/rpg-gui-construction-kit-v10)

I slightly modified to get four buttons pictures on the basis of RPG GUI contruction kit， for testing

![btn_Stand_Grey_Normal](https://forum.castle-engine.io/uploads/default/original/2X/d/deba7eebbf6ac088819056b96cf2c514b199d810.png)  
 ![btn_Stand_Grey_Hover](https://forum.castle-engine.io/uploads/default/original/2X/0/052d891ac6b3d431eaa6261053f3e887c780184a.png)  
 ![btn_Stand_Grey_Pressed](https://forum.castle-engine.io/uploads/default/original/2X/8/80f97008465be6dca0dc959733e77afac6a9ed0d.png)  
 ![btn_Stand_Grey_Disable](https://forum.castle-engine.io/uploads/default/original/2X/0/04380709228f7d1ed26fe592e8b149869288b0aa.png)  
 ![rpg_gui_v1](https://forum.castle-engine.io/uploads/default/original/2X/e/e03dcf6e2d0a4f6aff7cb0b239f6af1452baa3c5.png)  
 ![preview_6](https://forum.castle-engine.io/uploads/default/original/2X/d/d169fb5f30adf406b9ff692e9a48553b3936c423.jpeg)  
[ImageButton.zip](https://forum.castle-engine.io/uploads/short-url/8KhJFgLEmXiaw6M43QOPtzD9feB.zip) (99.9 KB)  
[rpg\_gui\_v1.zip](https://forum.castle-engine.io/uploads/short-url/9qxBU1UR25Ff59ZiglNXKjwqCP2.zip) (2.8 MB)

---

<div class="post-metadata">

### Author: ![eugeneloza](https://forum.castle-engine.io/user_avatar/forum.castle-engine.io/eugeneloza/32/12_2.png) [@eugeneloza](https://forum.castle-engine.io/u/eugeneloza)
#### Post date: [January 31, 2023, 12:55pm UTC](https://forum.castle-engine.io/t/suggestions-for-adding-imagebutton-components/734/2 "2023-01-31T12:55:44Z")

</div>

`TCastleButton` already supports this. You just need to set `CustomBackground = true` and then fill in CustomBackgroundDisabled/focused(=hover)/normal/pressed

 ![2023-01-31 14_54_46-Greenshot](https://forum.castle-engine.io/uploads/default/original/2X/2/29e413eb7f5650b30cf2121198053109afdfb9e5.png)

---

<div class="post-metadata">

### Author: ![michalis](https://forum.castle-engine.io/user_avatar/forum.castle-engine.io/michalis/32/3_2.png) [@michalis](https://forum.castle-engine.io/u/michalis)
#### Post date: [January 31, 2023, 2:00pm UTC](https://forum.castle-engine.io/t/suggestions-for-adding-imagebutton-components/734/3 "2023-01-31T14:00:29Z")

</div>

Indeed, and see `examples/component_gallery/` for a demo how to use UI in various ways, including various TCastleButton setups.

Note that you need to provide now images for different state separately, but we also have PR to allow to use just an atlas for UI and choose regions from it: [New property TRegion for TCastleImagePersistent allows selecting a cropped region from a UI image set by Freedomax · Pull Request #442 · castle-engine/castle-engine · GitHub](https://github.com/castle-engine/castle-engine/pull/442) .
