How to make an app - Andromo App Maker

Announcement

Collapse
No announcement yet.

DragDrop Library

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • DragDrop Library

    DragDrop.dll v.1.0.0.0

    DragDrop library will add drag and drop capabilities to ams applications. Right now the dll supports drag 'n droping for text (from wordpad, iexlorer etc) and files. You can drag 'n drop text and files right in the ams window.

    .Net 2.0 required.

    With Kind Regards
    sside

  • #2
    Wow. Outstanding. And it works all over the app! I just can't realize it's real :lol

    You did a more than wonderful jub on this mate. Thanks for that other contribution!

    Comment


    • #3
      Fantastic job. Thanks.
      Dermot

      I am so out of here :yes

      Comment


      • #4
        great work m8, superb even. I'll definately be using this.

        Comment


        • #5
          Drag and Drop - sside - .NET 2.0

          Mirrored on amsuser.com:

          http://www.amsuser.com/ams/examples/...T2.0-sside.apz

          Nice job sside.

          Note: .NET 2.0 is required.
          Intrigued

          Comment


          • #6
            Thanks for the feedback, i appreciate it.



            With Kind Regards
            sside

            Comment


            • #7
              This is fanstasic :yes

              i managed to get my drag n drop dll working but its very unstable and only single files accepted, this dll is just the ticket

              @ sside, do you have a donations page ?

              the whole community owes you for this little gem, i have been passing my droped file path from a PB window to a ams exe via commandline for my current project which is VERY messy, this will sort that out

              Thank you :yes
              Embrace change in your life, you never know, it could all work out for the best

              Comment


              • #8
                thanks sside :yes you're good & god!! xDD

                Comment


                • #9
                  Good Job sside,

                  Thank you,
                  This works very well.
                  Now,,, It's drag and drop time!!!

                  Thank You,
                  AudioSamIam:yes

                  Comment


                  • #10
                    Beautiful...

                    Thanks

                    Comment


                    • #11
                      Thanks for another awesome dll!!

                      Comment


                      • #12
                        Thanks much sside! Great DLL!:yes
                        Action Plugins
                        AllOn | Box | Class | Code | Cursor | DXML | Error | Frames | GlobalPaths | Group | INIPlus |KeyBind | KeyLock | MathEx | Menu | Name | PCall | Project | Resize | StatusBar
                        Download

                        Comment


                        • #13
                          vey useful.

                          now, how do i make it bring the project on top of other windows when i drag something over it, been trying to insert the code in the ontimer section where it fills in the status text box, but cant get it to work.. i figured i could use an if statement to grab the eventType and set the apps ontop status using the "DragOver" result as a trigger, but cant get it to work

                          Comment


                          • #14
                            well i couldn't get a stable result from trying to make it set the project to TOPMOST and bring it to the top of all other windows.

                            So i decided to mess around with some other code, to see if i could make it drag and drop only when i was within a certain object on the page, having decided that my input box was a little narrow for this i opted to put a hotspot object of a slightly larger size around it (and also to cover the browse for file button) ... and target this object.

                            So i cannibalised some of Worms code (sorry buddy ) and set about making it trigger initially only on mouse over (i was going to play with the mouse button event too, but bearing in mind i have covered the browse button with hotspot i'm not sure what would happen) .... anyway, here's what i came up with..


                            Startup Code
                            Code:
                            DnD_on = false;

                            Global Code
                            Code:
                            -- Function to tell whether a point is in a given objects rectangle --
                            
                            function IsInRect(m_nX, m_nY, m_tblPos, m_tblSize)
                            	local bReturn = false;
                            	if (m_nX >= m_tblPos.X) and (m_nX <= m_tblPos.X + m_tblSize.Width) then
                            		if (m_nY >= m_tblPos.Y) and (m_nY <= m_tblPos.Y + m_tblSize.Height) then
                            			bReturn = true;
                            		end
                            	end
                            	return bReturn;
                            end
                            
                            
                            -- Function to Start and Stop Drag nDrop Dependant on cursor location --
                            
                            function Compare_Cursor_Location(e_X, e_Y)
                            
                            	tblObjects = Page.EnumerateObjects();  -- Get object names on page, put in a table
                            
                            	for index, sObject in tblObjects do
                            		if sObject == "file select" then
                            			if IsInRect(e_X, e_Y,  Hotspot.GetPos("Drag and Drop Area1"), Hotspot.GetSize("Drag and Drop Area1")) and DnD_on == false then
                            				-- Cursor is inside drag n drop area, start Drag N Drop Function + Timer --
                            				DragDrop.SetDataFormat(DataFormat.FileDrop);  -- set it to file drop mode
                            				DragDrop.Start(Application.GetWndHandle());  -- Start Drag n Drop monitoring
                            				error = DragDrop.GetError();
                            				if (error == "") then
                            					Timer2 = Timer.StartTimer("MultiTimer", 2, 100);
                            				else
                            					Dialog.Message("Error", error, MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
                            				end
                            				DnD_on = true;  -- set Drag n Drop running flag to on
                            			elseif not IsInRect(e_X, e_Y,  Input.GetPos("file select"), Input.GetSize("file select")) and DnD_on == true then
                            				-- Cursor is NOT inside drag n drop area, stop Drag N Drop Function + Timer --
                            				DragDrop.Stop(Application.GetWndHandle());  -- Stop Drag n Drop monitoring
                            				Timer.StopTimer( "MultiTimer", Timer2);-- Kill timer
                            				DnD_on = false;  -- set Drag n Drop running flag to off
                            			end
                            			break;
                            		end
                            	end
                            end

                            and, it works like a charm...... until i realised that if the project isn't in focus it doesnt work


                            anyone know a way around this ? the drag and drop dll obviously works when the project does not have focus, whereas the on mouse move event doesn't.... so i'm back to needing ti trigger an event when the mouse passes over into the project boundry !! ... i seem to have come full circle here

                            Comment


                            • #15



                              i figured it out

                              apart from the superfluous tbl enumeration and loop, it was the application window handle it was stumbling on .... i've now declared that elsewhere and it works

                              here's what i have now....

                              Code:
                              -- Function to tell whether a point is in a given objects rectangle --
                              
                              function IsInRect(m_nX, m_nY, m_tblPos, m_tblSize)
                              	local bReturn = false;
                              	if (m_nX >= m_tblPos.X) and (m_nX <= m_tblPos.X + m_tblSize.Width) then
                              		if (m_nY >= m_tblPos.Y) and (m_nY <= m_tblPos.Y + m_tblSize.Height) then
                              			bReturn = true;
                              		end
                              	end
                              	return bReturn;
                              end
                              
                              
                              -- Function to Start and Stop Drag nDrop Dependant on cursor location --
                              
                              function Compare_Cursor_Location(e_X, e_Y)
                              		if IsInRect(e_X, e_Y,  Hotspot.GetPos("Drag and Drop Area1"), Hotspot.GetSize("Drag and Drop Area1")) and DnD_on == false then
                              			-- Cursor is inside drag n drop area, start Drag N Drop Function + Timer --
                              			DragDrop.SetDataFormat(DataFormat.FileDrop);  -- set it to file drop mode
                              			DragDrop.Start(handle);  -- Start Drag n Drop monitoring
                              			error = DragDrop.GetError();
                              			if (error == "") then
                              				Timer2 = Timer.StartTimer("MultiTimer", 2, 100);
                              			else
                              				Dialog.Message("Error", error, MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
                              			end
                              			DnD_on = true;  -- set Drag n Drop running flag to on
                              		elseif not IsInRect(e_X, e_Y,  Input.GetPos("file select"), Input.GetSize("file select")) and DnD_on == true then
                              			-- Cursor is NOT inside drag n drop area, stop Drag N Drop Function + Timer --
                              			DragDrop.Stop(handle);  -- Stop Drag n Drop monitoring
                              			Timer.StopTimer( "MultiTimer", Timer2);-- Kill timer
                              			DnD_on = false;  -- set Drag n Drop running flag to off
                              		end
                              end
                              so i was wrong, it wasnt the on mouse event not triggering :o

                              now to get this dam ontop thing sorted lol, also a way to move the cursor to the end of the input box after i've dropped the file would be handy for long file paths, so i can see the file name, i know i can set focus to the input box after dropping the file to it, so how to go to the end ?
                              Last edited by qwerty; 02-27-2009, 06:41 PM.

                              Comment

                              Working...
                              X