android - Why Listbox items change order position and colour background after do scrolling in Firemonkey? -


i developing multi-device application in firemonkey main class has listbox component items. each of these items has same custom style.

my problem when have many items in listbox , have scroll vertical see rest of items. in case, listbox has strange behaviour , when scroll after doing scroll down item's components (a button example) have changed background colour , items have changed order inside listbox.

for example, if had:

item 1

item 2

item 3

after scroll have:

item 2

item 3

item 1

this change random. each time different.

real example (process steps):

  1. load main class listbox.

enter image description here

  1. do vertical scrolling down see rest of items.

  2. do vertical scrolling upward return top of list.

enter image description here

  1. the items have changed position in listbox , button (component of each item) changes background color.

why have behaviour in listbox??

how can solve , listbox not change items order neither background colour of components?

i not know if there property block items inside listbox or similar ...

edit

this code create , initialize listbox items:

procedure trooms_form.formcreate(sender: tobject); var   ... begin     := 0;     while < numitems begin       //create listbox item        item := tlistboxitem.create(nil);        item.parent := mylistbox;        item.stylelookup := 'stylelbox';       //number        itemnumber := item.findstyleresource('btt_number') tbutton;        if assigned(itemnumber) begin            itemnumber.text := jsonnumber;            case jsoncolor of              0 : itemnumber.tintobject.tintcolor := talphacolors.chocolate;               1 : itemnumber.tintobject.tintcolor := talphacolors.gold;                    2 : itemnumber.tintobject.tintcolor := talphacolors.darkgreen;               3 : itemnumber.tintobject.tintcolor := talphacolors.deeppink;              end;          end;       //type        itemtype := item.findstyleresource('txtstyle_type') ttext;        if assigned(itemtype) begin          itemtype.text := jsontypename;        end;       //occupation        itemoccup := item.findstyleresource('txt_occupation') ttext;        if assigned(itemoccup) begin          itemoccup.text := jsonoccup;        end;       //dates        itemday := item.findstyleresource('txt_day') ttext;        if assigned(itemday) itemday.text := displayday;        itemdatestart := item.findstyleresource('txt_start') ttext;        if assigned(itemdatestart) itemdatestart.text := jsontimestart;        itemdateend := item.findstyleresource('txt_end') ttext;        if assigned(itemdateend) itemdateend.text := jsontimeend;       //item background        itembackgr := item.findstyleresource('background_item') trectangle;        if assigned(itembackgr) begin          itembackgr.fill.kind := tbrushkind.solid;          case jsonstatus of            0 : itembackgr.fill.color := talphacolors.white;                     1 : itembackgr.fill.color := talphacolors.lightgreen;                2 : itembackgr.fill.color := talphacolors.palegoldenrod;             3 : itembackgr.fill.color := talphacolors.lightcoral;                4 : itembackgr.fill.color := talphacolors.lightseagreen;             5 : itembackgr.fill.color := talphacolors.lightblue;                 6 : itembackgr.fill.color := talphacolors.lightgrey;               end;        end;         inc(i);     end; 

thanks attention.

edit 2. solution

listbox items change after doing scroll in firemonkey


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -