ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 copying question
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

pierrotsc

USA
497 Posts

Posted - May 21 2013 :  11:29:19  Show Profile  Reply
I am trying to use both copy command:
ObjCopyToClipboard and SelCopyToClip

The thing is i do not know on how to select an object to use the ObjCopyToClipboard.

This is the code i use and regardless of what I am trying to do the message displayed is always selection even after having inserted a new object.

if ImageEnVect.VisibleSelection then
begin
// copy selection to clipboard
if ImageEnVect.IsSelObject(-1) then
begin
ImageEnVect.ObjCopyToClipboard;
showmessage('Object')
end
else
begin
ImageEnVect.Proc.SelCopyToClip;
showmessage('selection')
end;
end
else
ImageEnVect.Proc.CopyToClipboard;

What am I doing wrong?
Thanks.
P

w2m

USA
1990 Posts

Posted - May 21 2013 :  14:36:22  Show Profile  Reply
"The thing is I do not know how to select an object to use ObjCopyToClipboard".

To select an object with the mouse:
procedure TForm1.SelectObject1Click(Sender: TObject);
begin
  ImageEnVect1.DeSelect;
  ImageEnVect1.MouseInteractVt := [miObjectSelect];
end;

Then select an object with the mouse and then call Button1Click:

procedure TForm1.Button1Click(Sender: TObject);
var
  i: integer;
  hobj: integer;
  iObjectSelected: boolean;
  iSelection: boolean;
begin
  iObjectSelected := False;
  iSelection := ImageEnVect1.Selected;
  for i := ImageEnVect1.ObjectsCount - 1 downto 0 do
  begin
    hObj := ImageEnVect1.GetObjFromIndex(i);
    iObjectSelected := ImageEnVect1.IsSelObject(hObj);
    { Note: objects and a selection may exist at the same time }
    if iObjectSelected then
    begin
      ImageEnVect1.ObjCopyToClipboard;
      ShowMessage('An object is selected.')
    end;
  end;
  if (iSelection) and (iObjectSelected) then
    ShowMessage('An object is selected and there is a selection.')
  else if (iSelection) and (not iObjectSelected) then
  begin
    ImageEnVect1.Proc.SelCopyToClip;
    ShowMessage('Image has selection.');
  end
  else if (not iSelection) and (not iObjectSelected) then
  begin
    ImageEnVect1.Proc.SelCopyToClip;
    ShowMessage('Nothing is selected.');
  end;
end;


William Miller
Adirondack Software & Graphics
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html
Go to Top of Page

pierrotsc

USA
497 Posts

Posted - May 22 2013 :  09:08:21  Show Profile  Reply
Thank you very much. Need to work on the cut/paste now...Your code will help a lot.
Appreciate that.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: