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 to access IE control of Parent Form?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

yogiyang

India
681 Posts

Posted - Mar 26 2021 :  08:05:53  Show Profile  Reply
Hello,

I have three forms in my Project.

Form1
Form2
Form3

I have placed ImageEnView in Form1 and Form2.

I am opening Form2 from Form1 using MyForm2.ShowModal.

Here I want to give users facility to users to correct image loaded in Form2's ImageEnView from Form3.

In Form3 I have placed a few Trackbars and user can use these Trackbars to adjust Brightness, Contrast, Saturation, etc.

For this to work I would need to be able to access ImageEnView control placed in Form2.

I am trying to following code:
Form2.ImageEnView2.Proc.SaveUndo(ieuFullLayer);
Form2.ImageEnView2.LayersDeselectAll;
Form2.ImageEnView2.LayersCurrent := 1;
Form2.ImageEnView2.Proc.IntensityRGBall(tbRed.Position, tbBlue.Position, tbGreen.Position);
Form2.ImageEnView2.Update;


But this code is giving error: Access Violation.

What mistake am I making here?

TIA



Yogi Yang

xequte

5965 Posts

Posted - Mar 26 2021 :  22:30:02  Show Profile  Reply
Hi Yogi

I don't see anything wrong there (assuming Form2 is created). Have you put a breakpoint before this code to see which object(s) are not instantiated?

You might need to send me a simple demo to look at.


Nigel
Xequte Software
www.imageen.com
Go to Top of Page

yogiyang

India
681 Posts

Posted - Mar 27 2021 :  09:35:01  Show Profile  Reply
I have done all necessary things as follows:

From Form1 I create and show as Modal Form2 and from Form2 I create Form3 and show as Modal.

I will send you a sample next week

TIA

Yogi Yang
Go to Top of Page

xequte

5965 Posts

Posted - Apr 04 2021 :  01:47:15  Show Profile  Reply
You never create Form2. You create a TForm2 but assign it to the variable frm, so naturally any calls to the unitialized Form2 will fail:


procedure TForm1.btnLoadFoirm2Click(Sender: TObject);
var
  frm: TForm2;
begin
  frm := TForm2.Create(Self);
  try
    frm.ShowModal;
  finally
    FreeAndNil(frm);
  end;
end;


Change this code to:

procedure TForm1.btnLoadFoirm2Click(Sender: TObject);
begin
  Form2 := TForm2.Create(Self);
  try
    Form2.ShowModal;
  finally
    FreeAndNil(Form2);
  end;
end;


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