So I’m creating a program that uses the styledText.bold property in different buttons and methods. However, I am not sure how to utilize it correctly because when I call the buttons individually it bolds the last word only and when I call the buttons all at once it does not bold up any words. What am I doing wrong?
Welcome to Xojo programming Ayah,
I think the StyledText class is only for the text content you have in a TextArea control.
To have bold text displayed as the caption for a particular Button, you can do that either through code or in the Xojo IDE.
For example, in the Open
Event of the Window (or from another control or Method in the same Window) you can bold a button by calling the Self
(the current Window or Container), the name of the Button and the Bold
property and assigning True
, like so:
Self.PushButton1.Bold = True
Or try using an Event of the Button itself. For example, when you click on button, make the caption go bold. Use Me
(inside Events to reference the current control itself) in the Action
Event and the Bold
property, like so:
Me.Bold = True
Or in the Xojo IDE, simply set Font and other properties by highlighting the Button in the Design view, ensure the Inspector is open and click on the little gear icon in the upper-right corner for more properties to set.
If you’re just learning Xojo, or learning programming in general. There is a free getting started book/PDF you can download from here that will walk you through many of these basic features.
Good luck and don’t hesitate to use the forum if you have more questions.
Sorry I just realized my mistake in my question. I meant I used the styledtext.bold property in the event handlers and menu handlers my bad just starting out.
No worries Ayah. It is entirely possible I also misunderstood what you were asking, now that I think about it a bit more.
All the best!