Consider a shopping form where the products available for purchase are loaded in a freestyle grid. By dragging the product photo to the cart image you add that product to your shopping cart.
1. Define two variables called &productsdt and &productsdtitem, based on the following SDT:
2. Code the "Drag" Event. The "photo" is an image control loaded for each product in the grid. In the drag event the &productsdtitem is by default an "out" parameter, and is loaded with the productid and productname values.
Event photo.Drag(&productsdtitem)
&productsdtitem.productid = &ProductId
&productsdtitem.productname = &ProductName
EndEvent
3. Code the "Drop" Event. "Cart" is the image where products are dropped to be purchased. The "in" parameter for this event should be the &productsdtitem, or any variable based on the same SDT that &productsdtitem is based on.
Event cart.Drop(&productsdtitem)
msg('Buy ' + &productsdtitem.productname)
EndEvent
Related links: Developing Drag and Drop in Web Panels