Rectangular TextButton

How can I have a TextButton which does not have a rounded edges.

You can use setConnectedEdges() to make it square, but really if you need a particular shape, you should implement your own look and feel to draw it.

How can i use it? if i pass like this tvbtnrdytoplay.setConnectedEdges(30); then will get the only edges from top left and right only. did not get the result for bottom left and right.

Preferably don’t use the int but the names.

setConnectedEdges (TextButton::ConnectedOnLeft | TextButton::ConnectedOnRight);

HTH

what does the | mean?

This is the bitwise OR operator. This is how you combine bitmasks.

Thanks a lot daniel.
Can you please let me know how to set an image at top center of the screen for mobile?
i am tried this way but did not get it

DrawableImage.setBounds(getLocalBounds().removeFromTop(30));

TBH using the Drawables outside an SVG didn’t give me the expected results very often, that’s why I avoid the Drawable* classes.
Instead I have a member rectangle that I set in resized() and use that as bounds in the paint() method to draw using g.drawImageWithin() or similar…

They shouldn’t have been Components in the first place, so I don’t use them as Components (and you don’t have to)

okay if you do have any sample or class that use the drawables image then please send me here or paste it here. i am new to learn juce

Here is an example in a open source plugin I wrote a year back:

2 Likes

Okay. Do you know how to create button like this. i want to create exactly same way. i used Textbutton but unable to set the shape like this. please share code if you have

sample

https://docs.juce.com/master/tutorial_look_and_feel_customisation.html

This tutorial should give you a lot information on the way how widget customization is done with JUCE. When you got the rough idea about the LookAndFeel you probably will be able to figure out how to create the individual look you aim for by yourself :slight_smile:

1 Like