Message Boards Message Boards

Back

Place Drag Object onto Drop Zone based on Tag List

Toggle
Hello fellow Smartbuilders. 

I am fairly new to the visual programming language, but a long time C# developer.
In the drag and drop interaction I am building, I want to auto-move incorrect zone drops to the correct zone, based on the tag that the drop object carries.


Currently I am in a situation where I would have to hard-code every drag interaction, because I have NO idea how to check if a object carries my tag, how to confirm its the correct one, and move it to the right spot.
Can anyone help me out?


Some screenshots of what the Action blocks might look like, would be a great help to better understand this visual programming language.
Thank you very much for your time.
0 (0 Votes)

RE: Place Drag Object onto Drop Zone based on Tag List
Answer
6/23/22 11:51 AM as a reply to Daniel de Ridder.
A bit of tinkering later, and I managed to put together the way I thought it would work.
(At least, how I would tackle it in different software)

But it doesnt.
Also included, a screenshot of the round-about way I implemented this functionality now, without tags. 
Deadlines are a hassle, but I would still love to learn how to implement this feature based on tags.
0 (0 Votes)

RE: Place Drag Object onto Drop Zone based on Tag List
Answer
6/23/22 5:28 PM as a reply to Daniel de Ridder.
Hi Daniel,
I think you're really close, but there are a couple issues. One is a bug - this particular block (in the current release) has its labels switched. It will be resolved in our next update. (see attached "correction"). Note that when you use this block, you don't use the blue "tag list" block, because that is actually a list of all the objects (shapes, etc) that have that tag applied - instead you need use a simple text block (which is purple).

Another method of handling this is to use the tag list as a list. You can see if the last item dropped is in the list of objects tagged with "dz_both" (or whatever). You would use this block, found under the List category (see attached "as list").

If you want to send us your sb4 file (maybe save a copy of your lesson and trim to just that page), we'd be happy to record a video explanation. You can upload it here, or email us at support at smartbuilder com, and we'll post our video reply here.

Hope that helps!

- Nav
+1 (1 Vote)

RE: Place Drag Object onto Drop Zone based on Tag List
Answer
6/24/22 6:53 AM as a reply to Navdeep Dhillon.
Thank you Navdeep, the 'alternative' is exactly as short and concise as i was hoping the solution would be.
0 (0 Votes)

RE: Place Drag Object onto Drop Zone based on Tag List
Answer
6/24/22 5:32 PM as a reply to Daniel de Ridder.
Here's a fun way to make your DnD setup/initialization easier, too.
0 (0 Votes)