In Thunkable Drag and Drop I have 11 labels, each setting an appvar WhichLabel (1 to 11) when pressed, so I know the position of the pressed label.
I also have a list of them: Set LabelList to +list L1, L2…L11.
I want to be able to change the text of the pressed label based on other conditions.
I then test the position (1 to 11) to determine the new text.
I want to change the text of the pressed label using the indexed array, not repeating the code in each label click.
I’ve tried
Count with I from 1 to 11
set property “text”
of object in list +list app var LabelList get # i
To app var GotLabel
This does not retrieve the proper label, so the text is not updated.
I can help with this but it would be best to post a link to your project so I can modify what you have and explain the changes.
Is the idea that when the user clicks on a label, the label’s text updates with the next consecutive number? For example, “button 3” becomes “button 4” or is this more like a calculator where the total gets updated when certain buttons are pressed, like “3” “+” “4” becomes “7”?
Hi tatiang,
I’m guessing this goes directly to you.
I’m a newbie to Thunkable (I have done LOTS of code with basic, yeah basic) and don’t know how to post a link. I’d be happy to if I knew how.
The idea is to change the normal blank label to different texts, depending on other conditions. Set property “text” of object in list does not work. I JUST learned about set label component’s text to “label”, but haven’t tried to use it yet. Some of Thunk’s blocks are really hard to find, and NO docs telling about their many quirks. Lists of labels do not work as a real array, so I am stuck.
It creates a copy of it so that any changes I make to it do not affect the original version you have. Typically, I can then share screenshots of changes or a link to the updated project so you can continue to edit it.
I made a lot of changes since I posted, and it is working A LITTLE. It only gives a ? If I guess at the top row. If I remove the wait on each ShowRGuess it doesn’t work. The game is to guess R G B levels to match the random target. I want a ? for each guess and X for the last accepted guess. Each guess should erase previous guesses. I saw this game at Epcot about 50 years ago and coded for my kids on an Apple II that I bought from Mark Wasniak, Steve’s brother. Haven’t coded anything for at least 10 years and wanted to revive it for my grandkids.
Sure hope you can figure this out. ChatGPT was surprisingly pretty useless.
In another coincidence of… age… my best friend won a bicycle from Steve Wozniak when he visited my friend’s school about 40 years ago. He still talks about that!
ChatGPT isn’t that much help with Thunkable. It tends to pull outdated or incorrect information. I think it’s especially hard since it’s not technically a scripting language (which AI bots do best with).
I’m heading out tomorrow morning for a camping trip with my 5th grade students so I’m not sure I can get to this tonight but someone else may be able to take a stab at it.
Thanks so much for hanging in there with me, many wasted hours.
This is my first Thunkable project, so I’m still on the free version. I don’t have the old version anymore.
I just wanted to be able to look up which of the 33 labels or buttons (R G B x 11 shades) was clicked, and change the text of it to “?” if a new guess, “X” if it was the previous guess, or blank if neither.
I could not find a way with “count with i from 1 to 11” or “for each item j in list”. Tried properties, component, etc. No luck.
I finally checked EACH of the 33 labels and then changed the text, just brute force. VERY inelegant, LOTS of blocks.
ChatGPT was pretty useless trying different methods, but I learned Thunkable is very deficient at handling arrays, which is what I needed.
Any ideas about how to determine the clicked label and change the text, like it is an array? Here is a screenshot of the app and blocks of the old version. I could use the info for my next app, if Thunkable can handle it.
I would use a Data Viewer List with a custom layout.* It’s would be quick to design, quick to implement, and very easy to adjust later. And you can determine which row/color is clicked easily.
But since you used many labels, your only option is to use Any Component blocks. If you are not familiar with those, they can be confusing at first. But here’s an example of how to display text on the clicked label:
Note that you have other rules that make the new text disappear after a short delay.
*Any time I find myself doing repetitive tasks in Thunkable, I stop and think about or ask about a better way to do it. So for next time, you’ll know to avoid making 30 labels on one screen, for example.
Thanks again for the help. Unfortunately, this block does allow me to change <component, but since I don’t know which one, I can’t evaluate the response, since I am not able to tell which label. ChatGPT and I could not find a way to return the component name, and we tried MANY variations, properties, etc..
Do you know how to retrieve the clicked label name? Again, for each color, if the clicked is a new guess I want “?”, and if it’s the last accepted guess I want “X”, otherwise “ ”. “When any label click” does not return the label name, only a link (long multi-character ID) to the clicked label.
And is all this dialog appropriate for Community? Should we start a separate email thread?
It’s best to keep discussions here because it benefits the whole community both in the short-run and the long-run.
You said you want the label name. I assume you mean something like “G9”. There’s not a way to do that directly but there are some workarounds. One option is to set the text of each label to the name you want such as “G9” and then set the text color to match the label’s background color so it’s not visible. Another option is to get each label’s component order on the screen:
Thanks again for the insight. A lot of non-intuitive quirks in Thunkable.
I added a block exactly like yours, and it returns the sequence number of the clicked label text, just like you said.
A simple list will figure out which button. Not very elegant.
My “brute force” version works perfectly, so it’s not worth reprogramming.
On another note, I want to make a .dmg for android, and a comparable app for IOS, but it doesn’t look like the free version allows this. I don’t care about “publishing”, just want to share with family and friends. Is there a way?