Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2004.11.28;
Скачать: CL | DM;

Вниз

Буфер обмена-как до него добраться?   Найти похожие ветки 

 
Rifo ©   (2004-11-16 14:32) [0]

Подскажите, как из поля Memo поместить текст в обычный Win-досовский буфер обмена, и наоорот.


 
WondeRu ©   (2004-11-16 14:36) [1]

memo1.lines.copytoclipboard


 
Rifo ©   (2004-11-16 14:39) [2]

СПАСИБА !!!


 
WondeRu ©   (2004-11-16 14:41) [3]

WondeRu ©   (16.11.04 14:36) [1]
memo1.lines.copytoclipboard

чет не то накатал!


 
Jeer ©   (2004-11-16 14:45) [4]

Clipboard.AsText := Memo1.Text;
и наоборот.


 
WondeRu ©   (2004-11-16 14:47) [5]

uses clipbrd;
{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
 cl : Tclipboard;
begin
 cl := Tclipboard.Create;
 cl.Open;
 cl.SetTextBuf(PChar(memo1.lines.text));
 cl.Close;
 cl.Free;
end;


 
Amoeba ©   (2004-11-16 15:05) [6]


> WondeRu ©   (16.11.04 14:47) [5]
> uses clipbrd;
> {$R *.dfm}
>
> procedure TForm1.Button1Click(Sender: TObject);
> var
>  cl : Tclipboard;
> begin
>  cl := Tclipboard.Create;
>  cl.Open;
>  cl.SetTextBuf(PChar(memo1.lines.text));
>  cl.Close;
>  cl.Free;
> end;

А вот создавать объект класса TClipboard - это уже лишнее.
Читаем Help

Unit

clipbrd

Category

clipboard routines

function Clipboard: TClipboard;

Description

Delphi maintains a single instance of TClipboard for use whenever the application needs to directly access the clipboard object. If the application has never used the Windows clipboard, calling Clipboard creates a new instance of TClipboard. If the clipboard has already been used, Clipboard returns the previously created TClipboard object.

To use Clipboard and the TClipboard object, add Clipbrd to the uses clause .


 
Amoeba ©   (2004-11-16 15:11) [7]

А вот пример к вышесказаному:

The following code copies the bitmap of a speed button named SpeedButton1 to the Clipboard:

Clipboard.Assign(SpeedButton1.Glyph);

И не надо изобретать велосипед.


 
Jeer ©   (2004-11-16 15:46) [8]

WondeRu ©   (16.11.04 14:47) [5]
uses clipbrd;
{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
cl : Tclipboard;
begin
cl := Tclipboard.Create;
cl.Open;
cl.SetTextBuf(PChar(memo1.lines.text));
cl.Close;
cl.Free;
end;

Непонятно для сего эти упражнения:)

property AsText: string;

Description

Use the AsText property to place text in and retrieve text from the clipboard. The clipboard must contain a string or an exception occurs. To determine if the clipboard contains a string, pass CF_TEXT to the HasFormat method.


 
WondeRu ©   (2004-11-16 15:59) [9]

Amoeba ©   (16.11.04 15:11) [7]
да я вообще  в первый раз с буфером обмена работаю! Вот сам решил попробовать... получилось, хоть и через ж... Спасибо что в Хелп носом тыкнули ;) буду знать!


 
Rifo ©   (2004-11-16 17:28) [10]

Вы тут спорите, а всех проще и понятнее предложил Jeer (выше по тексту), и действительно работает!!!:

uses clipbrd;

Clipboard.AsText:=form1.Memo1.Text;
и наоборот
form1.Memo1.text:=Clipboard.AsText;



Страницы: 1 вся ветка

Текущий архив: 2004.11.28;
Скачать: CL | DM;

Наверх




Память: 0.49 MB
Время: 0.032 c
1-1100542950
тт
2004-11-15 21:22
2004.11.28
record?


14-1099995947
TohaNik
2004-11-09 13:25
2004.11.28
Картинка любопытная;) http://delphiplus.org/


3-1098891213
AlexGof
2004-10-27 19:33
2004.11.28
Как сохранить файл (например word или exel) в БД ?


1-1100454101
novice_man
2004-11-14 20:41
2004.11.28
Присваивание или копирование?


4-1097954652
Вадим_
2004-10-16 23:24
2004.11.28
Подсчет импульсов, приходящих на cом-порт с датчика