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
 TImageEnVect SelectOptions
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

randal46

8 Posts

Posted - Oct 05 2011 :  05:12:07  Show Profile  Reply
Hi,

Though I have the following line:
SelectionOptions := [iesoMoveable];

when I select objects they are resizable. How can I prevent objects from being resized?
Also how do I prevent it from changing the cursor?

Thanks

w2m

USA
1990 Posts

Posted - Oct 05 2011 :  06:28:39  Show Profile  Reply
Selection Options is a property to control rubberband selections.
To prevent object resizing there are two ways:

1. ImageEnVect1.ObjStyle
2. ImageEnVect1ObjectMoveResize event

You can accomplish this by setting object styles as shown below:

procedure TMainForm.RadioGroup1Click( Sender: TObject );
var
  i: Integer;
  hobj: Integer;
begin
  // the radiogroup items are: 0 'Resize and Move' 1 'Move'
  // setting the ObjStyle automatically sets the appropriate cursors
  for i := 0 to ImageEnVect1.SelObjectsCount - 1 do
  begin
    hobj := ImageEnVect1.SelObjects[ i ];
    if ( RadioGroup1.ItemIndex = 1 ) then
    begin
      // Only allow moving objects
      ImageEnVect1.ObjStyle[ hobj ] := ImageEnVect1.ObjStyle[ hobj ] - [ ievsSizeable ];
    end
    else
    begin
      // Allow object resizing and moving
      ImageEnVect1.ObjStyle[ hobj ] := ImageEnVect1.ObjStyle[ hobj ] + [ ievsSizeable ];
    end;
  end;
end;


You can accomplish this by preventing resizing the object in the ObjectMoveResize
event as shown below:

procedure TMainForm.ImageEnVect1ObjectMoveResize( Sender: TObject; hobj, Grip: Integer; var OffsetX, OffsetY: Integer );
begin
  ASelectionChanging := true;
  // Only allow moving objects
  if Grip <> 3 then // Grip 3 is the selection grip... all other grips are resizing grips
  begin
    OffsetX := 0;
    OffsetY := 0;
  end;
end;


William Miller
Go to Top of Page

randal46

8 Posts

Posted - Oct 05 2011 :  07:19:31  Show Profile  Reply
Thanks, it did it.
Now to the second question, how to prevent change of cursor on selection. It show 4 different cursors on selection, one diagonal, another horizontal, a 3rd one vertical and also a cross with pointers. I only want the default cursor.
Go to Top of Page

w2m

USA
1990 Posts

Posted - Oct 05 2011 :  07:36:34  Show Profile  Reply
Here setting the ObjStyle automatically sets the appropriate cursors so when ievsSizeable is removed from the objectstyle I only see the move cursor. When I add ievsSizeable I get the move cursor and resizing cursors.

I do not know of a way to change object cursors.

What do you mean 'default' cursor?


William Miller
Go to Top of Page

randal46

8 Posts

Posted - Oct 05 2011 :  09:44:25  Show Profile  Reply
That's right, it changes to move cursor.
By default cursor I meant cursor 1785.
Go to Top of Page

w2m

USA
1990 Posts

Posted - Oct 05 2011 :  10:11:06  Show Profile  Reply
Contact support@imageen.com. I do not think it is possible to change the cursor to 1785. If you did manage to change the move cursor to 1785 you would have no user feedback that the object could be moved.

William Miller
Go to Top of Page

fab

1310 Posts

Posted - Oct 05 2011 :  13:45:01  Show Profile  Reply
Perhaps you may want the event OnSetCursor. For example:
procedure TForm1.ImageEnVect1SetCursor(Sender: TObject; var Cursor: TCursor);
begin
  Cursor := 1785;
end;
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: