Jump to content

refering a previous request when create tUniPanels at runtime?


erich.wanker

Recommended Posts

Hello peoples,

 

i have a little question:

 

 

in TUniMainModule  i hve my querys..

 

procedure TUniMainModule.ZQuery2AfterScroll(DataSet: TDataSet);
begin
UniMainModule.ZQuery3.SQL.Clear;
UniMainModule.ZQuery3.SQL.Append('SELECT * FROM DB_TAETIGKEIT');
UniMainModule.ZQuery3.Active:=true;


main.MainForm.erzeugePanel;


end;
 

 

and in TMainForm i have the panel-create thing...

 

var meinpanel:TUniPanel;


procedure TMainForm.erzeugePanel;
var i:Integer;
begin


while not UniMainModule.ZQuery3.Eof do


begin
i:= UniMainModule.ZQuery3.FieldByName('INR').AsInteger;


meinpanel:=TUniPanel.Create(self);
meinpanel.Parent:=unipanel3;


meinpanel.Caption:='ID: '+inttostr(i);
meinpanel.Align:=alTop;
meinpanel.Height:=12;
meinpanel.Tag:=i;
meinpanel.OnClick:=meinPanelsClick;


UniMainModule.ZQuery3.Next;
end; //eof


end;
 

 

if i start the webapp i get a lot of errors ... please have a look at the attached image

 

how can i solve this?

Thank you

Erich

 

 

post-1295-0-78140200-1367065756_thumb.jpg

Link to comment
Share on other sites

  • Administrators

AfterScroll is called many many times when user scrolls in the dataset and you are creating several panels here at runtime. It is not a good practice at all.

 

Try creating the panels in a button click event instead of AfterScroll and see if same thing happens.

 

If it doesn't help then please send a test case.

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...