Drag and drop between 2 lists

Home Forums General Programming Drag and drop between 2 lists

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #68456
    goodweather
    Participant
      • Topics: 45
      • Replies: 550
      • Total: 595
      • ★★★

      Hi,
      is one of you aware of (or did one of you tried) drag and drop between 2 lists of patches? I would like to build this functionality as part of a librarian where the user could see 2 banks of patches at a time and where he would also have some kind of clipboard area.
      He would drag one patch from one list to the clipboard leaving a hole in the list that could be filled in by dragging and dropping another patch from the second list.
      The clipboard area would for example be a list of 10 slots (an dhwy not a complete full empty bank).

      The drag and drop demo panel is showing drag and drop but with images. I cannot predefine images for each patch name in advance…

      Thx for any help/suggestions on this…Dominique

      #68459
      dasfaker
      Keymaster
        • Topics: 80
        • Replies: 793
        • Total: 873
        • ★★★

        This is doable with a single customComponent. Create one zone for each bank and divide each zone creating a kind of table, with columns and rows. Calculating the position of each cell based on x/y coordinates you can know the cell number you click or drag. You will need to draw the patch name of each bank in all the cells, and create the methods for mousedown, etc, as well as manage one memoryBlock for each bank data.

        #68460
        goodweather
        Participant
          • Topics: 45
          • Replies: 550
          • Total: 595
          • ★★★

          To be honest, I have not grasped the difference between a Custom component and a predefined one. Is there some explanation somewhere? Otherwise, my plan was to do as you explain (with the click, I can figure out what to drag) and my question was how to get an image (or a text) to drag.
          At the moment, my idea is simply to drag an empty colored rectangle. How can I draw the patch name on the fly? Easiest would have been to drag a text box rectangle…

          #68461
          dasfaker
          Keymaster
            • Topics: 80
            • Replies: 793
            • Total: 873
            • ★★★

            A customComponent has no defined behavior for mouse events nor drawing routine, you have to program them (it has a lot of methods available to do that). It’s an empty component where you can do anything (you can create a knob, a slider, a button, a table, display images, drawing routines, anything).

            Take a look at the arp page of the virus panel, it has a customComponent that shows how to deal with the mouse and drawing routines.

            #68601
            goodweather
            Participant
              • Topics: 45
              • Replies: 550
              • Total: 595
              • ★★★

              I checked the ListBox component and it is really nice with the automatic scrollbars. Exactly what I need to display the content of the banks in a limited height of a panel.
              Looking to the Demo panel – Drag and Drop, I saw that there are different properties used for Drag and Drop:

              • Paint callback
              • Called when dragging starts
              • Called to check if component is interested in drag event
              • Called when an item is dropped
              • Called when dragging enters this component

              Now, I can do something with the Listbox properties “Called when a mouse is dragged over this component”, “Called when a mouse is down over this component” but I don’t have anything to precisely secure the drop.

              Any help from someone?

              Atom, would it be possible to add the Drag and Drop properties to the ListBox component?
              OR do you have some other suggestion?

              Thx to all for advice!

            Viewing 5 posts - 1 through 5 (of 5 total)
            • The forum ‘Programming’ is closed to new topics and replies.
            There is currently 0 users and 142 guests online
            No users are currently active
            Forum Statistics
            Threads: 2,495, Posts: 17,374, Members: 77,605
            Most users ever online was 12 on January 22, 2019 3:47 pm
            Ctrlr