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
 Label With Line - How to Edit Text
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

plumothy

United Kingdom
7 Posts

Posted - Apr 22 2014 :  06:13:00  Show Profile  Reply
I am using the Actions_Vect sample project...

The Action "Insert Label with Line" seems to do exactly the same as "Insert Line". I assumed that I would be able to enter some text for a label placed next to the line. I have been advised to use this code in the NewObject event:

procedure TMainForm.ImageEnVect1NewObject(Sender: TObject; hobj: Integer);
begin
 if ImageEnVect1.ObjKind[hobj] = iekLINELABEL then
   ImageEnVect1.ObjText[hobj] := ' ImageEn Rocks! ';
end;


Yes, this works - I now have some text, but it seems to be a rather incomplete solution.
"Insert label with line" implies to me that the user can draw a line and label it (which is exactly what I want). But, the text has to be entered programatically - I would like the user the user to enter it just like they do with a text box. Also, the user doesn't appear to have any way of editing the text at a later time (a regular text box - you can double-click it).

Any suggestions appreciated.

Also, how can I remove the box that is drawn around the text?

Steve Bailey,
ImageEn 5.1.0
Delphi XE4 Professional
Windows 7 Professional

w2m

USA
1990 Posts

Posted - Apr 22 2014 :  10:33:04  Show Profile  Reply
I think that the Text is a TLabel and not a TEdit so you can not edit the text; However you could put a TEdit component somewhere on your form and in the TEdit.OnChange event, change the linelabel text to match the TEdit.Text.

To make the labels border transparent then set ObjLabelBorder to ielNone:
procedure TMainForm.ImageEnVect1NewObject(Sender: TObject; hobj: Integer);
begin
 if ImageEnVect1.ObjKind[hobj] = iekLINELABEL then
 begin
   ImageEnVect1.ObjText[hobj] := ' ImageEn Rocks! ';
   ImageEnVect1.ObjLabelBorder[hobj] := ielNone;
   VtObjectSelect.Checked := True;
   ImageEnVect1.MouseInteractVt := [miObjectSelect];
 end;
end;

If you want a line object a with an associated editable text object it can be dome, but the task is not trivial and is somewhat complex to code. Far too much code than I am willing to post here.

My EBook has a demo called "Spots and Text"o that shows how to combine two objects to act as one... meaning when each object is dragged the other is dragged as well. The demo uses a iekEllipse object for the spot and a iekText object for the text, so in your case, all you have to do is change the iekEllipse object to a iekLine object and you will have what you are looking for.

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

plumothy

United Kingdom
7 Posts

Posted - Apr 22 2014 :  12:54:46  Show Profile  Reply
Thank you. I shall definitely have a look at the book. I actually need a spot with an arrow pointing to it and text at the beginning of the arrow, so your demo sounds almost perfect already.

I presume from your response that ImageEn does not supporting grouping - something that would be a good enhancement in the future (as would being able to edit the text on a LineLabel object).

Thanks for the help - much appreciated!

Steve Bailey,
ImageEn 5.1.0
Delphi XE4 Professional
Windows 7 Professional
Go to Top of Page

xequte

38615 Posts

Posted - Apr 23 2014 :  18:20:39  Show Profile  Reply
Hi

Yes, Grouping is not yet supported. But it is on the to-do list.



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: