Jump to content

Problem with TUniScrollBox


MarcoC

Recommended Posts

Hi all.

I have an application with a form in which there is a TUniScrollBox (scrListaProdotti) the uses 90% of that form.
When I create the form at runtime I populate the TUniScollbox with a number of TUniPanel's, using this code:

  aPnl := TUniPanel.Create(self);
  aPnl.Parent := scrListaProdotti;
  aPnl.Name := 'pnlLista' + aindex.tostring;
  aPnl.Align := TAlign.alTop;
  aPnl.AlwaysOnTop := FALSE;
  aPnl.Margins.Right := 15;
  aPnl.Height := 208;
  aPnl.Tag := aindex - 1;
  ......

Inside those panels I put a uniframe (TfrmGestOrdineList) per panel, using this code:

  aFrame := TfrmGestOrdineList.Create(self);
  aFrame.Parent := aPnl;
  aFrame.Name := 'frmPnlOrdine' + aindex.tostring;
  aFrame.Align := alClient;
  aFrame.lblTitoloAutore.Tag := aindex - 1;
  aFrame.Tag := aindex - 1;
  ......

This frame has ten labels, one combobox, two edits and a little image, that I initialize, all, immediatly after having created the frame inside the panel.
The problem is: the application takes 2-3 minutes to show my form when I add 400 panels to the scrollbox: 0,3 - 0,4 seconds for the creation of a single panel seems to me a signal that something is not going as expected.

I use Delphi 10.4.2 and, i think, the second last version of Unigui.
May you help me? 
Thanks!

Marco
 

 

 


 

 

Link to comment
Share on other sites

Hi Sherzod.
I thought that creating panels and put inside each one a frame was a good choice, also for the speed of the creation of the whole form. And the scrollbox was the right choice, too, as container of a list of panels.

I need from 2-5 to 400-500 items inside the scollbox because I need a list on that summary form for a selection of products (a cart for an online order), in particular a books list made by users of the website of one of my customers.

I'm aware that is my first big project with Unigui, maybe there is an original sin in my logic (beacuse of my little experience with Unigui)?

Hope to have answered to your question..
Thanks for your help.

Marco

Link to comment
Share on other sites

Ok, I do not know what is a XTemplate: may you please point me to it?

The subject of my post was also: what to do to speed up things if I'd have necessarily to use a TUniScrollList, so someone can send me tips or best practices if I'ìl have to fall back to that component?

Thanks again.
Marco

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...