activex and form accsess error

Delphi'de kod yazma ile ilgili sorularınızı bu foruma yazabilirsiniz.
Kullanıcı avatarı
mrmarman
Üye
Mesajlar: 4741
Kayıt: 09 Ara 2003 08:13
Konum: İstanbul
İletişim:

Re: activex and form accsess error

Mesaj gönderen mrmarman »

The other message that you ask, I recommend a technique about events.

Try this..

Kod: Tümünü seç

procedure TForm1.Edit1Change(Sender: TObject);
begin
  ShowMessage( TEdit(Sender).Text );
end;


procedure Tform1.FormShow(Sender: TObject);
begin
  Application.CreateForm( TForm3, Form3 );
  Form3.Show;
  Form3.Edit1.OnChange := Edit1Change;
end;
this example shows you, if you cannot send value sub forms to the activex mainform, then retrieve sub forms vcl's events from them.

If you write something subform ( in this example Edit1 on Form3 ), then ActiveXForm automatically trigger by it and retrieve that value.

You allready can communicate interforms under active control. And now that values can pass to the main activex form, then if you want you can add an event to the ActiveXForm for the pass this value to the delphi side ...
Resim
Resim ....Resim
Kullanıcı avatarı
mia
Üye
Mesajlar: 239
Kayıt: 17 Nis 2015 02:18

Re: activex and form accsess error

Mesaj gönderen mia »

i can pass value now , but i cannot set read and write property from main form to another form with html param , also why the application opened the other form into another html page ?
بِسْمِ اللهِ الرَّحْمنِ الرَّحِيمِ
in god i trust with every movement i do
graduated student and looking for knowledge
Kullanıcı avatarı
mrmarman
Üye
Mesajlar: 4741
Kayıt: 09 Ara 2003 08:13
Konum: İstanbul
İletişim:

Re: activex and form accsess error

Mesaj gönderen mrmarman »

You do not need any property creation.
Collate your value(s) under a type record you made on form2 as global variable, you may use all forms where you want.

And application opens a new form, because you said createparented(0).
( 0 ) is not your application.
Resim
Resim ....Resim
Kullanıcı avatarı
mia
Üye
Mesajlar: 239
Kayıt: 17 Nis 2015 02:18

Re: activex and form accsess error

Mesaj gönderen mia »

i think we get far away from the point maybe i made mistakes with describe the problem, i will upload the project to see what i mean , project attached
Dosya ekleri
mrmarmantest.rar
(37.84 KiB) 81 kere indirildi
بِسْمِ اللهِ الرَّحْمنِ الرَّحِيمِ
in god i trust with every movement i do
graduated student and looking for knowledge
Kullanıcı avatarı
mrmarman
Üye
Mesajlar: 4741
Kayıt: 09 Ara 2003 08:13
Konum: İstanbul
İletişim:

Re: activex and form accsess error

Mesaj gönderen mrmarman »

You have forgotten to create detailedinfo.

Kod: Tümünü seç

procedure Tmain1.FormShow(Sender: TObject);
begin
  detailedinfo := Tinformation.Create;
  Application.CreateForm( Tmain2, main2);
  main2.Show;
end;
Resim
Resim ....Resim
Kullanıcı avatarı
mia
Üye
Mesajlar: 239
Kayıt: 17 Nis 2015 02:18

Re: activex and form accsess error

Mesaj gönderen mia »

yes sorry for that , but problem is the record cannot be settet if you test the ocx with html page like this , label will be showing empty , and the second form showing in new internet explorer page

Kod: Tümünü seç

<object classid="clsid:A12805C3-7BDC-438D-9599-CCAAFC76813E" codebase="project1.ocx" width="600" height="500">

  <param name="tell" value="+0055" />
  <param name="name" value="mrmarman" />
</object>
بِسْمِ اللهِ الرَّحْمنِ الرَّحِيمِ
in god i trust with every movement i do
graduated student and looking for knowledge
Kullanıcı avatarı
mrmarman
Üye
Mesajlar: 4741
Kayıt: 09 Ara 2003 08:13
Konum: İstanbul
İletişim:

Re: activex and form accsess error

Mesaj gönderen mrmarman »

Are you sure ?
Record setted by string value as "name" I see
Resim
Resim
Resim ....Resim
Kullanıcı avatarı
mia
Üye
Mesajlar: 239
Kayıt: 17 Nis 2015 02:18

Re: activex and form accsess error

Mesaj gönderen mia »

yes thats only refrence i added in form

Kod: Tümünü seç

label1.Caption := 'name '+ detailedinfo.MyRecord.name +' '+ detailedinfo.MyRecord.tell +' ';
where is name and tell ?
بِسْمِ اللهِ الرَّحْمنِ الرَّحِيمِ
in god i trust with every movement i do
graduated student and looking for knowledge
Kullanıcı avatarı
mrmarman
Üye
Mesajlar: 4741
Kayıt: 09 Ara 2003 08:13
Konum: İstanbul
İletişim:

