Page 1 of 1

paste image - browser widget - suspend developer tools

Posted: Mon Nov 30, 2020 3:21 am
by rodneyt
Hi everyone,
I am using the Livecode browser widget. My app (www.ob3.io) allows users to paste many types of content direct into browser including images. So for example if the user is working in OB3 (loaded within Livecode browser widget) they can paste an image on the clipboard INTO the browser widget and it will upload it to OB3. This is working.

I have two problems:

When in development mode pasting an image will upload it to the browser widget AND paste an image object in Livecode. I haven't had any luck in attempting to stop this behaviour so far.

on pasteKey -- replace returns with spaces before pasting
#paste
end pasteKey

I can use pasteKey to prevent pasting. For example if I made a empty stack and added this script to the card, then did suspend development tools, and attempted to paste card Livecode will NOT paste image. If enable "paste" it would enable pasting an image... so far so good, right?...

My problem is that when I suspend development tools Livecode won't allow me to paste into the browser widget at all. But it will let me use cmd + v to paste into the example stack (above)

I haven't added a menubar to my app yet, so perhaps it's just something as simple as adding an Edit menu?

Has anyone had any experience in this area?

Re: paste image - browser widget - suspend developer tools

Posted: Mon Nov 30, 2020 3:43 am
by rodneyt
So here's the test:
- make a stack
1.
- put an image on your clipboard (e.g. take a screenshot to clipboard for example)
- paste with cmd + v - image is created as Livecode image

2.
- delete image
- suspend development tools from Development menu
- paste image: image is created
- restore dev tools

3.
- add a browser widget to the stack - set it to load google: go to browse mode browser appears
- suspend development tools
- paste image on clipboard: beep nothing happens!

So it seems if you have a browser widget it grabs focus, and assumes (WRONGLY) that user won't want to paste binary data into the browser widget.

Am I missing something here?

Re: paste image - browser widget - suspend developer tools

Posted: Mon Nov 30, 2020 4:27 am
by rodneyt
OK progress...

Adding a menubar to my stack and including in the edit menu the following items has helped. Now I can paste into the browser object without it pasting a livecode image, and it also works with or without suspending developer tools. It's not clear to me why I needed to create a system menu, but this appears to have helped (a lot).... moving on

Code: Select all

on menuPick pWhich
   switch pWhich
      case "Undo"
         undo
         break
      case "Cut"
         cut
         break
      case "Copy"
         copy
         break
      case "Paste"
         paste
         break
      case "Clear"
         put empty into the selection
   end switch
end menuPick