Board index » off-topic » Copy and paste

Copy and paste


2003-07-06 06:12:50 AM
off-topic0
I would like to
Copy a word and paste word.
In Pascal 5.5
How I do?
Thank you.
 
 

Re:Copy and paste

Yes.
How I do?
Thank you
 

Re:Copy and paste

Vasant schrieb:
Quote
Yes.
Yes what? Yes copy some text or yes, something different?
Quote
How I do?
Thank you


 

{smallsort}

Re:Copy and paste

"John Herbster (TeamB)" <herb-sci1_at_sbcglobal.net>schreef in bericht
Quote

Markus wrote:
>>DO you mean to copy a word in the TP 5.5 editor
and paste it afterwards?

"Vasant" < XXXX@XXXXX.COM >wrote
>Yes. How I do?

Vasant, Have you checked TP5.5 help? It should tell you
to select the word then use Ctrl-C for copy and then move
the cursor to where you want it inserted and press Ctrl-V
for paste. Regards, JohnH


You must be confused with the general method to do it in windows.
In the TP editor you must first make a block
ctrl k b to set the begin marker
ctrl k v to set the end marker
ctrl k v moves the block to a new location
ctrl k c copies the block to a new location
ctrl k y deletes the block
Not sure if 5.5 supports this (it does in 7.0)
Alternatively to make a block
Put the cursor on one location, and keep the shift key pressed while
moving it with the arrow keys to another location
or just dragg the mouse to select a block
Not sure if 5.5 supported an internal clipboard but
Shift+Del = Cut
Ctrl+Ins = Copy
Shift+Ins = Paste
Ctrl+Del = Clear
You can also copy and paste to and from the windows clipboard.
In that case the program has to be running in a dos box. Only the
visible text can be copied.
Right-click the top of the frame around the dos box
select edit | mark (don't know if this is the correct translation,
I have a dutch windows version)
drag the mouse to highlight the text area to be selected
press enter to copy the text to the windows clipboard.
Now go to the windows program of your choise and press ctrl V to paste
the text at cursor location.
Pasting from the windows clipboard to the TP editor is with the same
trick
Right-click the top of the frame around the dos box
select edit | paste
hth
 

Re:Copy and paste

I read on help page. I see.
But I can't open edit-menu in Pascal 5.5 .
 

Re:Copy and paste

"Vasant" < XXXX@XXXXX.COM >schreef in bericht
Quote
I read on help page. I see.
But I can't open edit-menu in Pascal 5.5 .

F10 | E
or
F10 and use the arrow keys.
 

Re:Copy and paste

Hi,
I am making an application which allows user to create new
buttons, labels, groupboxes, pagecontrols, panels etc.
I want to allow the user to be able to click the control he
wants to copy and just click on Edit ->Copy on the menu. (I
have this working).
Then I want user to click ont the form (or on a control such as
a panel, or a groupbox, or a tabsheet), and then click
Edit->Paste and that "copied" control gets pasted.
Lets assume that the copied control was a panel, which had a
label and a button on it. When Edit->Paste is clicked, I want
a Panel including a button and a label.
is there a simple easy way to do this?
I tried using Assign, but not sure if that's a correct way.
I know a complicated method would be..
-- when Edit->Copy is clicked, set the pointer, say,
MyCopiedControl to the active control.
-- now when Edit->Paste is clicked, create a new control of the
same class as MyCopiedControl. Then go through each control of
MyCopiedControl->Controls and create it.
This seems like a lengthy method.
Is there a quick easy function that is already available in BCB
that will allow me to do this... something like
DestinationControl->CopyFrom(SourceControl)
please respond if you have some ideas. Thanks a bunch.
cheers,
Veebo
 

Re:Copy and paste

"Veebo" < XXXX@XXXXX.COM >wrote in message
Quote
is there a simple easy way to do this?
Look at the TStream::Read/WriteComponent() methods.
Quote
I tried using Assign, but not sure if that's a correct way.
Most components do not implement Assign() at all.
Quote
Is there a quick easy function that is already available
in BCB that will allow me to do this... something like

DestinationControl->CopyFrom(SourceControl)
Not quite that simple, no.
Gambit
 

Re:Copy and paste

