Forum > RichMemo
TEdit - copy to clipboard
(1/1)
Nicole:
edit1.CopyToClipboard
works and copies "edit1"
what I want is to copy is the text of the edit =
"edit1.Caption"
but
edit1.caption.CopyToClipboard
does not work.
What is the shortest way to copy the text of an edit to the Clipboard
dseligo:
I use (I don't know what Edit1.Caption is):
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---Clipboard.AsText := Edit1.Text;
Ally:
Or like this:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} --- Edit1.SelectAll; Edit1.CopyToClipboard;
rvk:
What is TEdit.Caption?
Why is there a Catpion for the TEdit and why are you using that.
For the content of a TEdit you should use TEdit.Text (not Caption).
TEdit doesn't have a caption (which I assume could be confused with a connected label).
TEdit.CopyToClipBoard is implemented like this:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} --- if (ACustomEdit.EchoMode = emNormal) and (ACustomEdit.SelLength > 0) then Clipboard.AsText := ACustomEdit.SelText;
So it actually only copies selected text. I'm not sure why.
So either do Edit1.SelectAll directly in front of Edit1.CopyToClipBoard or folow the suggestion of dseligo.
(Ah, Ally beat me to it :) )
Navigation
[0] Message Index