Re: Drag and drop within a list field
Devin, Thank you for the link below. I find it interesting that Scott did not use any of the "drag" messages for dragging a line within a field. He did use the rarely used "before mouseDown", "before mouseMove" and so one to capture various mouse messages related to drag actions and coded the drag and drop behavior there. One thing I have noted is that in LC 9.6.2 STABLE "dragMove" is only sent while the mouse is moving. "mouseMove" is similar. Scott used in his sample stack a "send in time" action to keep autoscrolling smooth if the drag action required the field to autoscroll. I would have hoped there was a better way to autoscroll a field during a drag operation within the field in LC, but apparently not. I guess I will need to adapt the "send xxx in 80ms" trick for smooth autoscrolling during a drag to my code. Thank you for the pointer to Scott's sample stack! On 7/16/2021 11:48 AM, Devin Asay via use-livecode wrote: Hi Paul, Some years back Scott Rossi created a nifty little demo called GetInLine that shows how to do the interface part of drag-reordering. It’s in his archive at http://tactilemedia.com/blog/2018/05/12/blasts-from-the-past/. It might give you a good foundation, even if you don’t use the exact interface he created. I don’t think the data part of it should be too hard; just make sure you keep the visible list and the custom property synched the same. Or you could possibly use hidden text or metadata tags in you visible list to embed the type for each line. Hope this helps. - Devin ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and drop within a list field
Paul: > the data in the custom property look like: > codename1 That's backwards, try this: name1code And with a tab stop, you may not need a custom property! Fields can hold more content than what meets the eye. > foldernameA Do you really need "folder" and "code" spelled out? Redundant content will limit performance/list size. I would aim for either: nameAf name1c or: nameA1 name12 ... where 1 and 2 etc are unique IDs and match a data array. Way better than trying to mirror the content in a prop. > The user must keep moving the mouse around slightly > so that continual dragMove messages are sent Messages are messages, ditto for commands, "never the twain." Keep them separate, user a timer or an alternate message. Messages are handy - not holy. > coding drag and drop operations in LC > is one of the areas I am least familiar with. One of the most fun areas, really. Way back during college, I remember using (probably HC?) to whip up a class schedule drag-and-drop UI because I had transferred between U's and had to fit just the right things in one semester. The other students were doing this with pencil and paper. It was a smooth stack, light-years ahead of its time. My counselor was surprised at the classes I fit in. And since then, LC drag and drop just gets more fun! (Although, as I hinted one conference, we're moving beyond that stage pretty soon in the history of app dev.) Best wishes, Curry Kenworthy Custom Software Development "Better Methods, Better Results" LiveCode Training and Consulting http://livecodeconsulting.com/ ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and drop within a list field
Hi Paul, Some years back Scott Rossi created a nifty little demo called GetInLine that shows how to do the interface part of drag-reordering. It’s in his archive at http://tactilemedia.com/blog/2018/05/12/blasts-from-the-past/. It might give you a good foundation, even if you don’t use the exact interface he created. I don’t think the data part of it should be too hard; just make sure you keep the visible list and the custom property synched the same. Or you could possibly use hidden text or metadata tags in you visible list to embed the type for each line. Hope this helps. - Devin > On Jul 16, 2021, at 9:06 AM, Paul Dupuis via use-livecode > wrote: > > I have a scrolling list field that has contents like: > > name1 > name2 > nameA > name3 > name4 > name5 > nameB > name6 > name7 > nameC > name8 > etc. > > the field has a custom property with the contents and a "type" for each name, > so the data in the custom property look like: > > codename1 > codename2 > foldernameA > codename3 > codename4 > codename5 > foldernameB > codename6 > codename7 > foldernameC > codename8 > etc. > > The type for each line can be either 'code' or 'folder'. I am trying to craft > code for the field script that supports dragging a line that is a 'code' or > 'folder' onto a line that is a 'folder'. You can not drag a 'code' or > 'folder' onto a 'code' line. > > I have a dragStart, dragMove and dragEnd handlers, but something is off with > my code with regard to autoscrolling the field. (the actual list of names is > much longer than my example above). When dragging near the bottom of the > field, I try to detect if I am within a textHeight of the bottom of the field > (or top if scrolling up) and and scroll the field, but it is very jerky. The > user must keep moving the mouse around slightly so that continual dragMove > messages are sent and I have other problems with highlighting the destination > line when you are over a 'folder' that you can drop on. > > Does anyone have some "best practice" code for this capability that they > would be willing to share? I admit coding drag and drop operations in LC is > one of the areas I am least familiar with. > > ___ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode Devin Asay Director Office of Digital Humanities Brigham Young University ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag-and-Drop with Desktop Files
I'll toss together an Applescript for you when I get a chance. Bob S > On Mar 14, 2019, at 06:25 , R.H. via use-livecode > wrote: > > I am referring to: > Message: 17, Date: Thu, 14 Mar 2019 00:44:05 +0100, From: hh > > > Regarding MacOS I can not say much, but I use Windows, and IT WORKS. > > 'hh ' = Hermann's contribution, right? This fantastic. I never expected > anybody to have a solution. I had searched Git and whatever. > > Well, first it did not actually work because spaces in the folder- and > filenames are breaking the script. There will be an error message. So, I > have added these script lines to what 'hh' had posted: ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag-and-Drop with Desktop Files
I had drag and drop in my macOS app but … when going with the AppStore, and sandboxing, there was no way for drag and drop to trigger the sandbox permission that would allow the app to read that file. I knew which file, but since it did not go through the dialog box, the permission wasn’t set. So I took drag and drop out of my app and it passed store app review. Kee > On Mar 13, 2019, at 4:44 PM, hh via use-livecode > wrote: > > ** Get selected files of the file manager (without user interaction like > dragDrop) ** > > (I write the following such that also beginners can read it.) > > +++ > [a] Solution for MacOS (tested to work on MacOS 10.14): > > (a1) Put the following in a field "myScript". > > # Full path of selected items in Finder. > tell application "Finder" > set finderSelList to selection as alias list > end tell > > if finderSelList ≠ {} then > repeat with i in finderSelList > set contents of i to POSIX path of (contents of i) > end repeat > set AppleScript's text item delimiters to linefeed > finderSelList as text > end if > > > (a2) Script a button and create a field "OUT". > on mouseUp > do fld "myScript" as applescript > put char 2 to -2 of the result into r > put r into fld "OUT" > end mouseUp > > You'll get from the top-layered finder window lines with the full file names. > > (a3) Credits. > https://forum.keyboardmaestro.com/t/getting-the-path-of-currently-selected-file-in-finder/1507 > > + > [b] Solution for Windows (tested to work on Win 7+10): > > (b1) Save the following to a file "wscript1.js" in your stacks folder. > > var shellWindows = new ActiveXObject("Shell.Application").Windows(); > for (var i = 0; i < shellWindows.Count; i++) { > var w = shellWindows.Item(i); > WScript.StdOut.WriteLine(w.LocationName); > var sel = w.Document.SelectedItems(); > for (var j = 0; j < sel.Count; j++) { > var item = sel.Item(j); > WScript.StdOut.WriteLine(item.Name); > WScript.StdOut.WriteLine(item.Path); > } > } > > (b2) Script a button and create a field "OUT". > > on mouseUp > put the effective filename of this stack into p > set itemdel to slash > put "wscript1.js" into last item of p > put shell("wscript ") into fld "OUT" > end mouseUp > > You'll get for each explorer window its name and, for each selected file in > that, > the short file name followed in the next line by the long file name. > > (b3) Credits. > https://devblogs.microsoft.com/oldnewthing/?p=4593 > > + > [c] Solution for linux: > > Linux nerds of the use-list, please complete here (at least for ubuntu 1604) > ... > > > ___ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag-and-Drop with Desktop Files
Hi, I use MacOS or linux (on Raspi only), never really worked with windows. I'm using Windows only to test my stacks/apps on the PC of my youngest son. Scripting Host-WScript can execute JScript, the MS-extension of ECMAScript. It has a lot of features. We probably can use a lot of these features via LC's shell. I looked into that out of interest the first time last week. It is well documented: https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/wscript And it seems to be better maintained than VBScript. But there is NO method to get the selectedItems from the virtual desktop folder. Moreover, as you may notice, the selected items are deelected when you activate another window (as for example a LC window or an explorer window). The only workaround I can see (besides using an answer file dialog or dragDrop) is: 1. launch document specialFolderPath("Desktop") --> open desktop folder in explorer 2. User should select the files in that window. 3. Use the already working method for explorer windows. file "wscript1.js" (more compact output) var shellWindows = new ActiveXObject("Shell.Application").Windows(); for (var i = 0; i < shellWindows.Count; i++) { var w = shellWindows.Item(i); var sel = w.Document.SelectedItems(); for (var j = 0; j < sel.Count; j++) { var item = sel.Item(j); WScript.StdOut.WriteLine(item.Path); } } ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag-and-Drop with Desktop Files
hh, I have one more question for Windows: Selecting a file through Microsoft File Explorer on Windows 10 works for all selected files with your wscript, also when it is a Desktop file accessed through the dialogue. The problem I have is when the user selects a file _directly_ visible on the Desktop, wscript will not catch the file. Is there a way to find such selected files on the Desktop when users just selected files there? I am not familiar yet with wscript. And I can not catch this attribute using the files(specialfolderpath("desktop","detailed")) function in LiveCode. Thanks, Roland > I am referring to: > Message: 17, Date: Thu, 14 Mar 2019 00:44:05 +0100, From: hh < > h...@hyperhh.de> > > Regarding MacOS I can not say much, but I use Windows, and IT WORKS. > > 'hh ' = Hermann's contribution, right? This fantastic. I never expected > anybody to have a solution. I had searched Git and whatever. > > Well, first it did not actually work because spaces in the folder- and > filenames are breaking the script. There will be an error message. So, I > have added these script lines to what 'hh' had posted: > > -- Button script > on mouseUp > set the hideConsoleWindows to true -- Hide console window > put the effective filename of this stack into p > set the itemdelimiter to slash > put "wscript1.js" into last item of p -- Or construct any other valid > file path > --replace slash with backslash in p -- Not needed, works without > backslash conversion > put quote & p & quote into p -- Required if file- or folder names > contain spaces, and mostly they do > put shell ("wscript ") into msg -- or any field, ... > end mouseUp > > Tested: > Operating system: Windows 10, the latest version > OS scripting language: Wscript (Microsoft Windows Script Host File) > Filename of script file: "wscript.js" > Location: Here the call file is placed inside the stack folder (could be > any other location) > Script of the file as given by Hermann: > > var shellWindows = new ActiveXObject("Shell.Application").Windows(); > for (var i = 0; i < shellWindows.Count; i++) { > var w = shellWindows.Item(i); > WScript.StdOut.WriteLine(w.LocationName); > var sel = w.Document.SelectedItems(); > for (var j = 0; j < sel.Count; j++) { > var item = sel.Item(j); > WScript.StdOut.WriteLine(item.Name); > WScript.StdOut.WriteLine(item.Path); > } > } > > Biggest THANK YOU. You solved the client request in a very elegant way > and I create this script file "on the fly" from within LiveCode and execute > it on the client's Windows system. > > Thanks for all contributions > Roland > ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag-and-Drop with Desktop Files
** Get selected files of the file manager (without user interaction like dragDrop) ** (I write the following such that also beginners can read it.) +++ [a] Solution for MacOS (tested to work on MacOS 10.14): (a1) Put the following in a field "myScript". # Full path of selected items in Finder. tell application "Finder" set finderSelList to selection as alias list end tell if finderSelList ≠ {} then repeat with i in finderSelList set contents of i to POSIX path of (contents of i) end repeat set AppleScript's text item delimiters to linefeed finderSelList as text end if (a2) Script a button and create a field "OUT". on mouseUp do fld "myScript" as applescript put char 2 to -2 of the result into r put r into fld "OUT" end mouseUp You'll get from the top-layered finder window lines with the full file names. (a3) Credits. https://forum.keyboardmaestro.com/t/getting-the-path-of-currently-selected-file-in-finder/1507 + [b] Solution for Windows (tested to work on Win 7+10): (b1) Save the following to a file "wscript1.js" in your stacks folder. var shellWindows = new ActiveXObject("Shell.Application").Windows(); for (var i = 0; i < shellWindows.Count; i++) { var w = shellWindows.Item(i); WScript.StdOut.WriteLine(w.LocationName); var sel = w.Document.SelectedItems(); for (var j = 0; j < sel.Count; j++) { var item = sel.Item(j); WScript.StdOut.WriteLine(item.Name); WScript.StdOut.WriteLine(item.Path); } } (b2) Script a button and create a field "OUT". on mouseUp put the effective filename of this stack into p set itemdel to slash put "wscript1.js" into last item of p put shell("wscript ") into fld "OUT" end mouseUp You'll get for each explorer window its name and, for each selected file in that, the short file name followed in the next line by the long file name. (b3) Credits. https://devblogs.microsoft.com/oldnewthing/?p=4593 + [c] Solution for linux: Linux nerds of the use-list, please complete here (at least for ubuntu 1604) ... ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag-and-Drop with Desktop Files
I think he was trying to get the OS to tell him which files were hilited by the user without having to drag and drop. At least that is what I got from the post. Bob S > On Mar 12, 2019, at 11:17 , J. Landman Gay via use-livecode > wrote: > > See the entry for dragDrop in the dictionary. You can get the file paths from > there. > > on dragDrop -- check for file paths > get the dragData["files"] > ... > pass dragDrop > end dragDrop ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag-and-Drop with Desktop Files
See the entry for dragDrop in the dictionary. You can get the file paths from there. on dragDrop -- check for file paths get the dragData["files"] ... pass dragDrop end dragDrop On 3/12/19 10:46 AM, Bob Sneidar via use-livecode wrote: On a Mac you could just make an Applescript call to the Finder. Windows, I don't know. There is probably a powershell call that will do it. Bob S On Mar 8, 2019, at 06:46 , R.H. via use-livecode wrote: Desktop and IDE, mainly Windows 10 (could be any OS), LiveCode lastest version. Drag-and-Drop on Windows works as expected. But I have another request and do not know how to handle it so far. The OS should know which file a user has selected. Is there are a command or Shell function to know which files are selected in the Operating System to receive their file path back in LiveCode without much user interaction. The user shall NOT move the file as in Drag-and-Drop, but just click a button to know about these selected files and folders and process them as desired. Speaking about Windows, only folders and files in a current folder can be user-selected. So, if we had the information about the currently selected folder and the selected files and folders inside, it would be a huge advantage for the application I am working on. Thanks for any hint if this is conceivable. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag-and-Drop with Desktop Files
On a Mac you could just make an Applescript call to the Finder. Windows, I don't know. There is probably a powershell call that will do it. Bob S > On Mar 8, 2019, at 06:46 , R.H. via use-livecode > wrote: > > Desktop and IDE, mainly Windows 10 (could be any OS), LiveCode lastest > version. > > Drag-and-Drop on Windows works as expected. But I have another request and > do not know how to handle it so far. > > The OS should know which file a user has selected. Is there are a command > or Shell function to know which files are selected in the Operating System > to receive their file path back in LiveCode without much user interaction. > The user shall NOT move the file as in Drag-and-Drop, but just click a > button to know about these selected files and folders and process them as > desired. > > Speaking about Windows, only folders and files in a current folder can be > user-selected. So, if we had the information about the currently selected > folder and the selected files and folders inside, it would be a huge > advantage for the application I am working on. > > Thanks for any hint if this is conceivable. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: drag and drop of lines within a field
That was so cool I donated. Bob S > On May 3, 2017, at 06:46 , Tom Bodine via use-livecode >wrote: > > Hi Tiemo, > > I use Scott Rossi's "Get In Line" stack: > http://www.tactilemedia.com/site_files/downloads/getinline.rev.zip > > HTH, > Tom Bodine ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop with HTML5 Export?
On 2015-07-16 14:46, David Bovill wrote: Is this something that looks like it will be part of the first alpha? Have any test been done with drag and drop - or are we a way off establishing whether this will work? We do not currently plan to enable drag and drop in time for the first prototype release. Peter -- Dr Peter Brett peter.br...@livecode.com LiveCode Engine Development Team ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop with HTML5 Export?
Thanks for the head-up Peter. On 16 July 2015 at 13:54, Peter TB Brett peter.br...@livecode.com wrote: On 2015-07-16 14:46, David Bovill wrote: Is this something that looks like it will be part of the first alpha? Have any test been done with drag and drop - or are we a way off establishing whether this will work? We do not currently plan to enable drag and drop in time for the first prototype release. Peter -- Dr Peter Brett peter.br...@livecode.com LiveCode Engine Development Team ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop Linux, 7.0.5 64 Bit
Now entered in quality: http://quality.runrev.com/show_bug.cgi?id=15482 http://quality.runrev.com/show_bug.cgi?id=15482 Cheers, Malte ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop Linux, 7.0.5 64 Bit
Malte Brill wrote: Now entered in quality: http://quality.runrev.com/show_bug.cgi?id=15482 Thank you, Malte. Related: http://quality.runrev.com/show_bug.cgi?id=15479 -- Richard Gaskin Fourth World Systems Software Design and Development for the Desktop, Mobile, and the Web ambassa...@fourthworld.comhttp://www.FourthWorld.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop Linux, 7.0.5 64 Bit
Malte Brill wrote: did anyone of you get Drag and Drop to work in the 7.0.5 64-Bit Linux engine under Ubuntu 14.0.4 (LTS)? If so I would be very interested in learning how. Kinda FUBAR here: when I drag text within a field, it doesn't move the text but it does create a text dropping on the desktop, even though my mouse isn't anywhere near the edge of the window. What issues are you seeing? -- Richard Gaskin Fourth World Systems Software Design and Development for the Desktop, Mobile, and the Web ambassa...@fourthworld.comhttp://www.FourthWorld.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop Linux, 7.0.5 64 Bit
Hi Richard, What issues are you seeing? Not finished analyzing yet, but many. No Indicator shown on dragStart DragDrop doesn’t dragMove not sent to group owning the target / not handable in group containing the target dragEnter not handled properly All in all either seriously broken, or some magical prerequisite missing??? :-) Best, ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop
On 05/11/2013 06:54 PM, Richmond wrote: On 05/11/2013 06:30 PM, Mark Wieder wrote: Richmond- Friday, May 10, 2013, 11:46:45 PM, you wrote: As a result I gave up reading it and started thinking for myself. ...no good can come of that... Okay; let's rewrite that to this: I read the documentation, and when it does not help me I start thinking for myself. Richmond. And, further to that; the system in the documentation where users can add their notes, which are then shared around, seems to have gone wonky. Richmond. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop
On 05/10/2013 11:17 PM, Alejandro Tejada wrote: Hi Richmmond, Richmond Mathewson-2 wrote [snip] So I don't know where you got the idea that this used not to work: [snip] mouseStillDown is not mentioned in this article: http://www.hyperactivesw.com/resources_polling.html Why? Because RR/LC documentation has always been inadequate. As a result I gave up reading it and started thinking for myself. But, then, I have never been a great one for following other people's dialectics. Richmond. Al -- View this message in context: http://runtime-revolution.278305.n4.nabble.com/Drag-and-Drop-tp4664563p4664677.html Sent from the Revolution - User mailing list archive at Nabble.com. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop
Richmond- Friday, May 10, 2013, 11:46:45 PM, you wrote: As a result I gave up reading it and started thinking for myself. ...no good can come of that... -- -Mark Wieder mwie...@ahsoftware.net ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop
On 05/11/2013 06:30 PM, Mark Wieder wrote: Richmond- Friday, May 10, 2013, 11:46:45 PM, you wrote: As a result I gave up reading it and started thinking for myself. ...no good can come of that... Okay; let's rewrite that to this: I read the documentation, and when it does not help me I start thinking for myself. Richmond. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop
On 5/11/13 1:46 AM, Richmond wrote: On 05/10/2013 11:17 PM, Alejandro Tejada wrote: Hi Richmmond, Richmond Mathewson-2 wrote [snip] So I don't know where you got the idea that this used not to work: [snip] mouseStillDown is not mentioned in this article: http://www.hyperactivesw.com/resources_polling.html Why? Because RR/LC documentation has always been inadequate. As a result I gave up reading it and started thinking for myself. But, then, I have never been a great one for following other people's dialectics. Ah, but in this case it's my dialectics. :) It was largely written at the request of Scott Raney who got tired of preaching about it. He told me the day that page went up he'd already referred two people to it, which saved him a lot of time. -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop
On 05/11/2013 09:06 PM, J. Landman Gay wrote: On 5/11/13 1:46 AM, Richmond wrote: On 05/10/2013 11:17 PM, Alejandro Tejada wrote: Hi Richmmond, Richmond Mathewson-2 wrote [snip] So I don't know where you got the idea that this used not to work: [snip] mouseStillDown is not mentioned in this article: http://www.hyperactivesw.com/resources_polling.html Why? Because RR/LC documentation has always been inadequate. As a result I gave up reading it and started thinking for myself. But, then, I have never been a great one for following other people's dialectics. Ah, but in this case it's my dialectics. :) It was largely written at the request of Scott Raney who got tired of preaching about it. He told me the day that page went up he'd already referred two people to it, which saved him a lot of time. Dear Ms Gay, I will not hold that against you. The nature of programming languages is such that they are almost un-documentable in their complexity; a lot of which is even unsuspected by the people who invent them. Richmond. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop
Bonjour Ray, Recently I had a similar problem but while dragging from one locked field to an unlocked field on the same card. The dragdrop handler did not work until I pass dragdrop at the end of the dragdrop handler. Not sure that will help in your case! Best regards André Le 10 mai 2013 à 02:03, Ray Horsley a écrit : Many thanks to you all who responded to this thread I started earlier today. Unfortunately I still haven't resolved this issue so any other thought are appreciated. Here's a few responses to some of the ideas which were presented: - The mouseDown and mouseStillDown unfortunately don't work since I'm dragging a file from the desktop to a Livecode stack (not beginning the drag action in Livecode) although that's kind of cool to know that mouseMove messages get sent during a grab. I didn't know that. - Doing anything with on dragStart also does not work since I'm starting the drag operation outside of Livecode (on a desktop file) - Setting the dragAction to copy instead of move works better in my case since it adds a plus sign to the cursor (when it works) but still does not solve the intermittent failure of Livecode to accept the drop consistently. - Thanks for the link to the article Pinning Drag-and-Drop to the Mat but I had actually read through it yesterday when I began wrestling with this. It, too, does not address dragging files from the desktop into Livecode. At the end of the day I'm wondering if this should be reported as a bug. It seems like something is getting hooked in memory. It's weird that I can drag a file onto my Livecode stack (which is one large image control with the drag handlers in it) and get nothing. Then, simply continuing to drag off the stack window and right back on it fixes it. I'll continue to wrestle and post any solutions I find. Thanks! On May 9, 2013, at 4:59 PM, Scott Rossi wrote: OK, I accepted your dare and was surprised to see that it worked (didn't used to). Nice. Though you're still left with the limitations of working within a single stack, and no dragging in or out. But if the technique works for you, awesome. Speaking as someone who has rolled custom drag-and-drop code (execute in your message box): go url http://www.tactilemedia.com/site_files/downloads/TMdragndrop.rev; ...I'll suggest from experience that at some point it will benefit you to get a handle on the built-in routines. Regards, Scott Rossi Creative Director Tactile Media, UX/UI Design On 5/9/13 1:36 PM, Richmond richmondmathew...@gmail.com wrote: On 05/09/2013 11:07 PM, Scott Rossi wrote: Only you can know why you always use that technique, What? you expect me to know my own mind? LOL. I use that technique as I tend to use a single stack, or a signle stack with associated palettes. but with grab, there's no way to act upon events/messages while grab is active (thus you can't do cursor updates and provide user feedback), and you can't grab an object across stacks. Aha; got you. Why do I have a funny feeling that you could use mouseStillDown to get feedback Ha, ha,ha . . . I just made a stack containing a button DRAG ME ABOUT and a field KOUNT in the button I have this script: on mouseDown grab me end mouseDown on mouseStillDown put fld KOUNT into KOUNT add 1 to KOUNT put KOUNT into fld KOUNT wait 3 ticks end mouseStillDown on mouseUp put empty into fld KOUNT end mouseUp Try it, I dare you . . . you get feedback. Richmond. Regards, Scott Rossi Creative Director Tactile Media, UX/UI Design On 5/9/13 12:42 PM, Richmond richmondmathew...@gmail.com wrote: On 05/09/2013 09:01 PM, Mark Wieder wrote: Ray Horsley ray@... writes: What am I missing to get drag/drop working consistently? You might also want to look at http://lessons.runrev.com/s/lessons/m/4071/l/7124-pinning-drag-and-dro p- to-the-mat-a-primer Why do I always just use on mouseDown grab me end mouseDown then set up a load of images as dropTargets and have stuff like this in the grabbedObject: on mouseUp if not within (img target, the mouseloc) then set the loc of me to 857,673 end if end mouseUp must be missing something. Richmond. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this
Re: Drag and Drop
On 09/05/13 23:59, Scott Rossi wrote: OK, I accepted your dare and was surprised to see that it worked (didn't used to). Nice. Works in LC 4.5 Richmond. Though you're still left with the limitations of working within a single stack, and no dragging in or out. But if the technique works for you, awesome. Speaking as someone who has rolled custom drag-and-drop code (execute in your message box): go url http://www.tactilemedia.com/site_files/downloads/TMdragndrop.rev; ...I'll suggest from experience that at some point it will benefit you to get a handle on the built-in routines. Regards, Scott Rossi Creative Director Tactile Media, UX/UI Design On 5/9/13 1:36 PM, Richmond richmondmathew...@gmail.com wrote: On 05/09/2013 11:07 PM, Scott Rossi wrote: Only you can know why you always use that technique, What? you expect me to know my own mind? LOL. I use that technique as I tend to use a single stack, or a signle stack with associated palettes. but with grab, there's no way to act upon events/messages while grab is active (thus you can't do cursor updates and provide user feedback), and you can't grab an object across stacks. Aha; got you. Why do I have a funny feeling that you could use mouseStillDown to get feedback Ha, ha,ha . . . I just made a stack containing a button DRAG ME ABOUT and a field KOUNT in the button I have this script: on mouseDown grab me end mouseDown on mouseStillDown put fld KOUNT into KOUNT add 1 to KOUNT put KOUNT into fld KOUNT wait 3 ticks end mouseStillDown on mouseUp put empty into fld KOUNT end mouseUp Try it, I dare you . . . you get feedback. Richmond. Regards, Scott Rossi Creative Director Tactile Media, UX/UI Design On 5/9/13 12:42 PM, Richmond richmondmathew...@gmail.com wrote: On 05/09/2013 09:01 PM, Mark Wieder wrote: Ray Horsley ray@... writes: What am I missing to get drag/drop working consistently? You might also want to look at http://lessons.runrev.com/s/lessons/m/4071/l/7124-pinning-drag-and-dro p- to-the-mat-a-primer Why do I always just use on mouseDown grab me end mouseDown then set up a load of images as dropTargets and have stuff like this in the grabbedObject: on mouseUp if not within (img target, the mouseloc) then set the loc of me to 857,673 end if end mouseUp must be missing something. Richmond. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop
Very interesting point Jacqueline. In my case my image control displays nothing. I use it as a template, ultimately to make images out of what users drag and drops. It's the same dimensions as the stack itself. Since the image control displays nothing as it isn't linked (the FileName of it) to any file I'm not sure whether the whole thing is consider transparent pixels or not. Livecode doesn't seem to have a setting of transparent or opaque for image controls. So I've experimented with buttons giving them the same script as the image has: on dragEnter set the dragAction to copy pass dragEnter end dragEnter The new thing I've discovered is I can consistently break Livecode's accepting the drop, evidenced by the cursor turning into a circle with a line through it instead of a plus sign, if I drag extremely slowly right at the point where I stop dragging across the desktop and start dragging over the stack window. This happens even if I let the button overlap off the stack window. If I continue dragging around on top of the stack to another button with the same script I do get the plus sign for a cursor. Weird isn't it? On May 9, 2013, at 9:14 PM, J. Landman Gay wrote: On 5/9/13 7:03 PM, Ray Horsley wrote: At the end of the day I'm wondering if this should be reported as a bug. It seems like something is getting hooked in memory. It's weird that I can drag a file onto my Livecode stack (which is one large image control with the drag handlers in it) and get nothing. Then, simply continuing to drag off the stack window and right back on it fixes it. I wonder if it is because you are dropping onto an image. Images don't register mouse events unless you click (or presumably release) on an opaque pixel. It may be that sometimes you're dropping onto a transparent area and then nothing will happen. You could test the theory by putting a big button over the card and seeing if the drop is reliable there, or by always consciously dropping exactly on an opaque area. -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop
Ray, Try moving your dragEnter dragDrop to the card script (or the stack script), this works fine for me and I can't break it… on dragEnter if char -3 to -1 of the dragData[files] is among the items of jpg,png,gif then set the dragAction to copy end if end dragEnter on dragDrop put the dragData[files] into tFilePath set the fileName of img imageViewer to line 1 of tFilePath end dragDrop With this method I see the cursor change to the circle with a line through it as soon as I drag an image onto the card, but then it changes to a green circle with a plus sign as soon as the app can accept the drop. i.e. When the cursor is over the (empty or not) image area. Paul On 2013-05-10, at 5:16 AM, Ray Horsley wrote: Very interesting point Jacqueline. In my case my image control displays nothing. I use it as a template, ultimately to make images out of what users drag and drops. It's the same dimensions as the stack itself. Since the image control displays nothing as it isn't linked (the FileName of it) to any file I'm not sure whether the whole thing is consider transparent pixels or not. Livecode doesn't seem to have a setting of transparent or opaque for image controls. So I've experimented with buttons giving them the same script as the image has: on dragEnter set the dragAction to copy pass dragEnter end dragEnter The new thing I've discovered is I can consistently break Livecode's accepting the drop, evidenced by the cursor turning into a circle with a line through it instead of a plus sign, if I drag extremely slowly right at the point where I stop dragging across the desktop and start dragging over the stack window. This happens even if I let the button overlap off the stack window. If I continue dragging around on top of the stack to another button with the same script I do get the plus sign for a cursor. Weird isn't it? On May 9, 2013, at 9:14 PM, J. Landman Gay wrote: On 5/9/13 7:03 PM, Ray Horsley wrote: At the end of the day I'm wondering if this should be reported as a bug. It seems like something is getting hooked in memory. It's weird that I can drag a file onto my Livecode stack (which is one large image control with the drag handlers in it) and get nothing. Then, simply continuing to drag off the stack window and right back on it fixes it. I wonder if it is because you are dropping onto an image. Images don't register mouse events unless you click (or presumably release) on an opaque pixel. It may be that sometimes you're dropping onto a transparent area and then nothing will happen. You could test the theory by putting a big button over the card and seeing if the drop is reliable there, or by always consciously dropping exactly on an opaque area. -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop
Hi Ray, Ray Horsley-2 wrote [snip] The new thing I've discovered is I can consistently break Livecode's accepting the drop, evidenced by the cursor turning into a circle with a line through it instead of a plus sign, if I drag extremely slowly right at the point where I stop dragging across the desktop and start dragging over the stack window. This happens even if I let the button overlap off the stack window. If I continue dragging around on top of the stack to another button with the same script I do get the plus sign for a cursor. Weird isn't it? And... This happens in every platform? Windows? Mac? Linux? Al -- View this message in context: http://runtime-revolution.278305.n4.nabble.com/Drag-and-Drop-tp4664563p4664662.html Sent from the Revolution - User mailing list archive at Nabble.com. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop
Well I haven't tried Linux but this behavior happens on both Mac and Windows. And Paul, thanks for the card script idea. I started out trying things in the card script but when I got the sporadic behavior I decided it was because a card is technically not a control. Not sure about that. In any event I'm sorry to report the script you've given me still isn't stopping the cursor from remaining a circle with a line through it without changing to the plus sign. I'll continue to experiment. Have you tried really slowly dragging a file onto a stack window from the desktop to see if it changes to the circle with a line through it even though you've got this in your card's script: on dragEnter set the dragAction to copy end dragEnter On May 10, 2013, at 11:55 AM, Alejandro Tejada wrote: Hi Ray, Ray Horsley-2 wrote [snip] The new thing I've discovered is I can consistently break Livecode's accepting the drop, evidenced by the cursor turning into a circle with a line through it instead of a plus sign, if I drag extremely slowly right at the point where I stop dragging across the desktop and start dragging over the stack window. This happens even if I let the button overlap off the stack window. If I continue dragging around on top of the stack to another button with the same script I do get the plus sign for a cursor. Weird isn't it? And... This happens in every platform? Windows? Mac? Linux? Al -- View this message in context: http://runtime-revolution.278305.n4.nabble.com/Drag-and-Drop-tp4664563p4664662.html Sent from the Revolution - User mailing list archive at Nabble.com. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop
On 05/09/2013 11:59 PM, Scott Rossi wrote: OK, I accepted your dare and was surprised to see that it worked (didn't used to). Nice. Works in LC/RR 3.5.0 Works in LC/RR 2.2.1 So I don't know where you got the idea that this used not to work: perhaps you never tried it as it never occurred to you. Richmond. Though you're still left with the limitations of working within a single stack, and no dragging in or out. But if the technique works for you, awesome. Speaking as someone who has rolled custom drag-and-drop code (execute in your message box): go url http://www.tactilemedia.com/site_files/downloads/TMdragndrop.rev; ...I'll suggest from experience that at some point it will benefit you to get a handle on the built-in routines. Regards, Scott Rossi Creative Director Tactile Media, UX/UI Design On 5/9/13 1:36 PM, Richmond richmondmathew...@gmail.com wrote: On 05/09/2013 11:07 PM, Scott Rossi wrote: Only you can know why you always use that technique, What? you expect me to know my own mind? LOL. I use that technique as I tend to use a single stack, or a signle stack with associated palettes. but with grab, there's no way to act upon events/messages while grab is active (thus you can't do cursor updates and provide user feedback), and you can't grab an object across stacks. Aha; got you. Why do I have a funny feeling that you could use mouseStillDown to get feedback Ha, ha,ha . . . I just made a stack containing a button DRAG ME ABOUT and a field KOUNT in the button I have this script: on mouseDown grab me end mouseDown on mouseStillDown put fld KOUNT into KOUNT add 1 to KOUNT put KOUNT into fld KOUNT wait 3 ticks end mouseStillDown on mouseUp put empty into fld KOUNT end mouseUp Try it, I dare you . . . you get feedback. Richmond. Regards, Scott Rossi Creative Director Tactile Media, UX/UI Design On 5/9/13 12:42 PM, Richmond richmondmathew...@gmail.com wrote: On 05/09/2013 09:01 PM, Mark Wieder wrote: Ray Horsley ray@... writes: What am I missing to get drag/drop working consistently? You might also want to look at http://lessons.runrev.com/s/lessons/m/4071/l/7124-pinning-drag-and-dro p- to-the-mat-a-primer Why do I always just use on mouseDown grab me end mouseDown then set up a load of images as dropTargets and have stuff like this in the grabbedObject: on mouseUp if not within (img target, the mouseloc) then set the loc of me to 857,673 end if end mouseUp must be missing something. Richmond. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop
Hi Richmmond, Richmond Mathewson-2 wrote [snip] So I don't know where you got the idea that this used not to work: [snip] mouseStillDown is not mentioned in this article: http://www.hyperactivesw.com/resources_polling.html Why? Al -- View this message in context: http://runtime-revolution.278305.n4.nabble.com/Drag-and-Drop-tp4664563p4664677.html Sent from the Revolution - User mailing list archive at Nabble.com. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop
On 5/10/13 3:17 PM, Alejandro Tejada wrote: Hi Richmmond, Richmond Mathewson-2 wrote [snip] So I don't know where you got the idea that this used not to work: [snip] mouseStillDown is not mentioned in this article: http://www.hyperactivesw.com/resources_polling.html Why? Mostly because it isn't the same thing as polling by script. It's an engine message and catching engine messages isn't blocking. -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop
Yup. Must have been other mouse messages/functions that were tried. It used to be way back that folks would create drag routines that relied on the state of the mouse. But mouse polling was deemed as quite inefficient, and was unreliable. IIRC, this is why the grab command was created. Of course, things have changed a lot in LiveCode. As I said, if it works for you, great. Regards, Scott Rossi Creative Director Tactile Media, UX/UI Design Original message Subject: Re: Drag and Drop From: Richmond richmondmathew...@gmail.com To: How to use LiveCode use-livecode@lists.runrev.com CC: null ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop
On May 9, 2013, at 6:15 AM, Ray Horsley wrote: I've never used this feature before and no matter how I set it up it seems kind of sporadic. The goal is to drag an image file (jpg, jpeg, png, etc.) from the desktop onto a card, get the path to it and ultimately import it into the stack. I've place an image control on the card which is the same dimensions as the stack itself and scripted the following: on dragEnter set the dragAction to copy -- this is the sporadic part which only sometimes turns the cursor into a plus thus allowing dragDrop to catch the drop pass dragEnter end dragEnter on dragDrop put the dragData into curFilePath -- continue to import the file end dragDrop This works 'some of the time' but I'm still often unable to drop what I'm dragging since the cursor doesn't always turn into the plus sign. Each time this happens I try dragging the file again, immediately, and it suddenly works when I didn't change a thing. What am I missing to get drag/drop working consistently? Ray, A while back I needed exactly this. I worked out a process that seems to work consistently. Here's what I did: In the card script: on dragStart set the allowableDragActions to move,copy end dragStart In the drop target object script (mine happened to be a group): on dragEnter set the dragAction to move # copy might work, too # these next 3 lines are just eye candy to tell the user that they hit a hot spot set the lineSize of grc dropSpot of me to 3 set the backcolor of grc dropSpot of me to gray set the icon of btn downArrowBtn to downarrow end dragEnter on dragDrop put the dragData[files] into fld file path # more eye candy set the backcolor of grc dropSpot of me to the startingBackColor of grc dropSpot of me set the icon of btn downArrowBtn to downarrowlite end dragDrop on dragLeave # yet more eye candy set the backcolor of grc dropSpot of me to the startingBackColor of grc dropSpot of me set the icon of btn downArrowBtn to downarrowlite end dragLeave As you can see the essential parts of the drag-drop operation are fairly minimal and straightforward. HTH Devin Devin Asay Office of Digital Humanities Brigham Young University ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop
Ray Horsley ray@... writes: What am I missing to get drag/drop working consistently? You might also want to look at http://lessons.runrev.com/s/lessons/m/4071/l/7124-pinning-drag-and-drop-to-the-mat-a-primer -- Mark Wieder mwie...@ahsoftware.net ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop
On 05/09/2013 09:01 PM, Mark Wieder wrote: Ray Horsley ray@... writes: What am I missing to get drag/drop working consistently? You might also want to look at http://lessons.runrev.com/s/lessons/m/4071/l/7124-pinning-drag-and-drop-to-the-mat-a-primer Why do I always just use on mouseDown grab me end mouseDown then set up a load of images as dropTargets and have stuff like this in the grabbedObject: on mouseUp if not within (img target, the mouseloc) then set the loc of me to 857,673 end if end mouseUp must be missing something. Richmond. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop
Only you can know why you always use that technique, but with grab, there's no way to act upon events/messages while grab is active (thus you can't do cursor updates and provide user feedback), and you can't grab an object across stacks. Regards, Scott Rossi Creative Director Tactile Media, UX/UI Design On 5/9/13 12:42 PM, Richmond richmondmathew...@gmail.com wrote: On 05/09/2013 09:01 PM, Mark Wieder wrote: Ray Horsley ray@... writes: What am I missing to get drag/drop working consistently? You might also want to look at http://lessons.runrev.com/s/lessons/m/4071/l/7124-pinning-drag-and-drop- to-the-mat-a-primer Why do I always just use on mouseDown grab me end mouseDown then set up a load of images as dropTargets and have stuff like this in the grabbedObject: on mouseUp if not within (img target, the mouseloc) then set the loc of me to 857,673 end if end mouseUp must be missing something. Richmond. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop
On 5/9/13 12:42 PM, Richmond richmondmathew...@gmail.com wrote: On 05/09/2013 09:01 PM, Mark Wieder wrote: Ray Horsley ray@... writes: What am I missing to get drag/drop working consistently? You might also want to look at http://lessons.runrev.com/s/lessons/m/4071/l/7124-pinning-drag-and-drop- to-the-mat-a-primer Why do I always just use on mouseDown grab me end mouseDown then set up a load of images as dropTargets and have stuff like this in the grabbedObject: on mouseUp if not within (img target, the mouseloc) then set the loc of me to 857,673 end if end mouseUp must be missing something. Ray wanted to drag files onto stacks. Grab only works on objects inside a single stack. On May 9, 2013, at 2:07 PM, Scott Rossi wrote: Only you can know why you always use that technique, but with grab, there's no way to act upon events/messages while grab is active (thus you can't do cursor updates and provide user feedback), and you can't grab an object across stacks. That's mostly true, Scott. The only mouse message that gets sent during a grab is mouseMove. So you can check location, within() and other things during the grab operation and act on them within the mouseMove handler. Devin Devin Asay Office of Digital Humanities Brigham Young University ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop
On 05/09/2013 11:07 PM, Scott Rossi wrote: Only you can know why you always use that technique, What? you expect me to know my own mind? LOL. I use that technique as I tend to use a single stack, or a signle stack with associated palettes. but with grab, there's no way to act upon events/messages while grab is active (thus you can't do cursor updates and provide user feedback), and you can't grab an object across stacks. Aha; got you. Why do I have a funny feeling that you could use mouseStillDown to get feedback Ha, ha,ha . . . I just made a stack containing a button DRAG ME ABOUT and a field KOUNT in the button I have this script: on mouseDown grab me end mouseDown on mouseStillDown put fld KOUNT into KOUNT add 1 to KOUNT put KOUNT into fld KOUNT wait 3 ticks end mouseStillDown on mouseUp put empty into fld KOUNT end mouseUp Try it, I dare you . . . you get feedback. Richmond. Regards, Scott Rossi Creative Director Tactile Media, UX/UI Design On 5/9/13 12:42 PM, Richmond richmondmathew...@gmail.com wrote: On 05/09/2013 09:01 PM, Mark Wieder wrote: Ray Horsley ray@... writes: What am I missing to get drag/drop working consistently? You might also want to look at http://lessons.runrev.com/s/lessons/m/4071/l/7124-pinning-drag-and-drop- to-the-mat-a-primer Why do I always just use on mouseDown grab me end mouseDown then set up a load of images as dropTargets and have stuff like this in the grabbedObject: on mouseUp if not within (img target, the mouseloc) then set the loc of me to 857,673 end if end mouseUp must be missing something. Richmond. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop
OK, I accepted your dare and was surprised to see that it worked (didn't used to). Nice. Though you're still left with the limitations of working within a single stack, and no dragging in or out. But if the technique works for you, awesome. Speaking as someone who has rolled custom drag-and-drop code (execute in your message box): go url http://www.tactilemedia.com/site_files/downloads/TMdragndrop.rev; ...I'll suggest from experience that at some point it will benefit you to get a handle on the built-in routines. Regards, Scott Rossi Creative Director Tactile Media, UX/UI Design On 5/9/13 1:36 PM, Richmond richmondmathew...@gmail.com wrote: On 05/09/2013 11:07 PM, Scott Rossi wrote: Only you can know why you always use that technique, What? you expect me to know my own mind? LOL. I use that technique as I tend to use a single stack, or a signle stack with associated palettes. but with grab, there's no way to act upon events/messages while grab is active (thus you can't do cursor updates and provide user feedback), and you can't grab an object across stacks. Aha; got you. Why do I have a funny feeling that you could use mouseStillDown to get feedback Ha, ha,ha . . . I just made a stack containing a button DRAG ME ABOUT and a field KOUNT in the button I have this script: on mouseDown grab me end mouseDown on mouseStillDown put fld KOUNT into KOUNT add 1 to KOUNT put KOUNT into fld KOUNT wait 3 ticks end mouseStillDown on mouseUp put empty into fld KOUNT end mouseUp Try it, I dare you . . . you get feedback. Richmond. Regards, Scott Rossi Creative Director Tactile Media, UX/UI Design On 5/9/13 12:42 PM, Richmond richmondmathew...@gmail.com wrote: On 05/09/2013 09:01 PM, Mark Wieder wrote: Ray Horsley ray@... writes: What am I missing to get drag/drop working consistently? You might also want to look at http://lessons.runrev.com/s/lessons/m/4071/l/7124-pinning-drag-and-dro p- to-the-mat-a-primer Why do I always just use on mouseDown grab me end mouseDown then set up a load of images as dropTargets and have stuff like this in the grabbedObject: on mouseUp if not within (img target, the mouseloc) then set the loc of me to 857,673 end if end mouseUp must be missing something. Richmond. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop
Many thanks to you all who responded to this thread I started earlier today. Unfortunately I still haven't resolved this issue so any other thought are appreciated. Here's a few responses to some of the ideas which were presented: - The mouseDown and mouseStillDown unfortunately don't work since I'm dragging a file from the desktop to a Livecode stack (not beginning the drag action in Livecode) although that's kind of cool to know that mouseMove messages get sent during a grab. I didn't know that. - Doing anything with on dragStart also does not work since I'm starting the drag operation outside of Livecode (on a desktop file) - Setting the dragAction to copy instead of move works better in my case since it adds a plus sign to the cursor (when it works) but still does not solve the intermittent failure of Livecode to accept the drop consistently. - Thanks for the link to the article Pinning Drag-and-Drop to the Mat but I had actually read through it yesterday when I began wrestling with this. It, too, does not address dragging files from the desktop into Livecode. At the end of the day I'm wondering if this should be reported as a bug. It seems like something is getting hooked in memory. It's weird that I can drag a file onto my Livecode stack (which is one large image control with the drag handlers in it) and get nothing. Then, simply continuing to drag off the stack window and right back on it fixes it. I'll continue to wrestle and post any solutions I find. Thanks! On May 9, 2013, at 4:59 PM, Scott Rossi wrote: OK, I accepted your dare and was surprised to see that it worked (didn't used to). Nice. Though you're still left with the limitations of working within a single stack, and no dragging in or out. But if the technique works for you, awesome. Speaking as someone who has rolled custom drag-and-drop code (execute in your message box): go url http://www.tactilemedia.com/site_files/downloads/TMdragndrop.rev; ...I'll suggest from experience that at some point it will benefit you to get a handle on the built-in routines. Regards, Scott Rossi Creative Director Tactile Media, UX/UI Design On 5/9/13 1:36 PM, Richmond richmondmathew...@gmail.com wrote: On 05/09/2013 11:07 PM, Scott Rossi wrote: Only you can know why you always use that technique, What? you expect me to know my own mind? LOL. I use that technique as I tend to use a single stack, or a signle stack with associated palettes. but with grab, there's no way to act upon events/messages while grab is active (thus you can't do cursor updates and provide user feedback), and you can't grab an object across stacks. Aha; got you. Why do I have a funny feeling that you could use mouseStillDown to get feedback Ha, ha,ha . . . I just made a stack containing a button DRAG ME ABOUT and a field KOUNT in the button I have this script: on mouseDown grab me end mouseDown on mouseStillDown put fld KOUNT into KOUNT add 1 to KOUNT put KOUNT into fld KOUNT wait 3 ticks end mouseStillDown on mouseUp put empty into fld KOUNT end mouseUp Try it, I dare you . . . you get feedback. Richmond. Regards, Scott Rossi Creative Director Tactile Media, UX/UI Design On 5/9/13 12:42 PM, Richmond richmondmathew...@gmail.com wrote: On 05/09/2013 09:01 PM, Mark Wieder wrote: Ray Horsley ray@... writes: What am I missing to get drag/drop working consistently? You might also want to look at http://lessons.runrev.com/s/lessons/m/4071/l/7124-pinning-drag-and-dro p- to-the-mat-a-primer Why do I always just use on mouseDown grab me end mouseDown then set up a load of images as dropTargets and have stuff like this in the grabbedObject: on mouseUp if not within (img target, the mouseloc) then set the loc of me to 857,673 end if end mouseUp must be missing something. Richmond. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
Re: Drag and Drop
Ray- Thursday, May 9, 2013, 5:03:09 PM, you wrote: - Thanks for the link to the article Pinning Drag-and-Drop to the Mat but I had actually read through it yesterday when I began wrestling with this. It, too, does not address dragging files from the desktop into Livecode. Sorry - I missed that part in your post. -- -Mark Wieder mwie...@ahsoftware.net ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop
On 5/9/13 7:03 PM, Ray Horsley wrote: At the end of the day I'm wondering if this should be reported as a bug. It seems like something is getting hooked in memory. It's weird that I can drag a file onto my Livecode stack (which is one large image control with the drag handlers in it) and get nothing. Then, simply continuing to drag off the stack window and right back on it fixes it. I wonder if it is because you are dropping onto an image. Images don't register mouse events unless you click (or presumably release) on an opaque pixel. It may be that sometimes you're dropping onto a transparent area and then nothing will happen. You could test the theory by putting a big button over the card and seeing if the drop is reliable there, or by always consciously dropping exactly on an opaque area. -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop
I use a transparent button that covers the area I want to be able to accept the drop. I use a dragEnter in the stack to show the button and then hide it after dropping or exiting. You can give the button a border as a visual indicator. Best regards, Marty Knapp Knappster Solutions LLC --- www.CheckBuilderPro.com On 5/9/13 7:03 PM, Ray Horsley wrote: At the end of the day I'm wondering if this should be reported as a bug. It seems like something is getting hooked in memory. It's weird that I can drag a file onto my Livecode stack (which is one large image control with the drag handlers in it) and get nothing. Then, simply continuing to drag off the stack window and right back on it fixes it. I wonder if it is because you are dropping onto an image. Images don't register mouse events unless you click (or presumably release) on an opaque pixel. It may be that sometimes you're dropping onto a transparent area and then nothing will happen. You could test the theory by putting a big button over the card and seeing if the drop is reliable there, or by always consciously dropping exactly on an opaque area. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop in a locked field
Bonjour Bob, In some apps I am using the following script. It is an adaptation to drap and drop inside one field, of a script from Eric Chatonet he had written for drag and drop from one field to another. Besides the field, this script uses an extra field name tempo which allows to see what line one is dragging. A bug (# 6823) prevented this script to work well in a grouped field (but the Slug had writte a workaround). Seems that now this bug has been fixed : I just tried the script on a grouped field and it works. Best regards from Grenoble André --- THE SCRIPT OF THE FIELD --- local lLineNo,tLaLigne,tStyle, -- script local variable -- on mouseEnter set the dragDelta to 5 -- instead of 10 seems to prevent to drag a wrong line too often end mouseEnter -- on dragMove -- sent repeatedly when the dragdata is within the field local tContents,tHilitedText - put (the mouseV - the top of the target) div the effective textHeight of the target into lLineNo -- line number if lLineNo the number of lines of the target then put the number of lines of the target into lLineNo - lock screen put StripCR(me) into tContents -- see below put the hilitedText of the target into tHilitedText -- stores highlighted line put cr after line lLineNo of tContents -- creates a blank line set the text of the target to tContents set the hilitedLine of the target to lineOffset(tHilitedText,tContents) -- restores highlighted line unlock screen delete line (the hilitedLine of the target) of the target end dragMove on DragLeave -- restores current contents local tHilitedLine, --- lock screen put the hilitedLine of the target into tHilitedLine put StripCR(me) into the target -- set the hilitedLine of the target to tHilitedLine unlock screen end DragLeave -- on dragEnter -- NÉCESSAIRE DANS LE CONTROL DE DESTINATION set the dragAction to Move end dragEnter -- on dragDrop local tContents - put StripCR(me) into tContents -- see below if lLineNo = 0 then put the dragdata[text] cr before tContents else put cr the dragdata[text] after line lLineNo of tContents end if lock screen set the text of the target to tContents set the hilitedLine of the target to lLineNo + 1 -- sets highlighted line to dropped line unlock screen end dragDrop -- function StripCR pText -- returns 'normal' field's contents if char 1 of pText = cr then delete char 1 of pText if char -1 of pText = cr then delete char -1 of pText replace cr cr with cr in pText return pText end StripCR -- - on dragStart --NÉCESSAIRE DANS LE CONTROL SOURCE set the dragData[text] to the selectedText put the selectedText of the target into fld Temp -- in order to create the right image -- put tLaLigne into fld Temp set the dragImage to CreateDragImage() -- see below set the dragImageOffset to the width of last image div 2,the height of last image div 2 -- centered end dragStart on dragEnd delete last image -- we no longer need the drag image end dragEnd - function CreateDragImage -- creates drag image on-the-fly local tRect,tempImage - put the rect of fld Temp into tRect - export snapshot from rect tRect of this cd to tempImage as jpeg -- export image to a variable lock messages -- important to speed up the process create invisible image -- we don't want to see it set the text of last image to tempImage if there is an image ID 6001 then delete image ID 6001 set the ID of last image to 6001 -- setting dimensions unlock messages return the ID of last image -- we need it to set the dragImage property end CreateDragImage Le 10 févr. 2012 à 01:35, Bob Sneidar a écrit : Hi all. I use locked fields with multiple lines and listBehavior set to true as a kind of menu. Now I am trying to allow the user to rearrange the items in the list. I read in the Dictionary that LC handles drag and drop between *unlocked* fields automatically. Crud. So I tried unlocking the field on mouseDown and then sending mouseDown again in 0 seconds, but that was a bust. I tried just unlocking the field on mouseDown and locking it on mouseUp but that was problematic too. Any easy way to implement this? I could use a datagrid I suppose (grumble grumble) but it would be nice if I could just do this with a simple list field. I want to reorder entire lines by dragging and dropping them. Bob ___ use-livecode mailing list
Re: Drag and Drop in a locked field
On Feb 9, 2012, at 7:50 PM, Ken Ray wrote: On Feb 9, 2012, at 6:35 PM, Bob Sneidar wrote: Hi all. I use locked fields with multiple lines and listBehavior set to true as a kind of menu. Now I am trying to allow the user to rearrange the items in the list. I read in the Dictionary that LC handles drag and drop between *unlocked* fields automatically. Crud. So I tried unlocking the field on mouseDown and then sending mouseDown again in 0 seconds, but that was a bust. I tried just unlocking the field on mouseDown and locking it on mouseUp but that was problematic too. Any easy way to implement this? I could use a datagrid I suppose (grumble grumble) but it would be nice if I could just do this with a simple list field. I want to reorder entire lines by dragging and dropping them. I'm using a variation of Scott Rossi's Get In Line implementation… you can download the stack directly with this URL: http://www.tactilemedia.com/site_files/downloads/getinline.rev.zip Scott's got a lot of great tutorials and demos at his site, so you should check out: http://www.tactilemedia.com/site_files/software/tutorials.html I use Scott's getinline handlers and I love them. They work like a charm. -- Peter Peter M. Brigham pmb...@gmail.com http://home.comcast.net/~pmbrig ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop in a locked field
Thanks I already went with GetInLine and I like the way it looks. Scott's stuff is always visually pleasing. Paypal donation on the way! Bob On Feb 10, 2012, at 1:13 AM, André Bisseret wrote: Bonjour Bob, In some apps I am using the following script. It is an adaptation to drap and drop inside one field, of a script from Eric Chatonet he had written for drag and drop from one field to another. Besides the field, this script uses an extra field name tempo which allows to see what line one is dragging. A bug (# 6823) prevented this script to work well in a grouped field (but the Slug had writte a workaround). Seems that now this bug has been fixed : I just tried the script on a grouped field and it works. Best regards from Grenoble André --- THE SCRIPT OF THE FIELD --- local lLineNo,tLaLigne,tStyle, -- script local variable -- on mouseEnter set the dragDelta to 5 -- instead of 10 seems to prevent to drag a wrong line too often end mouseEnter -- on dragMove -- sent repeatedly when the dragdata is within the field local tContents,tHilitedText - put (the mouseV - the top of the target) div the effective textHeight of the target into lLineNo -- line number if lLineNo the number of lines of the target then put the number of lines of the target into lLineNo - lock screen put StripCR(me) into tContents -- see below put the hilitedText of the target into tHilitedText -- stores highlighted line put cr after line lLineNo of tContents -- creates a blank line set the text of the target to tContents set the hilitedLine of the target to lineOffset(tHilitedText,tContents) -- restores highlighted line unlock screen delete line (the hilitedLine of the target) of the target end dragMove on DragLeave -- restores current contents local tHilitedLine, --- lock screen put the hilitedLine of the target into tHilitedLine put StripCR(me) into the target -- set the hilitedLine of the target to tHilitedLine unlock screen end DragLeave -- on dragEnter -- NÉCESSAIRE DANS LE CONTROL DE DESTINATION set the dragAction to Move end dragEnter -- on dragDrop local tContents - put StripCR(me) into tContents -- see below if lLineNo = 0 then put the dragdata[text] cr before tContents else put cr the dragdata[text] after line lLineNo of tContents end if lock screen set the text of the target to tContents set the hilitedLine of the target to lLineNo + 1 -- sets highlighted line to dropped line unlock screen end dragDrop -- function StripCR pText -- returns 'normal' field's contents if char 1 of pText = cr then delete char 1 of pText if char -1 of pText = cr then delete char -1 of pText replace cr cr with cr in pText return pText end StripCR -- - on dragStart --NÉCESSAIRE DANS LE CONTROL SOURCE set the dragData[text] to the selectedText put the selectedText of the target into fld Temp -- in order to create the right image -- put tLaLigne into fld Temp set the dragImage to CreateDragImage() -- see below set the dragImageOffset to the width of last image div 2,the height of last image div 2 -- centered end dragStart on dragEnd delete last image -- we no longer need the drag image end dragEnd - function CreateDragImage -- creates drag image on-the-fly local tRect,tempImage - put the rect of fld Temp into tRect - export snapshot from rect tRect of this cd to tempImage as jpeg -- export image to a variable lock messages -- important to speed up the process create invisible image -- we don't want to see it set the text of last image to tempImage if there is an image ID 6001 then delete image ID 6001 set the ID of last image to 6001 -- setting dimensions unlock messages return the ID of last image -- we need it to set the dragImage property end CreateDragImage Le 10 févr. 2012 à 01:35, Bob Sneidar a écrit : Hi all. I use locked fields with multiple lines and listBehavior set to true as a kind of menu. Now I am trying to allow the user to rearrange the items in the list. I read in the Dictionary that LC handles drag and drop between *unlocked* fields automatically. Crud. So I tried unlocking the field on mouseDown and then sending mouseDown again in 0 seconds, but that was a bust. I tried just unlocking the field on mouseDown and locking it on mouseUp but that was problematic too. Any easy way to implement this? I could use a datagrid I
Re: Drag and Drop in a locked field
slylabs13 wrote Any easy way to implement this? I could use a datagrid I suppose (grumble grumble) but it would be nice if I could just do this with a simple list field. I want to reorder entire lines by dragging and dropping them. Hi Bob, I wrote something to do that awhile back and added the ability (through a pop-over menu) to add, edit and delete items from the list, and sort the list up/down. However, bug 7766 prevented the drag drop from working on x86 and I don't think that problem has been resolved. Just tried posting the stack (the list is implemented as a group: a scrolling list, pop-over menu and hidden field so grouping it made it easy to just drag drop the whole shebang onto a card) into rev online but it stopped responding so mail me offline if you want me to send you a copy. I'll post it to rev online once its back up (Enhanced Scrolling List). -- Mark -- View this message in context: http://runtime-revolution.278305.n4.nabble.com/Drag-and-Drop-in-a-locked-field-tp4374946p4377388.html Sent from the Revolution - User mailing list archive at Nabble.com. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop in a locked field
Sorry, its been awhile since I worked on it and so I should clarify: the 7766 bug only rears its head after using the pop-up menu. If you disable the pop-up menu option the drag drop works fine on x86. -- Mark -- View this message in context: http://runtime-revolution.278305.n4.nabble.com/Drag-and-Drop-in-a-locked-field-tp4374946p4377399.html Sent from the Revolution - User mailing list archive at Nabble.com. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop in a locked field
Thanks Mark! Bunch of friendlier people I have never known! :-) So far I am using Scott's Getinline solution. I like his little drag insert graphic! Bob On Feb 10, 2012, at 12:01 PM, Mark Smith wrote: slylabs13 wrote Any easy way to implement this? I could use a datagrid I suppose (grumble grumble) but it would be nice if I could just do this with a simple list field. I want to reorder entire lines by dragging and dropping them. Hi Bob, I wrote something to do that awhile back and added the ability (through a pop-over menu) to add, edit and delete items from the list, and sort the list up/down. However, bug 7766 prevented the drag drop from working on x86 and I don't think that problem has been resolved. Just tried posting the stack (the list is implemented as a group: a scrolling list, pop-over menu and hidden field so grouping it made it easy to just drag drop the whole shebang onto a card) into rev online but it stopped responding so mail me offline if you want me to send you a copy. I'll post it to rev online once its back up (Enhanced Scrolling List). -- Mark -- View this message in context: http://runtime-revolution.278305.n4.nabble.com/Drag-and-Drop-in-a-locked-field-tp4374946p4377388.html Sent from the Revolution - User mailing list archive at Nabble.com. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop in a locked field
On Feb 9, 2012, at 6:35 PM, Bob Sneidar wrote: Hi all. I use locked fields with multiple lines and listBehavior set to true as a kind of menu. Now I am trying to allow the user to rearrange the items in the list. I read in the Dictionary that LC handles drag and drop between *unlocked* fields automatically. Crud. So I tried unlocking the field on mouseDown and then sending mouseDown again in 0 seconds, but that was a bust. I tried just unlocking the field on mouseDown and locking it on mouseUp but that was problematic too. Any easy way to implement this? I could use a datagrid I suppose (grumble grumble) but it would be nice if I could just do this with a simple list field. I want to reorder entire lines by dragging and dropping them. I'm using a variation of Scott Rossi's Get In Line implementation… you can download the stack directly with this URL: http://www.tactilemedia.com/site_files/downloads/getinline.rev.zip Scott's got a lot of great tutorials and demos at his site, so you should check out: http://www.tactilemedia.com/site_files/software/tutorials.html Ken Ray Sons of Thunder Software, Inc. Email: k...@sonsothunder.com Web Site: http://www.sonsothunder.com/ ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop in a locked field
Thanks I will give it a go. I have it partially working, but I found if I drag too fast the engine selects another line before dragStart is triggered. Also I had to send dragEnter from the dragStart handler otherwise the process never kicked off. I tried sending dragStart in a mouseDown handler, but that didn't seem to fix it. Weird. This sort of thing should be automatic in the engine IMHO. Seems like a common thing to want to rearrange lines in a list by dragging and dropping. Bob On Feb 9, 2012, at 4:50 PM, Ken Ray wrote: On Feb 9, 2012, at 6:35 PM, Bob Sneidar wrote: Hi all. I use locked fields with multiple lines and listBehavior set to true as a kind of menu. Now I am trying to allow the user to rearrange the items in the list. I read in the Dictionary that LC handles drag and drop between *unlocked* fields automatically. Crud. So I tried unlocking the field on mouseDown and then sending mouseDown again in 0 seconds, but that was a bust. I tried just unlocking the field on mouseDown and locking it on mouseUp but that was problematic too. Any easy way to implement this? I could use a datagrid I suppose (grumble grumble) but it would be nice if I could just do this with a simple list field. I want to reorder entire lines by dragging and dropping them. I'm using a variation of Scott Rossi's Get In Line implementation… you can download the stack directly with this URL: http://www.tactilemedia.com/site_files/downloads/getinline.rev.zip Scott's got a lot of great tutorials and demos at his site, so you should check out: http://www.tactilemedia.com/site_files/software/tutorials.html Ken Ray Sons of Thunder Software, Inc. Email: k...@sonsothunder.com Web Site: http://www.sonsothunder.com/ ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and drop filetype
On 1/14/12 8:07 AM, Randolph Valentine wrote: Hi, all. I've got a very basic question. After a file is drag-and-dropped, how can I determine WHAT the dropped item is referring to, e.g., a FOLDER or a FILE, and if a file, RELIABLY, what KIND of file (e.g., a doc or a wav)? See dragData in the dictionary. Write a dragDrop handler that checks the dragData[files] and you can parse out the lines, which contain the file path(s) to the files that were dropped. This works cross platform. -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop Between Stacks?
Hi Scott, Since I don't think files can be attached to messages in this list, I have sent you an email with an example of how to do this. I should say that hardly any of the example is my own cleverness, it's an amalgam of suggestions from several people on this list when I was trying to figure out how to do this a while back. Pete Molly's Revenge http://www.mollysrevenge.com On Fri, Oct 14, 2011 at 1:37 PM, Scott Rossi sc...@tactilemedia.com wrote: Hi List: I'm wondering if anybody has an example stack lying that shows how to use LC's built-in drag and drop to copy objects between stacks. I've been using a home-brewed routine for a few years now which has worked fine, but in one project the script is getting very complex, so I'm thinking it would be worth exploring LC's built-in drag and drop. The last time I tried this, I could not get it to work. I was told by a list colleague that copying between stacks involved copying an object to the destination stack before initiating the drop to serve as a target which seemed extremely odd to me, but in any event, I could never get it to work, and I gave up. So, does anyone have a simple example they could share? Thanks Regards, Scott Rossi Creative Director Tactile Media, UX Design ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop Between Stacks?
Hi Scott. What are you trying to drag? If it is just text between fields, I think that works already. Images and other things however may be a bit more trouble. Bob On Oct 14, 2011, at 1:37 PM, Scott Rossi wrote: Hi List: I'm wondering if anybody has an example stack lying that shows how to use LC's built-in drag and drop to copy objects between stacks. I've been using a home-brewed routine for a few years now which has worked fine, but in one project the script is getting very complex, so I'm thinking it would be worth exploring LC's built-in drag and drop. The last time I tried this, I could not get it to work. I was told by a list colleague that copying between stacks involved copying an object to the destination stack before initiating the drop to serve as a target which seemed extremely odd to me, but in any event, I could never get it to work, and I gave up. So, does anyone have a simple example they could share? Thanks Regards, Scott Rossi Creative Director Tactile Media, UX Design ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop Between Stacks?
Hello Scott, See Rev Online my stack HUD Panel Factory. It is an (Macintosh) example of drag drop of a group... Open script... Bon souvenir de Paris René Le 14 oct. 2011 à 22:37, Scott Rossi a écrit : Hi List: I'm wondering if anybody has an example stack lying that shows how to use LC's built-in drag and drop to copy objects between stacks. I've been using a home-brewed routine for a few years now which has worked fine, but in one project the script is getting very complex, so I'm thinking it would be worth exploring LC's built-in drag and drop. The last time I tried this, I could not get it to work. I was told by a list colleague that copying between stacks involved copying an object to the destination stack before initiating the drop to serve as a target which seemed extremely odd to me, but in any event, I could never get it to work, and I gave up. So, does anyone have a simple example they could share? Thanks Regards, Scott Rossi Creative Director Tactile Media, UX Design ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop Between Stacks?
You can see also my two other contribution on Rev Online : - Spinner Store - Circular Slider Store all drag drop capable... René Le 15 oct. 2011 à 01:11, René Micout a écrit : Hello Scott, See Rev Online my stack HUD Panel Factory. It is an (Macintosh) example of drag drop of a group... Open script... Bon souvenir de Paris René Le 14 oct. 2011 à 22:37, Scott Rossi a écrit : Hi List: I'm wondering if anybody has an example stack lying that shows how to use LC's built-in drag and drop to copy objects between stacks. I've been using a home-brewed routine for a few years now which has worked fine, but in one project the script is getting very complex, so I'm thinking it would be worth exploring LC's built-in drag and drop. The last time I tried this, I could not get it to work. I was told by a list colleague that copying between stacks involved copying an object to the destination stack before initiating the drop to serve as a target which seemed extremely odd to me, but in any event, I could never get it to work, and I gave up. So, does anyone have a simple example they could share? Thanks Regards, Scott Rossi Creative Director Tactile Media, UX Design ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop Between Stacks?
Thanks to all the folks who replied with drag and drop options. Pete's script was the most easy to get into (he sent it to me), and it looks like what I need. The only remaining question I had was found in the dragDestination, so all is well. Thanks Regards, Scott Rossi Creative Director Tactile Media, UX Design ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop Between Stacks?
On Oct 14, 2011, at 7:06 PM, Scott Rossi wrote: Thanks to all the folks who replied with drag and drop options. Pete's script was the most easy to get into (he sent it to me), and it looks like what I need. The only remaining question I had was found in the dragDestination, so all is well. Pete, could you post your code (or the stack somewhere) so others could get the benefit of your experience? Thanks, Ken Ray Sons of Thunder Software, Inc. Email: k...@sonsothunder.com Web Site: http://www.sonsothunder.com/ ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop Between Stacks?
Absolutely Ken, I want to share it. I'm just not sure where to put the stack - is there somewhere this list has access to for files? If not, I think I have a dropbox account from way back. Pete Molly's Revenge http://www.mollysrevenge.com On Fri, Oct 14, 2011 at 6:53 PM, Ken Ray k...@sonsothunder.com wrote: On Oct 14, 2011, at 7:06 PM, Scott Rossi wrote: Thanks to all the folks who replied with drag and drop options. Pete's script was the most easy to get into (he sent it to me), and it looks like what I need. The only remaining question I had was found in the dragDestination, so all is well. Pete, could you post your code (or the stack somewhere) so others could get the benefit of your experience? Thanks, Ken Ray Sons of Thunder Software, Inc. Email: k...@sonsothunder.com Web Site: http://www.sonsothunder.com/ ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
RE: Drag and Drop Between Stacks?
Why not put it in the User Samples in revOnline? It's available from the IDE menu bar - Mark From: use-livecode-boun...@lists.runrev.com [use-livecode-boun...@lists.runrev.com] On Behalf Of Pete [p...@mollysrevenge.com] Sent: Friday, October 14, 2011 9:34 PM To: How to use LiveCode Subject: Re: Drag and Drop Between Stacks? Absolutely Ken, I want to share it. I'm just not sure where to put the stack - is there somewhere this list has access to for files? If not, I think I have a dropbox account from way back. Pete Molly's Revenge http://www.mollysrevenge.com On Fri, Oct 14, 2011 at 6:53 PM, Ken Ray k...@sonsothunder.com wrote: On Oct 14, 2011, at 7:06 PM, Scott Rossi wrote: Thanks to all the folks who replied with drag and drop options. Pete's script was the most easy to get into (he sent it to me), and it looks like what I need. The only remaining question I had was found in the dragDestination, so all is well. Pete, could you post your code (or the stack somewhere) so others could get the benefit of your experience? Thanks, Ken Ray Sons of Thunder Software, Inc. Email: k...@sonsothunder.com Web Site: http://www.sonsothunder.com/ ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop Between Stacks?
On Fri, Oct 14, 2011 at 10:34 PM, Pete wrote: Absolutely Ken, I want to share it. I'm just not sure where to put the stack - is there somewhere this list has access to for files? If not, I think I have a dropbox account from way back. Pete Molly's Revenge http://www.mollysrevenge.com On Fri, Oct 14, 2011 at 6:53 PM, Ken Ray k...@sonsothunder.com wrote: On Oct 14, 2011, at 7:06 PM, Scott Rossi wrote: Thanks to all the folks who replied with drag and drop options. Pete's script was the most easy to get into (he sent it to me), and it looks like what I need. The only remaining question I had was found in the dragDestination, so all is well. Pete, could you post your code (or the stack somewhere) so others could get the benefit of your experience? Thanks, Ken Ray Sons of Thunder Software, Inc. Email: k...@sonsothunder.com Web Site: http://www.sonsothunder.com/ RevOnline is a great place for example stacks. ˜Roger ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop Between Stacks?
Here's a link to the stack on box.net: http://www.box.net/shared/o8zaqami56aaqpbg76g8 I doubt there's anything earth shattering in there! SCott - I made a couple of minot changes to the scripts in this stack - nothing functional, just tidied up a couple of things. In my use of this functionality, when the control is dropped on the card, I put up more dialogs to configure whatever type of control it is. Pete Molly's Revenge http://www.mollysrevenge.com On Fri, Oct 14, 2011 at 6:53 PM, Ken Ray k...@sonsothunder.com wrote: On Oct 14, 2011, at 7:06 PM, Scott Rossi wrote: Thanks to all the folks who replied with drag and drop options. Pete's script was the most easy to get into (he sent it to me), and it looks like what I need. The only remaining question I had was found in the dragDestination, so all is well. Pete, could you post your code (or the stack somewhere) so others could get the benefit of your experience? Thanks, Ken Ray Sons of Thunder Software, Inc. Email: k...@sonsothunder.com Web Site: http://www.sonsothunder.com/ ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop Between Stacks?
Thanks Mark. As you'll see I just put it on box.net, but I'll put it on User Samples also. Pete Molly's Revenge http://www.mollysrevenge.com On Fri, Oct 14, 2011 at 7:46 PM, Mark Smith mark_sm...@cpe.umanitoba.cawrote: Why not put it in the User Samples in revOnline? It's available from the IDE menu bar - Mark From: use-livecode-boun...@lists.runrev.com [ use-livecode-boun...@lists.runrev.com] On Behalf Of Pete [ p...@mollysrevenge.com] Sent: Friday, October 14, 2011 9:34 PM To: How to use LiveCode Subject: Re: Drag and Drop Between Stacks? Absolutely Ken, I want to share it. I'm just not sure where to put the stack - is there somewhere this list has access to for files? If not, I think I have a dropbox account from way back. Pete Molly's Revenge http://www.mollysrevenge.com On Fri, Oct 14, 2011 at 6:53 PM, Ken Ray k...@sonsothunder.com wrote: On Oct 14, 2011, at 7:06 PM, Scott Rossi wrote: Thanks to all the folks who replied with drag and drop options. Pete's script was the most easy to get into (he sent it to me), and it looks like what I need. The only remaining question I had was found in the dragDestination, so all is well. Pete, could you post your code (or the stack somewhere) so others could get the benefit of your experience? Thanks, Ken Ray Sons of Thunder Software, Inc. Email: k...@sonsothunder.com Web Site: http://www.sonsothunder.com/ ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop Text into a field
You could set a customprop of the field control on mouseleave: on mouseleave set the uSelChunk of me to the selectedchunk end mouseleave then in your dragdrop handler: put the uSelChunk of fld targetField into selCh put word 2 of selCh into startChar put word 4 of selCh into endChar put the clipboardData[text] into char startChar to endChar of fld targetField -- Peter Peter M. Brigham pmb...@gmail.com http://home.comcast.net/~pmbrig On Sep 26, 2011, at 2:37 PM, Pete wrote: I'm trying to find a way to drag and drop text from a datagrid into a field control. If no text is selected in the field control, the text should be inserted at the insertion point; if text is selected, the dragged text should replace the selected text. The way I'm doing this is: - The dragStart handler for the datagrid places the text I want to insert into the clipboardData[text] - The dragEnter handler for the field control sets the focus on the field control - The dragDrop handler for the field control issues a paste command That all works fine when no text is selected in the field control, LC appears to remember where the insertion is in the field control. However, let's say I select some text in the field control. As soon as I click on a line in the datagrid to start the drag/drop operation, the text is no longer selected in the field control and when I drop the text into the field control it is inserted at what was the end point of the text I had originally selected. To illustrate, if the field control contains This is my Text and I select the word my, then drag the text your to the field Control, it will be inserted right after my instead of replacing it. Am I setting about this the wrong way or can this approach be made to work somehow? Thanks, Pete Molly's Revenge http://www.mollysrevenge.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop Text into a field
Thanks Peter, that sounds like it should work, I guess I'd assumed that LC would remember the selected text. The dictionary says that if no text is selected, the end char part of the selectedChunk is less than the startchar so I guess I'll need to check for that so that a normal insert works. Pete Molly's Revenge http://www.mollysrevenge.com On Mon, Sep 26, 2011 at 1:01 PM, Peter M. Brigham, MD pmb...@gmail.comwrote: You could set a customprop of the field control on mouseleave: on mouseleave set the uSelChunk of me to the selectedchunk end mouseleave then in your dragdrop handler: put the uSelChunk of fld targetField into selCh put word 2 of selCh into startChar put word 4 of selCh into endChar put the clipboardData[text] into char startChar to endChar of fld targetField -- Peter Peter M. Brigham pmb...@gmail.com http://home.comcast.net/~pmbrig On Sep 26, 2011, at 2:37 PM, Pete wrote: I'm trying to find a way to drag and drop text from a datagrid into a field control. If no text is selected in the field control, the text should be inserted at the insertion point; if text is selected, the dragged text should replace the selected text. The way I'm doing this is: - The dragStart handler for the datagrid places the text I want to insert into the clipboardData[text] - The dragEnter handler for the field control sets the focus on the field control - The dragDrop handler for the field control issues a paste command That all works fine when no text is selected in the field control, LC appears to remember where the insertion is in the field control. However, let's say I select some text in the field control. As soon as I click on a line in the datagrid to start the drag/drop operation, the text is no longer selected in the field control and when I drop the text into the field control it is inserted at what was the end point of the text I had originally selected. To illustrate, if the field control contains This is my Text and I select the word my, then drag the text your to the field Control, it will be inserted right after my instead of replacing it. Am I setting about this the wrong way or can this approach be made to work somehow? Thanks, Pete Molly's Revenge http://www.mollysrevenge.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop Text into a field
On Sep 26, 2011, at 4:51 PM, Pete wrote: Thanks Peter, that sounds like it should work, I guess I'd assumed that LC would remember the selected text. The dictionary says that if no text is selected, the end char part of the selectedChunk is less than the startchar so I guess I'll need to check for that so that a normal insert works. No need. If you have an insertion point after char 5 of a field, the selectedchunk is char 6 to 5 of fld targetField, and putting a text string into char 6 to 5 of fld targetField will insert the text after char 5 of the field, Ie, where the insertion point was. -- Peter Peter M. Brigham pmb...@gmail.com http://home.comcast.net/~pmbrig On Mon, Sep 26, 2011 at 1:01 PM, Peter M. Brigham, MD pmb...@gmail.comwrote: You could set a customprop of the field control on mouseleave: on mouseleave set the uSelChunk of me to the selectedchunk end mouseleave then in your dragdrop handler: put the uSelChunk of fld targetField into selCh put word 2 of selCh into startChar put word 4 of selCh into endChar put the clipboardData[text] into char startChar to endChar of fld targetField -- Peter Peter M. Brigham pmb...@gmail.com http://home.comcast.net/~pmbrig On Sep 26, 2011, at 2:37 PM, Pete wrote: I'm trying to find a way to drag and drop text from a datagrid into a field control. If no text is selected in the field control, the text should be inserted at the insertion point; if text is selected, the dragged text should replace the selected text. The way I'm doing this is: - The dragStart handler for the datagrid places the text I want to insert into the clipboardData[text] - The dragEnter handler for the field control sets the focus on the field control - The dragDrop handler for the field control issues a paste command That all works fine when no text is selected in the field control, LC appears to remember where the insertion is in the field control. However, let's say I select some text in the field control. As soon as I click on a line in the datagrid to start the drag/drop operation, the text is no longer selected in the field control and when I drop the text into the field control it is inserted at what was the end point of the text I had originally selected. To illustrate, if the field control contains This is my Text and I select the word my, then drag the text your to the field Control, it will be inserted right after my instead of replacing it. Am I setting about this the wrong way or can this approach be made to work somehow? Thanks, Pete Molly's Revenge http://www.mollysrevenge.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop Text into a field
As a follow up, is there a way to keep the selected text highlighted when the field loses focus? Right now, there's no visual indication when the new text is dragged into the field that it will replace some of the existing text rather than be inserted. The standard for this seems to be that when a filed loses focus, the selected text is shown with a light grey background instead of a blue background. Pete Molly's Revenge http://www.mollysrevenge.com On Mon, Sep 26, 2011 at 1:01 PM, Peter M. Brigham, MD pmb...@gmail.comwrote: You could set a customprop of the field control on mouseleave: on mouseleave set the uSelChunk of me to the selectedchunk end mouseleave then in your dragdrop handler: put the uSelChunk of fld targetField into selCh put word 2 of selCh into startChar put word 4 of selCh into endChar put the clipboardData[text] into char startChar to endChar of fld targetField -- Peter Peter M. Brigham pmb...@gmail.com http://home.comcast.net/~pmbrig On Sep 26, 2011, at 2:37 PM, Pete wrote: I'm trying to find a way to drag and drop text from a datagrid into a field control. If no text is selected in the field control, the text should be inserted at the insertion point; if text is selected, the dragged text should replace the selected text. The way I'm doing this is: - The dragStart handler for the datagrid places the text I want to insert into the clipboardData[text] - The dragEnter handler for the field control sets the focus on the field control - The dragDrop handler for the field control issues a paste command That all works fine when no text is selected in the field control, LC appears to remember where the insertion is in the field control. However, let's say I select some text in the field control. As soon as I click on a line in the datagrid to start the drag/drop operation, the text is no longer selected in the field control and when I drop the text into the field control it is inserted at what was the end point of the text I had originally selected. To illustrate, if the field control contains This is my Text and I select the word my, then drag the text your to the field Control, it will be inserted right after my instead of replacing it. Am I setting about this the wrong way or can this approach be made to work somehow? Thanks, Pete Molly's Revenge http://www.mollysrevenge.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop Text into a field
OK, thanks. Pete Molly's Revenge http://www.mollysrevenge.com On Mon, Sep 26, 2011 at 2:09 PM, Peter M. Brigham, MD pmb...@gmail.comwrote: On Sep 26, 2011, at 4:51 PM, Pete wrote: Thanks Peter, that sounds like it should work, I guess I'd assumed that LC would remember the selected text. The dictionary says that if no text is selected, the end char part of the selectedChunk is less than the startchar so I guess I'll need to check for that so that a normal insert works. No need. If you have an insertion point after char 5 of a field, the selectedchunk is char 6 to 5 of fld targetField, and putting a text string into char 6 to 5 of fld targetField will insert the text after char 5 of the field, Ie, where the insertion point was. -- Peter Peter M. Brigham pmb...@gmail.com http://home.comcast.net/~pmbrig On Mon, Sep 26, 2011 at 1:01 PM, Peter M. Brigham, MD pmb...@gmail.com wrote: You could set a customprop of the field control on mouseleave: on mouseleave set the uSelChunk of me to the selectedchunk end mouseleave then in your dragdrop handler: put the uSelChunk of fld targetField into selCh put word 2 of selCh into startChar put word 4 of selCh into endChar put the clipboardData[text] into char startChar to endChar of fld targetField -- Peter Peter M. Brigham pmb...@gmail.com http://home.comcast.net/~pmbrig On Sep 26, 2011, at 2:37 PM, Pete wrote: I'm trying to find a way to drag and drop text from a datagrid into a field control. If no text is selected in the field control, the text should be inserted at the insertion point; if text is selected, the dragged text should replace the selected text. The way I'm doing this is: - The dragStart handler for the datagrid places the text I want to insert into the clipboardData[text] - The dragEnter handler for the field control sets the focus on the field control - The dragDrop handler for the field control issues a paste command That all works fine when no text is selected in the field control, LC appears to remember where the insertion is in the field control. However, let's say I select some text in the field control. As soon as I click on a line in the datagrid to start the drag/drop operation, the text is no longer selected in the field control and when I drop the text into the field control it is inserted at what was the end point of the text I had originally selected. To illustrate, if the field control contains This is my Text and I select the word my, then drag the text your to the field Control, it will be inserted right after my instead of replacing it. Am I setting about this the wrong way or can this approach be made to work somehow? Thanks, Pete Molly's Revenge http://www.mollysrevenge.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop Row Arrangement in DataGrid
Yes, but that is not what is keeping you from doing drag and drop operations. You have to code your drag and drop. Zryip's Data Grid Helper has, among a great many other benefits, the ability to add a drag and drop script for you. It does beg the question though, whether or not a drag and drop in a sorted datagrid will disable the sort! It certainly should! You can probably handle this in your dragDrop or dragReorderDrop handler. Bob On Mar 3, 2011, at 8:28 AM, RevList wrote: I don't know if this is possible or not, but I thought I would ask. If you turn off sorting in a datagrid, is it possible to do drag and drop rearranging of rows? Has anyone done this? Is there a lesson on this, or does someone have a sample stack that would demonstrate this? Thank in advance. ** Stewart Lynch CreaTECH Solutions sly...@createchsol.com 604.484.8499 Skype:StewartLynch There are only 10 kinds of people. Those who understand binary and those who don't. ** ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop Row Arrangement in DataGrid
Bob Sneidar b...@twft.com on March 3, 2011 at 9:11 AM -0800 wrote: Yes, but that is not what is keeping you from doing drag and drop operations. You have to code your drag and drop. Zryip's Data Grid Helper has, among a great many other benefits, the ability to add a drag and drop script for you. It does beg the question though, whether or not a drag and drop in a sorted datagrid will disable the sort! It certainly should! You can probably handle this in your dragDrop or dragReorderDrop handler. I have Data Grid Helper, but as you point out, it is the code that is holding me back. I am not at all clear how to implement this and was hoping that there was a sample stack out there somewhere where someone had already done this, and I can learn from it. Stewart ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop Row Arrangement in DataGrid
I wrote on March 3, 2011 at 10:28 AM -0800 wrote: I have Data Grid Helper, but as you point out, it is the code that is holding me back. I am not at all clear how to implement this and was hoping that there was a sample stack out there somewhere where someone had already done this, and I can learn from it. Nevermind. I just went back to my Developer Conference DVD set from RunRev Live 09 and found Trevor's Advanced Data Grid techniques video. It shows me exactly what I need to know. BTW, this video is excellent to help one understand how data grids work and what is going on behind the scene. Stewart ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop Row Arrangement in DataGrid
I just tried this on my own DataGrid and I was able to drag and drop with a column sort enabled. When I do this, the column sort property is still set, but the column is unsorted, so this does not happen auto-magically. I think the key then is to set the Sort By Column property to empty before you change the contents of the datagrid. You would do this in the DragDrop or the dragReorderDrop handler of the destination datagrid. (You can only use one or the other in a script one takes priority, I think it's dragReorderDrop). What is rather unfortunate at this time is that the API on lessons.runrev.com list this command under data grid properties, and then not the actual name of the command, without spaces. I give you: sort by column - The column that the table data is currently being sorted by. You can set this property to sort by a new column. You would use: sortByColumn empty to set the sort to nothing. Otherwise, if you do something like set the dgText (or dgData if I am not mistaken) the refresh will sort the datagrid which is probably not the behavior you want in a drag and drop situation. So my dragReorderDrop handler looks like this. Keep in mind I have modified it to work for dragging and dropping a single cell in a single column. But the relevant code is that I issue the command sortByColumn empty just before I modify the data in the datagrid. on DragReorderDrop pOriginatingIndex, pStartLine, pDroppedOnLine local tTheDragData put the dragData[private] into tTheDragData put the dragsource into theSource put the dragdestination into theDestination ## Reorder Items -- We don't want to move whole lines, only the items in a column -- get the control the user clicked on put line 2 of tTheDragData into theControlID put word 1 of the short name of theControlID into theColumn put the dgIndex of thesource into theSourceID put the dgIndex of thedestination into theDestinationID put the dgDataOfIndex[theSourceID] of me into aSourceData put the dgDataOfIndex[theDestinationID] of me into aDestinationData if aSourceData is not an array or aDestinationData is not an array then answer What the hell is going on here??!? cr \ theSource cr theDestination with I have no idea!!! end if sortByColumn empty -- the magical line of code put aSourceData[theColumn] into temp put aDestinationData[theColumn] into aSourceData[theColumn] put temp into aDestinationData[theColumn] set the dgDataOfIndex[theSourceID] of me to aSourceData set the dgDataOfIndex[theDestinationID] of me to aDestinationData end DragReorderDrop BTW if you use the message box to issue the command: edit the script of the behavior of group dgMyDataGrid You can see what is going on behind the scenes and find out all the stuff you can do with a data grid. I am learning a lot that way. Bob ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and drop a Bookmark
Is this under Windows? Because on OSX I get the URL and not the title when dragging bookmarks from both Safari and Firefox into a Livecode field. In fact from memory, to get the title on a Mac you need to grab the url, load it and then parse the text between the title tags. Hi Terry It's on Mac with the Opera browser. With Safari I get indeed the URL (?). on dragenter set the acceptdrop to true end dragenter on dragdrop put url (the dragData) into theHTML put offset(title,theHTML)+7 into b put offset(/title,theHTML)-1 into z put char b to z of theHTML into me put cr the dragData after me --the URL itself end dragdrop Thanks Marty, That script works fine - with Safari. With Opera I get only the title. On the other hand: when I drag the URL out of the browser (grabing it by the favicon) and drop it on the desktop, I get a file with the title as the filename (Safari) and the URL as the filename (Opera)??? By the way (LiveCode dictionary): ...The acceptDrop property is deprecated as of version 2.9. Setting the acceptDrop to true is equivalent to setting the dragAction to copy. I have to do more research tomorrow Thomas ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and drop a Bookmark
On 1/03/11 9:02 AM, Thomas Bähler toel...@swissonline.ch wrote: Is this under Windows? Because on OSX I get the URL and not the title when dragging bookmarks from both Safari and Firefox into a Livecode field. In fact from memory, to get the title on a Mac you need to grab the url, load it and then parse the text between the title tags. Hi Terry It's on Mac with the Opera browser. With Safari I get indeed the URL (?). Yeah - it's almost as if Opera's bookmarks have been implemented 'the wrong way around'. There doesn't seem to be any obvious way to get the url by dragging a bookmark directly from Opera to Livecode. Terry... -- Dr Terry Judd | Senior Lecturer in Medical Education Medical Education Unit Melbourne Medical School The University of Melbourne ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and drop a Bookmark
Is this under Windows? Because on OSX I get the URL and not the title when dragging bookmarks from both Safari and Firefox into a Livecode field. In fact from memory, to get the title on a Mac you need to grab the url, load it and then parse the text between the title tags. Terry... On 28/02/11 7:15 AM, Thomas Bähler toel...@swissonline.ch wrote: Hi I'd like to drag a bookmark off a browser and drop it in a field in LiveCode. So far I get only the titel of the bookmark in the field but not the URL. For instance, I get iGoogle but I would like to get http://www.google.com/ig;. Or even better, I want to retrieve both chunks. How do I do this? Thanks Thomas ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode -- Dr Terry Judd | Senior Lecturer in Medical Education Medical Education Unit Melbourne Medical School The University of Melbourne ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and drop a Bookmark
My script assumes that you've saved the webloc to disk. If you drag and drop right off the browser window it will just get the url. In that case, you could then grab the url and parse it for the Title tag. Marty Hey Thomas, You need to get the contents of the dragData. Here's a quick a dirty script that will put the name of the bookmark on line 1 and the url on line 2. Put this in the field script: on dragenter set the acceptdrop to true end dragenter on dragdrop set the itemDelimiter to / put item -1 of the dragData cr into me put url(file: the dragdata) into tData get lineOffset(string,tData) put char 10 to -10 of line it of tData after me end dragdrop Marty Knapp Hi I'd like to drag a bookmark off a browser and drop it in a field in LiveCode. So far I get only the titel of the bookmark in the field but not the URL. For instance, I get iGoogle but I would like to get http://www.google.com/ig;. Or even better, I want to retrieve both chunks. How do I do this? Thanks Thomas ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and drop a Bookmark
I just realized I forgot to insert the script (time to go to bed!) This is to drag right from the browser to a field: on dragdrop put url (the dragData) into theHTML put offset(title,theHTML)+7 into b put offset(/title,theHTML)-1 into z put char b to z of theHTML into me put cr the dragData after me --the URL itself end dragdrop One problem would be if there is no Title tag and the format of the tags may vary a bit. Marty Hey Thomas, You need to get the contents of the dragData. Here's a quick a dirty script that will put the name of the bookmark on line 1 and the url on line 2. Put this in the field script: on dragenter set the acceptdrop to true end dragenter on dragdrop set the itemDelimiter to / put item -1 of the dragData cr into me put url(file: the dragdata) into tData get lineOffset(string,tData) put char 10 to -10 of line it of tData after me end dragdrop Marty Knapp Hi I'd like to drag a bookmark off a browser and drop it in a field in LiveCode. So far I get only the titel of the bookmark in the field but not the URL. For instance, I get iGoogle but I would like to get http://www.google.com/ig;. Or even better, I want to retrieve both chunks. How do I do this? Thanks Thomas ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop
Peter Haworth wrote: I'm not sure what changed. It seems to be inconsistent as to whether the snapback happens or not but most of the time it does. Pete Haworth On Feb 8, 2011, at 10:22 PM, Thierry wrote: And Peter, what was working when you answered my mail, and then has changed ? On this I would go with Ben Beaumont's analysis, since he's working side-by-side with the engine team and has an understanding of what it's doing under the hood in a way we can't know from the outside: http://lists.runrev.com/pipermail/use-livecode/2011-February/152813.html -- Richard Gaskin Fourth World LiveCode training and consulting: http://www.fourthworld.com Webzine for LiveCode developers: http://www.LiveCodeJournal.com LiveCode Journal blog: http://LiveCodejournal.com/blog.irv ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop
I'm a Mac with OSX 10.6, LC 4.5.3 Pete Haworth On Feb 8, 2011, at 11:45 PM, Thierry wrote: Le 9 févr. 2011 à 08:28, Peter Haworth a écrit : I'm not sure what changed. It seems to be inconsistent as to whether the snapback happens or not but most of the time it does. Thanks, Obviously, we're running on different contexts... Thierry Pete Haworth On Feb 8, 2011, at 10:22 PM, Thierry wrote: And Peter, what was working when you answered my mail, and then has changed ? ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop
I can confirm that Ben's workaround fixes the problem. Pete Haworth On Feb 9, 2011, at 6:08 AM, Richard Gaskin wrote: On this I would go with Ben Beaumont's analysis, since he's working side-by-side with the engine team and has an understanding of what it's doing under the hood in a way we can't know from the outside: ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop
Peter Haworth wrote: I guess I should look again at the IDE script and see what it does after a control has been dropped onto a card, I bet that would reveal all! Maybe. The Rev IDE drag-and-drop routines were written before the overhaul of the drag-and-drop syntax which has since simplified messaging and allowed us to set the dragImage and dragImageOffsets. This quick example shows one way to use the more recent syntax to drag-copy and object from one window to another without having to use an intermediary translucent stack to simulate the drag image: go url http://www.fourthworldlabs.com/rev/drag.rev; It inserts a frontScript to track the dragMove message, doing the window hit testing there, removing the script when the action is done. The only problem I can find with this approach is that it snaps back the dragImage to the source, even though the allowDrop has been set to true. I've seen this anomaly with other drag actions as well - if anyone here knows a reliable way to prevent that I'm be most grateful. -- Richard Gaskin Fourth World LiveCode training and consulting: http://www.fourthworld.com Webzine for LiveCode developers: http://www.LiveCodeJournal.com LiveCode Journal blog: http://LiveCodejournal.com/blog.irv ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop
Thanks Richard, that looks very nice. I too would like to hear how to prevent the snap back you mentioned. I guess I somehow got the impression it wasn't possible to drag a control from one stack to another with the standard drag/drop handlers somewhere in this thread but this shows it is. Pete Haworth On Feb 8, 2011, at 6:56 AM, Richard Gaskin wrote: Peter Haworth wrote: I guess I should look again at the IDE script and see what it does after a control has been dropped onto a card, I bet that would reveal all! Maybe. The Rev IDE drag-and-drop routines were written before the overhaul of the drag-and-drop syntax which has since simplified messaging and allowed us to set the dragImage and dragImageOffsets. This quick example shows one way to use the more recent syntax to drag-copy and object from one window to another without having to use an intermediary translucent stack to simulate the drag image: go url http://www.fourthworldlabs.com/rev/drag.rev; It inserts a frontScript to track the dragMove message, doing the window hit testing there, removing the script when the action is done. The only problem I can find with this approach is that it snaps back the dragImage to the source, even though the allowDrop has been set to true. I've seen this anomaly with other drag actions as well - if anyone here knows a reliable way to prevent that I'm be most grateful. -- Richard Gaskin Fourth World LiveCode training and consulting: http://www.fourthworld.com Webzine for LiveCode developers: http://www.LiveCodeJournal.com LiveCode Journal blog: http://LiveCodejournal.com/blog.irv ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop
Le 8 févr. 2011 à 15:56, Richard Gaskin a écrit : The only problem I can find with this approach is that it snaps back the dragImage to the source, even though the allowDrop has been set to true. if anyone here knows a reliable way to prevent that I'm be most grateful. Hi Richard, I add one more line in your mousedown script. See below Please, let me know if it works. Regards, Thierry on mouseDown put the long id of me into tObj export snapshot from tObj to tVar as PNG set the width of img 1 to the width of tObj set the height of img 1 to the height of tOBj set the visible of img 1 to false put tVar into img 1 end mouseDown ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop
Thiery, I tried that and it works. Stops the snapback and hides the image which was being displayed. Thanks! Pete Haworth On Feb 8, 2011, at 10:44 AM, Thierry wrote: Le 8 févr. 2011 à 15:56, Richard Gaskin a écrit : The only problem I can find with this approach is that it snaps back the dragImage to the source, even though the allowDrop has been set to true. if anyone here knows a reliable way to prevent that I'm be most grateful. Hi Richard, I add one more line in your mousedown script. See below Please, let me know if it works. Regards, Thierry on mouseDown put the long id of me into tObj export snapshot from tObj to tVar as PNG set the width of img 1 to the width of tObj set the height of img 1 to the height of tOBj set the visible of img 1 to false put tVar into img 1 end mouseDown ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop
One other possible change- should there be a 'reset templatebutton' at then end of the dragEnd handler? Pete Haworth On Feb 8, 2011, at 10:44 AM, Thierry wrote: Le 8 févr. 2011 à 15:56, Richard Gaskin a écrit : The only problem I can find with this approach is that it snaps back the dragImage to the source, even though the allowDrop has been set to true. if anyone here knows a reliable way to prevent that I'm be most grateful. Hi Richard, I add one more line in your mousedown script. See below Please, let me know if it works. Regards, Thierry on mouseDown put the long id of me into tObj export snapshot from tObj to tVar as PNG set the width of img 1 to the width of tObj set the height of img 1 to the height of tOBj set the visible of img 1 to false put tVar into img 1 end mouseDown ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop
Thierry wrote: Le 8 févr. 2011 à 15:56, Richard Gaskin a écrit : The only problem I can find with this approach is that it snaps back the dragImage to the source, even though the allowDrop has been set to true. if anyone here knows a reliable way to prevent that I'm be most grateful. Hi Richard, I add one more line in your mousedown script. See below Please, let me know if it works. Regards, Thierry on mouseDown put the long id of me into tObj export snapshot from tObj to tVar as PNG set the width of img 1 to the width of tObj set the height of img 1 to the height of tOBj set the visible of img 1 to false put tVar into img 1 end mouseDown Unfortunately setting the image visibility to false has no effect. I had it visible only because it's a demo and it's fun to watch the image change; I have production code with such images false and still get the snap-back. RunRev's Ben Beaumont offered this tip on the dev list which works a treat, also noting that this bug will be fixed in v4.6: --- Firstly, we've tracked down the problem and fixed it for the next release. In the meantime and for those using older version of LC here is a workaround: on dragEnd remove script of btn ObjectDragFrontScript from front put gObjectDragInfoA[stack] into tDestStack send doDragEnd tDestStack to me in 0 millisecs end dragEnd on doDragEnd tDestStack if tDestStack empty then put gObjectDragInfoA[loc] into tLoc set the defaultStack to tDestStack set the properties of the templateButton to \ the properties of me lock screen create btn set the loc of last control to tLoc select last control end if end doDragEnd The problem occurs because creating a button and setting the loc causes (at some point) the dragAction global property to be reset, which is then what the engine is returning to the OS - hence the 'drag didn't succeed' snap-back. The engine should really return the value of 'dragAction' at the point the drop occured (before any messages are sent), rather than after the drop had been processed. This is the underlying bug. -- Thanks, Ben! -- Richard Gaskin Fourth World LiveCode training and consulting: http://www.fourthworld.com Webzine for LiveCode developers: http://www.LiveCodeJournal.com LiveCode Journal blog: http://LiveCodejournal.com/blog.irv ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop
Peter Haworth wrote: One other possible change- should there be a 'reset templatebutton' at then end of the dragEnd handler? Good catch. Yes, ideally there should be, or perhaps even better to store the properties of the templateButton into a temporary array, and then reset it to those values before exiting (just in case any other script may be relying on custom settings). -- Richard Gaskin Fourth World LiveCode training and consulting: http://www.fourthworld.com Webzine for LiveCode developers: http://www.LiveCodeJournal.com LiveCode Journal blog: http://LiveCodejournal.com/blog.irv ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop
Peter Haworth wrote: I guess I somehow got the impression it wasn't possible to drag a control from one stack to another with the standard drag/drop handlers somewhere in this thread but this shows it is. Strictly speaking that's still true: you can move an object around in its own stack, but not between stacks. What we're doing here is recreating the object from scratch in the other window. -- Richard Gaskin Fourth World LiveCode training and consulting: http://www.fourthworld.com Webzine for LiveCode developers: http://www.LiveCodeJournal.com LiveCode Journal blog: http://LiveCodejournal.com/blog.irv ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop
Thanks Richard. Despite what I said in my earlier email about Thiery's fix for the snapback, you are correct that it doesn't fix it. Somehow or other, the snapback occasionally doesn't happen, at least in my stack, but most of the time it does. I think I'll just live with it until 4.6. I've pretty much got all this working now. I ended using images of the controls to be dragged not the controls themselves. Each image has a custom property with the ID of the real control that is to be placed onto the destination stack. I found I had to do that because all the controls have custom behaviors which were sometimes being triggered when I clicked on the to begin the drag. Pete Haworth On Feb 8, 2011, at 3:58 PM, Richard Gaskin wrote: Peter Haworth wrote: One other possible change- should there be a 'reset templatebutton' at then end of the dragEnd handler? Good catch. Yes, ideally there should be, or perhaps even better to store the properties of the templateButton into a temporary array, and then reset it to those values before exiting (just in case any other script may be relying on custom settings). -- Richard Gaskin Fourth World LiveCode training and consulting: http://www.fourthworld.com Webzine for LiveCode developers: http://www.LiveCodeJournal.com LiveCode Journal blog: http://LiveCodejournal.com/blog.irv ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop
Le 9 févr. 2011 à 00:55, Richard Gaskin a écrit Unfortunately setting the image visibility to false has no effect. I have production code with such images false and still get the snap-back. Ummm, I tried it again with a fresh mind this early morning, still works for me ! And Peter, what was working when you answered my mail, and then has changed ? Enjoy your day. Thierry ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop
I'm not sure what changed. It seems to be inconsistent as to whether the snapback happens or not but most of the time it does. Pete Haworth On Feb 8, 2011, at 10:22 PM, Thierry wrote: And Peter, what was working when you answered my mail, and then has changed ? ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop
Le 9 févr. 2011 à 08:28, Peter Haworth a écrit : I'm not sure what changed. It seems to be inconsistent as to whether the snapback happens or not but most of the time it does. Thanks, Obviously, we're running on different contexts... Thierry Pete Haworth On Feb 8, 2011, at 10:22 PM, Thierry wrote: And Peter, what was working when you answered my mail, and then has changed ? ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop
OK, I have this working. Thank you SCott for pointing me to your script. I had to change Scott's script because his demo creates a destination stack on the fly so he knows it's name, location, etc. In my case, I needed the user to be able to drop the control onto any currently open stack. And, as someone else pointed out, the mouseStack property does NOT correctly report the name of the stack that the mouse is over unless you are in a mouseUp handler, or at least it didn't in Scott's handler. Sorry to keep harping on this, but the dictionary, yet again, is flawed. I found the IDE code that handles the drag and drop of controls from the Tools palette. It figures out which stack the mouse is over by comparing the mouse location to the rectangle of each open stack. So I did the same thing and it works fine. I hope I'm not breaking any intellectual property laws. I'm left with one strangeness. As a control is being dragged, it has a blue background. After it is copied to the new stack, it still has a blue background until I click on it, then it goes back to the background of the original control. I noticed that happening in Scott's script (except it's green instead of blue). Not a big deal but Scott, wondering if you might have a fix for that? Pete Haworth On Feb 6, 2011, at 9:55 PM, Scott Rossi wrote: Pete: There are several drag and drop references you can explore (for example, the LiveCode User Guide found under Help User Guide, page 262). LC has all the commands to implement what you want. On a semi-related note, I have a drag and drop sample stack that is all LiveCode script, based on work done by the late Eric Chatonet. I wanted a drag and drop routine that represented dragged objects using their original forms, rather than a rectangle. You can get the stack by executing the following in your message box: go url http://www.tactilemedia.com/site_files/downloads/TMdragndrop.rev; Start dragging any object and the drop stack will open automatically. Note that this doesn't use LC's drag and drop routines, and as such has a couple of limitations, so learning the real drag and drop routines might be better in the long run. But the scripted solution works fine for me. As they say, YMMV. Regards, Scott Rossi Creative Director Tactile Media, UX Design Recently, Peter Haworth wrote: Sounds perfect! Now if I only knew how to do that. Pete Haworth On Feb 6, 2011, at 5:21 PM, dunb...@aol.com wrote: If you know what controls are where, and you must because you made them, named them and placed them on your palette, then can't you just get target info, clone the control, and make it track the mouse until dropped? Or am I missing everything? Craig Newman -Original Message- From: Peter Haworth p...@mollysrevenge.com To: How to use LiveCode use-livecode@lists.runrev.com Sent: Sun, Feb 6, 2011 4:16 pm Subject: Drag and Drop I would like to set up the equivalent of the LC Tools palette so I can drag and drop some custom controls from it to any card. Mark - I read your excellent write up on Drag and Drop but it seems to be aimed at a different situation than this (dragging info from one control to another). I also used the message watcher to see what happens when I drag an LC control from the LC tools palette to a card and I didn;t see any of the standard drag/drop messages. Any tips on how to set about doing this? Pete Haworth ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop
On 2/7/11 7:07 PM, Peter Haworth wrote: And, as someone else pointed out, the mouseStack property does NOT correctly report the name of the stack that the mouse is over unless you are in a mouseUp handler, or at least it didn't in Scott's handler. Sorry to keep harping on this, but the dictionary, yet again, is flawed. If that's so, then it sounds like the mousestack property is only updated on idle. I know that's true of lots of other properties. If your dragging handler uses a repeat until the mouse is up structure, you aren't giving any time to the engine and lots of things won't get updated. It's a good argument for using send instead. Repeat loops are slow and memory hogs too. http://www.hyperactivesw.com/polling.html I found the IDE code that handles the drag and drop of controls from the Tools palette. It figures out which stack the mouse is over by comparing the mouse location to the rectangle of each open stack. So I did the same thing and it works fine. I hope I'm not breaking any intellectual property laws. Nope, it's not only fine, it's encouraged. That's why RR leaves the scripts unlocked. It's a great way to learn. I'm left with one strangeness. As a control is being dragged, it has a blue background. After it is copied to the new stack, it still has a blue background until I click on it, then it goes back to the background of the original control. I noticed that happening in Scott's script (except it's green instead of blue). Not a big deal but Scott, wondering if you might have a fix for that? If a script sets any properties of the template object, then all new controls of that type will also use those properties until the template is reset. Use reset the templatewhatever before creating a new control to revert it back to the default values. I.e., for a field, reset the templatefield. -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop
Pete- Monday, February 7, 2011, 5:07:02 PM, you wrote: I found the IDE code that handles the drag and drop of controls from the Tools palette. It figures out which stack the mouse is over by comparing the mouse location to the rectangle of each open stack. So I did the same thing and it works fine. I hope I'm not breaking any intellectual property laws. AFAIK that's the only way to do it. -- -Mark Wieder mwie...@ahsoftware.net ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop
Scott- Sunday, February 6, 2011, 9:55:14 PM, you wrote: On a semi-related note, I have a drag and drop sample stack that is all LiveCode script, based on work done by the late Eric Chatonet. I wanted a drag and drop routine that represented dragged objects using their original forms, rather than a rectangle. You can get the stack by executing the I think that's the only way to get objects dragged from one stack to another. As you mentioned, it has the limitation that the source and destination objects have to have the same appearance, i.e., not a graphic representing a more complex object of a different size. But that can also be handled by getting a lot fancier with the code. -- -Mark Wieder mwie...@ahsoftware.net ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop
On Feb 7, 2011, at 5:29 PM, J. Landman Gay wrote: On 2/7/11 7:07 PM, Peter Haworth wrote: And, as someone else pointed out, the mouseStack property does NOT correctly report the name of the stack that the mouse is over unless you are in a mouseUp handler, or at least it didn't in Scott's handler. Sorry to keep harping on this, but the dictionary, yet again, is flawed. If that's so, then it sounds like the mousestack property is only updated on idle. I know that's true of lots of other properties. If your dragging handler uses a repeat until the mouse is up structure, you aren't giving any time to the engine and lots of things won't get updated. It's a good argument for using send instead. Repeat loops are slow and memory hogs too. http://www.hyperactivesw.com/polling.html Yes, that's essentially what it does although it's not really my script, it's Scott's :-) I'll probably leave it as it is for now and take the performance hit - I'll probably break it if I mess with it! I found the IDE code that handles the drag and drop of controls from the Tools palette. It figures out which stack the mouse is over by comparing the mouse location to the rectangle of each open stack. So I did the same thing and it works fine. I hope I'm not breaking any intellectual property laws. Nope, it's not only fine, it's encouraged. That's why RR leaves the scripts unlocked. It's a great way to learn. I was wondering about that, glad it's OK! I'm left with one strangeness. As a control is being dragged, it has a blue background. After it is copied to the new stack, it still has a blue background until I click on it, then it goes back to the background of the original control. I noticed that happening in Scott's script (except it's green instead of blue). Not a big deal but Scott, wondering if you might have a fix for that? If a script sets any properties of the template object, then all new controls of that type will also use those properties until the template is reset. Use reset the templatewhatever before creating a new control to revert it back to the default values. I.e., for a field, reset the templatefield. Scott's script use templateStack and templateImage but he resets those. My testing has been done with a button so far and I don't see anywhere where the templateButton is used. I tried resetting it anyway, but still the same result. Would be nice to figure out what's happening but it's not a big concern. -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Drag and Drop
On Feb 6, 2011, at 1:35 PM, Mark Wieder wrote: Pete- Sunday, February 6, 2011, 1:16:54 PM, you wrote: Any tips on how to set about doing this? Stay tuned g The musician's mantra! -- -Mark Wieder mwie...@ahsoftware.net ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode