I’m trying something like this but it’s not generating the result I’m wanting.
(I knew this wouldn’t do it, I’m just trying to illustrate what I want to accomplish)
It is easily done in the StP (Snap to Place) UI.
- Open a screen.
- Add a row to the screen
- Set horizontal alignment of the row to “Left”
- Add two labels with different colors
- In the Screen.Opens block, write what you want in the two labels.
You get something like this’
Ya I thought about using 2 labels, but that causes me to have to create more blocks and all, I wanted a way without having to use a 2nd label, thanks though.
How many words will you need to display?
(Or…what’s the maximum number of words you’ll need to display?)
It could change from time to time, ideally there wouldn’t be a limit.
You really need to provide more details. There are ways to do this with clone blocks, for example, but so much depends on how many colors you need at one time and how those colors are being chosen (by the user, by you, are they always the same or variable colors, etc.).
Ok for simplicity let’s say I just want to highlight some text, we’ll say just 1 word in the middle of a sentence.
For example I want to emphasize the letter x in a math problem like 4 x 4
I want to make the x red and the 4s black
Let’s start with this, is this a simple task without creating additional blocks, can it just be done in line
When you simplify your question, you’re going to get simple answers. That’s just the way it works around here. So yes, you can easily set up something where the operator (“x”) is a different color from the factors.
You would just have three labels, one for each “4” and one for the “x”. And then you would use the label block for each component to set the colors as needed.
You also didn’t say whether the user is generating the text or you’re providing it. It’s much easier if you’re providing it.
But I asked if it can be done in the same label. Just 1 label.
Yes the app would automatically do it, not the user.
So no it cannot be done in 1 label?
No. And why do you need just 1 label? I realize it’s easier to code that way but if there’s another way – which there is – then it seems like you have an option that will work.
Adding additional labels adds the headache of reformatting to make sure everything lines up, then when I want to adjust something like make a label visible or not visible I have to add additional blocks in order to do so.
Like you described above I have to create 3 labels, which means I have to adjust each one and add blocks for each one.
I understand functions would help reduce these additional steps as well as putting those labels into a single row and just hide the row, but it’s not always that simple with complex apps.
I just wanted to save some repetitive steps and make things simpler.
No worries, thanks for the help everyone.
I can understand wanting to be able to do that. It would be much simpler!
My idea is to use clone blocks to create the labels and then dynamically refer to them as needed. So it wouldn’t take very many blocks to do that but it’s complicated to set up the first time.