This page is "browser friendly". Make your browser window as wide as you want it. The text will flow nicely for you. It is easier to read in a narrow window. With most browsers, pressing plus, minus or zero while the control key (ctrl) is held down will change the texts size. (Enlarge, reduce, restore to default, respectively.) (This is more fully explained, and there's another tip, at my Power Browsing page.)
This is a sketch of something I hope to finish one day, but in the meantime, "the heart" of a useful technique is here for you. Most tutorials in this series are more extensive. I would like to thank the authors of http://delphi.about.com/od/vclusing/a/tclipboard.htm for reminding me how you make a Delphi program copy to the system clipboard. The page you are reading was worked up from what's there. It is also unusual in my Lazarus tutorials collection for being relatively short.
I've tested what follows in Lazarus. I know something very similar is available in Delphi; it may well use exactly the same syntax.
I must remember to finish this tutorial for you.
I must remember to finish this tutorial for you.
I must remember to finish this tutorial for you.
I must remember to finish this tutorial for you.
I must remember to finish this tutorial for you.
I must remember to finish this tutorial for you.
I hope you know exactly how I wrote the above. Copying and pasting to and from the "clipboard" is not just about being lazy. It is a very useful help when generating program code. Typos are avoided. You have an extra incentive to use consistent approaches. In the early 80's, I taught a gifted 12 year old, and he did an amazing amount of his work with the BBC Micro's early "copy/paste" tool. At the time, I though he overdid it. Now I'm a convert.
We all (I hope) use copy/paste from the keyboard. What about within your programs?
I have written a Lazarus application which generates values for the key field of a database. When it generates a new value, it also copies that value to the clipboard. I the merely click on the right edit box on the database's record entry window, and do ctrl-V to paste the application-generated value into the database record. "All" I've saved you is a "select that" and a ctrl-C... but, "try it; you'll like it..." applies!
Put Clipbrd in the "Uses" clause.
Once that's there, you can do...
Clipboard.AsText:=('Send these words');
...without further ado.
If you were using an application which had executed that command, if you then did ctrl-V (Or invoked a "paste" by any of the other methods) you would get "Send these words" pasted into the currently active control.
You can of course put other things, including variables, inside the brackets, e.g....
sTmp:='Yada, yada'; Clipboard.AsText:=(sTmp);
Two details: The object can ONLY be called "Clipboard". You do not need to "create" or "free" it.
If you haven't already done so, put Clipbrd in the "Uses" clause.
Once that's there, you can paste from the clipboard (almost) the same way as you copied to it. You don't even need a new function! Just a new syntax. Assuming that your Lazarus (Delphi) form already has a label named "laLabel" on it, to paste what's in the clipboard to the caption of that label, you just use....
laLabel.caption:=Clipboard.AsText;
... Simples!
To recap:
|
If you visit 1&1's site from here, it helps me. They host my website, and I wouldn't put this link up for them if I wasn't happy with their service. They offer things for the beginner and the corporation.
Page tested for compliance with INDUSTRY (not MS-only) standards, using the free, publicly accessible validator at validator.w3.org. Mostly passes. There were two "unknown attributes" in Google+ button code. Sigh.
....... P a g e . . . E n d s .....