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
 How do I change TIETextLayer properties in C++?
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

FTKS

5 Posts

Posted - Jun 01 2022 :  05:35:09  Show Profile  Reply
Hello ImageEn Team,

after creating a textlayer in my ImageenView window.

I tried to access the properties of the TIETextLayer behind it based on the delphi examples given from the online documentation.
While the code itself does compile, accessing the properties leads to an access violation error. What am I doing wrong/ what am I missing?

I am using C++ Builder 10.2 Tokyo and ImageEn 8.7.6.

This is the code which I have tried:

ImageEnView1->LayersAdd(ielkText);

//Either
TIETextLayer(ImageEnView1->CurrentLayer).Text = "This is a test text message"; //Leads to the access violation error

//or
TIETextLayer* txtlayer = new TIETextLayer(ImageEnView1->CurrentLayer); //also leads to the access violation error
txtlayer->Text = "This is a test text message";

Thank you in advance

With best Regards

Stefan

xequte

38222 Posts

Posted - Jun 08 2022 :  19:26:50  Show Profile  Reply
Hi Stefan

You should use:

   ((TIETextLayer*)ImageEnView1->CurrentLayer)->Text = "Test";


Or:


void __fastcall TForm1::Button1Click(TObject *Sender)
{
  ImageEnView1->LayersAdd(ielkText);

  TIETextLayer *txtlayer;
  txtlayer = dynamic_cast<TIETextLayer*>(ImageEnView1->CurrentLayer);
  if (txtlayer != NULL)
    txtlayer->Text = "This is a test text message";

  ImageEnView1->Update();
}


https://docwiki.embarcadero.com/RADStudio/Sydney/en/Dynamic_cast_(C%2B%2B_Type_Cast_Operator)
https://docwiki.embarcadero.com/RADStudio/Sydney/en/Static_cast(typecast_Operator)



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