Drag Act

Want to talk about something that isn't covered by another category?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9446
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Drag Act

Post by richmond62 » Sat Oct 29, 2022 5:16 pm

So . . . getting "all excited" (well, not that much as, as usual, the hype and the tripe don't coincide) about
Apple's new and much talked-up Freeform app for MacOS (that means, on your computer screen rather than
a tablet):

https://www.macrumors.com/2022/10/25/io ... eform-app/

I noticed how one can:

1. Drag an image from outwith Freeform onto its window.

2. Drag an RTF document from outwith Freeform onto its window.

The question . . .
-
RuPaul.jpg
RuPaul.jpg (25.64 KiB) Viewed 2714 times
-
Err, No, not that question, although I am feeling fairly camp today. :roll:

The question is, is there a way to drag images and text documents from a folder window onto a LiveCode stack?

Klaus
Posts: 13864
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Drag Act

Post by Klaus » Sat Oct 29, 2022 5:38 pm

Hi Richmond,

here a quick and dirty demo stack, check the card script.
This should get you started.

Best

Klaus
Attachments
ru_paul.livecode.zip
(1.1 KiB) Downloaded 71 times

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9446
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Drag Act

Post by richmond62 » Sat Oct 29, 2022 5:49 pm

Fantastic, Klaus!

Thank you very much indeed!

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9446
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Drag Act

Post by richmond62 » Sat Oct 29, 2022 5:52 pm

The RTF drag needs a spot of fine tuning:
-
SShot 2022-10-29 at 19.51.35.png
SShot 2022-10-29 at 19.51.35.png (17.69 KiB) Viewed 2708 times
-
This is because the default textSize of a new field is 12.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9446
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Drag Act

Post by richmond62 » Sat Oct 29, 2022 6:14 pm

SShot 2022-10-29 at 20.12.39.png
SShot 2022-10-29 at 20.12.39.png (5.39 KiB) Viewed 2695 times
-

Code: Select all

 case tSuffix = "rtf" 
         create field
         set the rtftext of last fld to url("file:" & tFile)
         ---- Richmond 29/10/22
         focus on last fld
         select text of last fld
         put the textSize of the selectedText into TXSZ
         set the textSize of last fld to TXSZ
         set the height of last fld to the formattedHeight of last fld
         set the width of last fld to the formattedWidth of last fld
         focus on nothing
         ----
         break
Not sure WHY focus on nothing does NOT remove focus from the field.
-
focusN.jpg
Focus on nothing
focusN.jpg (7.64 KiB) Viewed 2689 times
Attachments
ru_paul_ #2.livecode.zip
Stack.
(1.24 KiB) Downloaded 63 times

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9446
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Drag Act

Post by richmond62 » Sat Oct 29, 2022 6:32 pm

Err . . . perhaps the state of the Dictionary might be something to do with that:
-
SShot 2022-10-29 at 20.28.36.png
-
A great source of comfort:
-
SShot 2022-10-29 at 20.31.42.png
SShot 2022-10-29 at 20.31.42.png (26.13 KiB) Viewed 2684 times

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9446
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Drag Act

Post by richmond62 » Sat Oct 29, 2022 6:35 pm

Deepjoy:
-
SShot 2022-10-29 at 20.33.28.png
SShot 2022-10-29 at 20.33.28.png (24.13 KiB) Viewed 2671 times
-
SShot 2022-10-29 at 20.33.46.png
SShot 2022-10-29 at 20.33.46.png (23.27 KiB) Viewed 2671 times

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9446
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Drag Act

Post by richmond62 » Sat Oct 29, 2022 6:45 pm

Aaaaaah:
-

Code: Select all

case tSuffix = "rtf" 
         create field
         set the rtftext of last fld to url("file:" & tFile)
         ---- Richmond 29/10/22
         focus on last fld
         select text of last fld
         put the textSize of the selectedText into TXSZ
         set the textSize of last fld to TXSZ
         set the height of last fld to the formattedHeight of last fld
         set the width of last fld to the formattedWidth of last fld
         select empty
         ----
         break
Attachments
ru_paul_ #3.livecode.zip
Stack.
(1.24 KiB) Downloaded 68 times

Post Reply

Return to “Off-Topic”