Jump to content

ceate form.


jahlxx

Recommended Posts

Hi.

 

Is this possible?

 

qo.close;
qo.sql.clear;
qo.sql.add('select formname from options_t where idop = 255');
qo.open;
qo.first;

xf := TUniForm(f.qo.fieldbyname('formulario').asstring);

xf.parent := UniPanel1;
xf.align := alclient;
xf.borderstyle := bsnone;
xf.layout := 'fit';
xf.Show();

 

 

xf is defined as:

    xf: TUniForm;

 

application raises an error in line: xf.parent := UniPanel1;

The error is access violation.

Any idea?

Thanks.

 

 

 

Link to comment
Share on other sites

Explain to me, what does the following line do, exactly?

xf := TUniForm(f.qo.fieldbyname('formulario').asstring);

I think that if you think about that line you'll sooner or later realise what you're doing wrong. If you still come up blank after pondering what you're doing there then post back...

Link to comment
Share on other sites

Let's say you have TUniForm1 and Main.

Add this to TUniForm1 


initialization
  RegisterClass(TUniForm1);

 

Then you can create a form with this code

procedure TMainForm.UniButton1Click(Sender: TObject);
var
  FrC : TUniFormClass;
  Fr : TUniForm;
  FClassName : string;
begin
  FClassName := 'TUniForm1';
  FrC := TUniFormClass(FindClass(FClassName));
  Fr:=FrC.Create(UniApplication);
  Fr.ShowModal;
end;

 

 

image.png.836baac57ce860d12b2dfa5d7ef66a5c.png

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...