Re: activex and form accsess error

Mesaj gönderen mrmarman »

I didn't see any faulty, but yes it is not reading params from html. Did you change or delete anything from TLB/RIDL.

I googled for you, did you read this link "How do I retrieve properties from an HTML page?"

I'm on duty and there is no much free time for now. Just 15 minutes between on-air news times.
I need to make a new project from stracth to verify what is wrong with your code.
Resim
Resim ....Resim
Kullanıcı avatarı
mia
Üye
Mesajlar: 239
Kayıt: 17 Nis 2015 02:18

Re: activex and form accsess error

Mesaj gönderen mia »

i already know how to create read and write property in type library , this problem wasn't in params or the property here is the project with proof that params can be readed from only the main form but it can not set to other unit here is the project and here is image of proof but why it cannot be pass to other unit :(
Dosya ekleri
mbmmk1.jpg
mbmmk1.jpg (14.43 KiB) 3785 kere görüntülendi
mrmarmantest.rar
(38.44 KiB) 43 kere indirildi
بِسْمِ اللهِ الرَّحْمنِ الرَّحِيمِ
in god i trust with every movement i do
graduated student and looking for knowledge
Kullanıcı avatarı
mrmarman
Üye
Mesajlar: 4741
Kayıt: 09 Ara 2003 08:13
Konum: İstanbul
İletişim:

Re: activex and form accsess error

Mesaj gönderen mrmarman »

Hi I got a good sleep after duty. Now looked code.
I said no faulty before but I find something wrong in code now.
Please update and try like below...

html code

Kod: Tümünü seç

<object classid="clsid:A12805C3-7BDC-438D-9599-CCAAFC76813E" width="600" height="500">
  <param name="tell" value="+0055" />
  <param name="name" value="mrmarman" />
</object>

Kod: Tümünü seç

procedure Tmain1.FormCreate(Sender: TObject);
begin
  detailedinfo := Tinformation.Create;
end;

procedure Tmain1.FormShow(Sender: TObject);
begin
  Application.CreateForm( Tmain2, main2);
  main2.Show;
  with detailedinfo.MyRecord do
      showmessage(name + tell);
end;

function Tmain1.Get_name: WideString;
begin
  Result := detailedinfo.MyRecord.name;
end;

function Tmain1.Get_tell: WideString;
begin
  Result := detailedinfo.MyRecord.tell;
end;

procedure Tmain1.Set_name(const Value: WideString);
begin
  detailedinfo.MyRecord.name := Value;
end;

procedure Tmain1.Set_tell(const Value: WideString);
begin
  detailedinfo.MyRecord.tell := Value;
end;
Resim
Resim
Resim ....Resim
Kullanıcı avatarı
mia
Üye
Mesajlar: 239
Kayıt: 17 Nis 2015 02:18

Re: activex and form accsess error

Mesaj gönderen mia »

yess its fixed , now still one problem why its opened in new internet explorer windows and showing in top of address bar , can i show it instead of the main form ?
بِسْمِ اللهِ الرَّحْمنِ الرَّحِيمِ
in god i trust with every movement i do
graduated student and looking for knowledge
Kullanıcı avatarı
mrmarman
Üye
Mesajlar: 4741
Kayıt: 09 Ara 2003 08:13
Konum: İstanbul
İletişim:

Re: activex and form accsess error

Mesaj gönderen mrmarman »

(1) Remove form2
(2) Add a label to the ActiveXForm
(3) update and fix activex form code like below..

Kod: Tümünü seç

procedure Tmain1.FormShow(Sender: TObject);
begin
//  Application.CreateForm( Tmain2, main2 );
//  main2.Visible := false;
//  main2.Show;
  with detailedinfo.MyRecord do
      showmessage(name + tell);
  With detailedinfo.MyRecord do
    Label1.Caption := name + tell;
end;
Resim
Resim ....Resim
Kullanıcı avatarı
mia
Üye
Mesajlar: 239
Kayıt: 17 Nis 2015 02:18

Re: activex and form accsess error

Mesaj gönderen mia »

thats will get us back to the main problem that i will not be able to use some functions from main ActiveX form , i cannot hide the first main form and show second form instead ?
بِسْمِ اللهِ الرَّحْمنِ الرَّحِيمِ
in god i trust with every movement i do
graduated student and looking for knowledge
Kullanıcı avatarı
mrmarman
Üye
Mesajlar: 4741
Kayıt: 09 Ara 2003 08:13
Konum: İstanbul
İletişim:

Re: activex and form accsess error

Mesaj gönderen mrmarman »

Then use second form invisible state...

Kod: Tümünü seç

procedure Tmain1.FormShow(Sender: TObject);
begin
  Application.CreateForm( Tmain2, main2 );
  main2.Hide;
  with detailedinfo.MyRecord do
      showmessage(name + tell);
  With detailedinfo.MyRecord do
    Label1.Caption := name + tell;
end;
you may use Form2's events to pass data to main activex form
Resim
Resim ....Resim
Cevapla