Recent

Author Topic: Clipboard - is it Global or Local  (Read 7784 times)

polypress

  • Jr. Member
  • **
  • Posts: 91
Clipboard - is it Global or Local
« on: September 23, 2013, 01:19:18 pm »
I am running several android apps which need to access a common clipboard so that data can be transferred between them.
When each app is started, it accepts the data from another app via the clipboard.
However, when a given app copies its own data to the clipboard then it is no longer accessible to the other apps' clipboard data. It is as if it has its own local clipboard, and can access that data but not the data from the "global" clipboard.
Whatever data is copied to the clipboard IS accessible by other third party apps (eg AK Notepad).

How can I make an app accessible to another app's clipboard data in addition to its own clipboard data?

Regards

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: Clipboard - is it Global or Local
« Reply #1 on: September 23, 2013, 03:28:00 pm »
yes clipboard can have only a single applications data, each copy to clipboard operation will override the previous data that is how global data work. No there is no way to have multiple global clipboards no there is no such thing as local clipboard a local clipboard is simple any application global variable accesible from all the application's components and forms.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

polypress

  • Jr. Member
  • **
  • Posts: 91
Re: Clipboard - is it Global or Local
« Reply #2 on: September 23, 2013, 04:50:42 pm »
I thought so.
What I am getting is as follows:-

app1 no clipboard data
app2 no clipboard data
app2 copy x to clipboard (OK)
app1 paste x from app2 (OK)
app1 copy y to clipboard (OK)
app2 paste only x (app2); it doesn't see y (app1)

It's acting as if each app has its own clipboard, but you say that's impossible. Why do I get the sequence above?

Regards

User137

  • Hero Member
  • *****
  • Posts: 1791
    • Nxpascal home
Re: Clipboard - is it Global or Local
« Reply #3 on: September 23, 2013, 04:56:15 pm »
So it's only working 1 way it seems? Your app1 clearly doesn't use local clipboard but a global, otherwise it wouldn't get any data that app2 copied in there. Maybe there's some format difference to what app1 is using, and your app2 can't read it?

polypress

  • Jr. Member
  • **
  • Posts: 91
Re: Clipboard - is it Global or Local
« Reply #4 on: September 23, 2013, 05:27:02 pm »
app2 can read app1 data when app2 has no clipboard data of its own.
app1 can read app2 data when app1 has no clipboard data of its own.
If app1 has its own clipboard data, then it can only read that, despite app2 having more recently copied data to (its) clipboard.
If app2 has its own clipboard data, then it can only read that, despite app1 having more recently copied data to (its) clipboard.
In all cases the data is plain text.

Regards

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: Clipboard - is it Global or Local
« Reply #5 on: September 23, 2013, 05:35:01 pm »
Try to use the same sequence app1/app2 for the first and second test. It seems that your apps act something differently, since as taazz said there is no such thing as a local (app private) clipboard.
« Last Edit: September 23, 2013, 05:40:02 pm by typo »

polypress

  • Jr. Member
  • **
  • Posts: 91
Re: Clipboard - is it Global or Local
« Reply #6 on: September 23, 2013, 05:51:55 pm »
As soon as an app has data copied to the clipboard, it is blind to clipboard data from another app, including internet explorer etc.
Does it have anything to do with NextInChain, or is that just a Windows property and nothing to do with android?

Regards

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: Clipboard - is it Global or Local
« Reply #7 on: September 23, 2013, 06:08:22 pm »
As soon as an app has data copied to the clipboard, it is blind to clipboard data from another app, including internet explorer etc.

As soon as an app has data copied to the clipboard, any app is blind to any previous data on the clipboard. If some app has that, it has saved it by itself.
« Last Edit: September 23, 2013, 06:19:47 pm by typo »

polypress

  • Jr. Member
  • **
  • Posts: 91
Re: Clipboard - is it Global or Local
« Reply #8 on: September 23, 2013, 06:50:56 pm »
OK Thanks for all your help.

I'll try 2 simple copy and paste apps and see how they communicate together. From that I hope to trace where my error is.

Regards to All

polypress

  • Jr. Member
  • **
  • Posts: 91
Re: Clipboard - is it Global or Local
« Reply #9 on: September 24, 2013, 09:11:58 am »
I have repeated exactly the same effect with 2 small apps:-

app1 Clipboard.AsText:='from app1';
app1 Edit1.Text:=Clipboard.AsText;
displays 'from app1' as expected

app2 Clipboard.AsText:='from app2';
app2 Edit1.Text:=Clipboard.AsText;
displays 'from app2' as expected

app1 Edit1.Text:=Clipboard.AsText;
displays 'from app1' (not 'from app2' which was the most recently added to clipboard)

This can be repeated numerous times and in reverse.
It is the same if you use Edit1.PasteFromClipboard;

Is this a bug?

Regards

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: Clipboard - is it Global or Local
« Reply #10 on: September 24, 2013, 09:44:27 am »
Make a small project demonstrating the error and post it on the bugtracker. They will check it more accurately.

 

TinyPortal © 2005-2018