Add a generic GuiButton class

As a Roblox developer, it is really strange to have to use ImageButtons or TextButtons for textureless and textless buttons in UI development. I find myself using simply colored buttons for things and having to use a specialized button for a generic purpose feels really weird. It’s always felt weird because that’s not what they’re made for.

If a generic GuiButton class that was just a button with no text or image were added, I would feel more comfortable using buttons that weren’t text or image based.

A great example of when you would have to use a blank ImageButton or TextButton is if you were designing a UI that had multiple pieces of text or images inside of an area that was meant to be one clickable space. I’ve had this happen specifically when making lists of clickable elements that have text and an image in them. I end up having to put Labels seperate from a blank button, which is weird because I’m essentially misusing an existing class to replicate basic functionality. It works, but we could do with a generic alternative.

56 Likes

I almost never use the TextButton class’s text property simply because there’s no option to handle where exactly your text will be. Sure, there’s a text truncation property, but I’d have full control over where the text is in a button.

Overall though, I agree with the post - I think another thing that could work is to replace the Image & TextButton classes, and instead combine them both into a single object with perimeters to activate the text or image properties, the text having a better text position property. .

11 Likes

I think creating a new class is the wrong approach.

Why should we have to choose between text, an image background, or specifically neither? Both TextButtons and ImageButtons should be rolled into one class. What if I want a button with a generic button background image and dynamic text on top? I otherwise need to use an ImageButton and manually place a Label myself. If I want a featureless button element, I should be able to do that simply by not providing any visual properties.

11 Likes

There’s no padding option for text objects, such as actual text placement.

2 Likes

At first it sounded like you wanted another button class to be added, just with less properties. But combining the ImageButton and TextButton properties is a really good idea (if that’s what you were implying).

5 Likes

I’ve thought about it more, and as much as I like the idea of combining image & text labels into one class, you’re still going to have the problem of not being able to place text correctly, and thus, I feel like a blank class should replace the TextButton class, with TextLabels / TextBoxes replacing the text functionality.

However, if Roblox is able to add proper text positioning to objects with TextProperties, then I think a class that combines both TextButtons and ImageButtons could work out fantastically.

I would really appreciate this. Although the same effect can be achieved by clearing the specific properties of a TextButton or ImageButton, a broader context variant makes sense without redundant text/image rendering.

Example: A button without an image texture that has a dynamic text element (e.g. text that changes position when you hover over the button).

Another example: A catch-all button that encompasses a multitude of elements.

Bumping this.

I use quite a large number of buttons in my game, and the vast majority of them are ImageButtons that I don’t use the Image property for. This is because most of the time, slapping on an image for the button isn’t enough, as there may be other decorations placed on the button (such as moving objects), or none at all.

2 Likes

Bumping this, many of us don’t use traditional Image / Text Buttons, we add the text and images inside the buttons manually ourselves because we have more control. I only want a generic button that I can script input on and that’s it.

9 Likes

did you know it already exists?

but…

IT’S NOT CREATABLE AND BROWSABLE!

That’s because they actually want us to use blank TextButtons instead of this generic class

Only one class for button what contain text image and togable would be good also a frame should have an option for text and image togable too it reduces classes we use but if Roblox will implement we need to change it manually like they did with the wedges when wedges became part of the part I inserted a old model of me with that wedges and noticed you need to change that manually

If they wanna bloat up my used up memory there’s other ways to do it. I have thousands of TextButtons that are blank, those have several properties that are unused which add up overall. This is just bad design by Roblox.

I much prefer the idea of a Generic Button Instance. I never use the TextButton’s Text and I rarely use the ImageButton Image Property.

It is true that it already exists:
image

But alas:

I dont see a reason why it couldnt be made accessible though. Doesnt seem like it would break any backwards compatibility.

1 Like

textbuttons and imagebuttons shouldn’t have existed from the start. all we need is a UIbutton

5 Likes

Please actually give usecases for this feature and don’t just send replies going “grrr Roblox should add this.” It doesn’t help this request and it just spams my notifications.

1 Like

I’ll give you a usecase for a button instance, a “button”, it’s this really cool thing, not sure if you’ve heard of it.

The GuiButton class is abstract, meaning you aren’t meant to instantiate it. Its methods and properties are supposed to be inherited by its subclasses, which as you can see are ImageButton and TextButton. Another example would be the GuiBase class, which GuiButton inherits from, along with frames, screenguis, etc.

cc: @alpharetzy2, assuming you were referring to the GuiButton class as well.

Anyways, I personally disagree with this feature request. If you want to avoid using a blank ImageButton/TextButton instance you can just use a Frame and connect a function to its various input events.

1 Like

I know that, but some other classes inherit another class, but both of them are creatable:
image
image
image
So I dont see why GuiButton couldnt be like this as well.

The problem is that Frames function fundamentally different from TextButtons and ImageButtons. They do not have events such as MouseButton1Click, Activated, etc, as well as properties (AutoButtonColor, Modal, etc).

3 Likes

You may not have noticed, but we already have buttons in Roblox! They’re pretty cool. :slight_smile:

The question is “why do you need this button?” and you seem to be unable to answer beyond “I want it”. Justify it. Don’t just go “buttons are cool” because it accomplishes nothing.

Why should Roblox go into the engineering effort to add a generic GuiButton class?

1 Like