Is there a way to detect a click in a cloned Group or Container using Layouts (beta)?

Edit: Okay, I did figure out that I can clone a group within a layout. So that will work. I just don’t understand why a group can be created within a screen but not cloned within a screen. But I guess that answer is to just use a layout instead of the screen when selecting the clone destination.

Edit #2: I did figure out that I can clone a container that has a button inside with width and height filling the container. The button is transparent and at the top level of the component tree. But when I detect a click using an Any Button Click block, it only works if there is nothing underneath the button. Once I add a label, for example, under the button, the click is not detected by the button when I click in the area of the label. (Bug report: Button click detection fails when underlying components exist · Issue #1183 · thunkable/thunkable-issues · GitHub)

— start of rant —

But uh… groups don’t have margin or padding settings. So nevermind! Why can’t components ALL have the same properties available?! It’s like I have to do trial and error for hours until I can figure out which mix of things will do what I want when it’s pretty straightforward to just assume I can clone a group and click on it. But I can’t. Or I guess I can but it will look terrible. All this to avoid DVL limitations (not being able to sync to a cloud database directly).

And I can’t put a group in a container otherwise I could use the group’s click event and the container’s padding/margin settings. But nope!

— end of rant —

I’ve decided to use clone blocks to create a “DVL” effect. And I’d like the user to be able to click on a “row” of the DVL. I know I can detect clicks in cloned components such as buttons but for the effect to be good, I want the entire container/group to be clickable.

The problems I’m running into:

  1. Containers do not have click events associated with them within Any Component blocks.

  2. Groups cannot be cloned within a screen.

These are the two ways I’ve tried to set up a container/group that can be cloned and clicked:

1 Like

I think I solved this by detecting a button click and label click in a cloned container:

It’s not pretty but it works.

2 Likes

This is exactly what I do! Not elegant, a bit convoluted in fact, but it works.

1 Like

Hmm… detecting a label’s click only works when I click on the text, not when I click on the blank area of the label component where there is no text.

I was hoping to use a button to overlap the other components but that doesn’t work or at least I can’t figure out how to layer components in a Container.

How do you usually set this up? Maybe I just need to use buttons instead of labels. Oh but then I can’t left justify the text in the button. :cry:

1 Like

I did create a workaround for a label’s blank area not detecting a click. I just “pad” the end of the label with spaces*. See the sections highlighted in yellow:

That way, the entire width of the label/container is “clickable.”

*Actually, spaces do not work. But non-breaking spaces do work (option+space).

2 Likes

I’m very frustrated that there’s no simple way to create a custom DVL layout using the Drag and Drop interface. Groups can’t be saved as custom layouts (why not?). Containers are in beta and are hard to work with and unpredictable. For example, this Layout has a single container with alignment set to horizontal. It contains an image (for some reason not visible…?!) and two labels. But the labels aren’t in horizontal alignment. And then to make matters worse, in addition to there being two containers visible even though it only contains one, when I click on the actual container it either (a) selects the container, (b) selects the screen, or (c) selects on of the labels. Here’s a link to a private project that demonstates this. And a screen capture of my woes:

https://watch.screencastify.com/v/KlJwUF39k44AljQoPxL5

Bug report submitted here: We need a reliable, easy way to create custom DVL layouts in DnD · Issue #1236 · thunkable/thunkable-issues · GitHub

Edit: I realize I didn’t add the components to the container which is the cause of part of these problems. But even that’s more difficult and non-intuitive than it should be.

1 Like

Preach. One day the beaver gods will listen and respond. Right?

1 Like

@tatiang I will take some time here this week and go through everything with the custom DVL layout and put out a small video detailing how it’s used. I haven’t had the chance to use it as much as I’d like. We’ve been doing quite a bit of regression testing involving this anyway as we’re pushing forward with getting Layouts out of Beta.

@jared I know you asked about layouts and our beta process in general. It’s one that needs some refinement. Layouts should be out soon, I am hoping for this quarter still. It will mainly be the same as what you see now–we’re still working on some bug fixes with the component and maybe one or two more things for how a component is added to the layout.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.