Can you say a bit more about this. I looked into this, but
can't figure out how to use it.
I need to derive a class, say MyStreamClass from TStream
and then instantiate it..
MyStreamClass *pStream = new MyStreamClass(this);
then do this?
TComponent *pNewComp = pStream->ReadComponent( (TComponent *) MyCopiedControl);
pStream->WriteComponent(pNewComp);
how does the newly created component's parent gets ditermined?
how about the location? will it endup being created right
on the top of the source component?
please give me a couple more hints if you can.
thanks,
Vaibhav
Quote
>is there a simple easy way to do this?

Look at the TStream::Read/WriteComponent() methods.

 

Re:Copy and paste

"Veebo" < XXXX@XXXXX.COM >wrote in message
Quote
I need to derive a class, say MyStreamClass from TStream
No. Just use TMemoryStream or any of the other native streams.
Quote
TComponent *pNewComp = pStream->ReadComponent( (TComponent *)
MyCopiedControl);
pStream->WriteComponent(pNewComp);
No. It would be like this instead:
pStream->WriteComponent(MyCopiedControl);
//...
pStream->Position = 0;
TMyComponent *pNewComp = (TMyComponent*) pStream->ReadComponent(NULL);
pNewComp->Parent = whatever;
Quote
how does the newly created component's parent gets ditermined?
You have to set it manually after you instantiate the new component
instance.
Gambit
 

Re:Copy and paste

hi,
I tried the following:
TComponent *pComp;
TMemoryStream *pStream = new TMemoryStream();
pStream->WriteComponent( (TComponent *)MyCopiedControl);
pStream->Position = 0;
TPanel *pPanel = (TPanel*) pStream->ReadComponent(NULL);
pComp = pStream->ReadComponent(NULL);
but each time it crashes with the error:
"Project XYZ raised exception class EClassNotFound with
message 'Class TMyClass' not found."
where TMyClass is the whatever type of class I tried to paste
such as TPanel or TGroupBox etc.
MyCopiedControl is the pointer to the Control that I am trying
to paste. It is of type TControl*
Can you tell whats going on here? Why do I keep getting this
error.
thanks,
Veebo
">No. It would be like this instead:
Quote

pStream->WriteComponent(MyCopiedControl);
//...
pStream->Position = 0;
TMyComponent *pNewComp = (TMyComponent*) pStream->ReadComponent(NULL);
pNewComp->Parent = whatever;


Gambit


 

Re:Copy and paste

the code in previous post should have been the following
// TPanel *pPanel = (TPanel*) pStream->ReadComponent(NULL);
pComp = pStream->ReadComponent(NULL);
I tried a couple of different ways.
they should do the same thing, but I just tried both because
it crashed with the top line, so i commented it and tried the
bottom.. just incase.
 

Re:Copy and paste

"Veebo" < XXXX@XXXXX.COM >wrote in message
Quote
pStream->WriteComponent( (TComponent *)MyCopiedControl);
pStream->Position = 0;

TPanel *pPanel = (TPanel*) pStream->ReadComponent(NULL);
Is your copied component a TPanel to begin with?
Quote
pComp = pStream->ReadComponent(NULL);
You are calling ReadComponent() twice. You should not be doing that.
Quote
but each time it crashes with the error:

"Project XYZ raised exception class EClassNotFound
with message 'Class TMyClass' not found."
You did not call RegisterClass() first.
Gambit
 

Re:Copy and paste

Quote
Is your copied component a TPanel to begin with?
For testing purposes, I was creating a TPanel and copying and
pasting it to test. So, yes, it is TPanel.
Quote

>pComp = pStream->ReadComponent(NULL);

You are calling ReadComponent() twice. You should not be doing that.
Right, I accidently removed comments. I was only using the
one or the other.
Quote

You did not call RegisterClass() first.
I'm sorry I am asking a lots of questions, but aren't
TPanel, TLabel, TGroupBox etc already registered.
if not, how can I register them. I tried a bunch of things,
but it doesn't work. For example, if I want to register
TPanel, how can I do that? Can it be done just befor the
code for paste?
thanks a bunch,
Veebo
 

Re:Copy and paste

"Veebo" < XXXX@XXXXX.COM >wrote in message
Quote
if not, how can I register them. I tried a bunch of things,
but it doesn't work. For example, if I want to register
TPanel, how can I do that?
I already told you how - RegisterClass().
Gambit