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
 disable polyline autoselect
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

ptavant

3 Posts

Posted - Feb 14 2017 :  04:30:00  Show Profile  Reply
Hi,

I have a TImageEnVect in a form. If I draw a polyline with the mouse, it is automatically selected by the component at the end of the press of the mouse.

Is there a way to avoid self-selection for each polyline added?

Thank you
Michele


w2m

USA
1990 Posts

Posted - Feb 14 2017 :  10:23:11  Show Profile  Reply
This is the best way I could find to not select a polyline when it is created. This allows the user to select a polyline after it is created, and not select it when it is first created.

The WmAfterSelectObject procedure is required so that the added object is selected as it is not yet selected in the OnNewObject event.

const
  WM_AFTER_SELECTOBJECT = WM_USER + 400;

private
procedure WmAfterSelectObject(var Msg: TMessage); message WM_AFTER_SELECTOBJECT;

procedure TForm1.ImageEnVect1NewObject(Sender: TObject; hobj: Integer);
begin
  { Post the custom message WM_AFTER_SELECTOBJECT to our form }
  PostMessage(Self.Handle, WM_AFTER_SELECTOBJECT, 0, 0);
end;

procedure TForm1.WmAfterSelectObject(var Msg: TMessage);
var
  i: Integer;
  iHObj: Integer;
begin
  iHObj := -1;
  with ImageEnVect1 do
  begin
    for i := -1 to SelObjectsCount - 1 do
    begin
      if i >= 0 then
        iHObj := SelObjects[i];
      if iHObj <> -1 then
        if ObjKind[iHObj] = iekPOLYLINE then
          UnSelObject(iHObj);
    end;
  end;
end;

Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
Go to Top of Page

ptavant

3 Posts

Posted - Feb 15 2017 :  04:28:22  Show Profile  Reply
Hi Bill,

Your solution is right for me

Thank you
Michele
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: