P Pietro Pancino Member Licensed User Longtime User Dec 7, 2020 #1 Hi all, I have an application with several labels on the screen. I need to move and change width of those label dynamical without accessing directly to the label Object. (label1.left =...) So I feed a list with label name : Code: Copy the_event_list.AddAll (Array As Label (Label1,Label2,Label3,Label4)) After that I wanted to change dynamicaly the label position accessing to him throught the list like this: B4X: Copy Sub move_the_label (label_num As Int) Dim the_label As Label = the_event_list.Get(label_num) Dim the_left As Int = the_label.Left + 2 the_label.Left = the_left End Sub and ... it doesn't work :-(, It seems the label object is not transfered from the list. It give a textview type, but not a label when I log the list content... I thought that we could get the full object attribute from an object in a list, but i certainly miss some thing. I have joined the a sample project that don't work... of course If any one have an idea. Pietro Attachments label_object_in_a_list.zip label_object_in_a_list.zip 9.7 KB · Views: 392
Hi all, I have an application with several labels on the screen. I need to move and change width of those label dynamical without accessing directly to the label Object. (label1.left =...) So I feed a list with label name : Code: Copy the_event_list.AddAll (Array As Label (Label1,Label2,Label3,Label4)) After that I wanted to change dynamicaly the label position accessing to him throught the list like this: B4X: Copy Sub move_the_label (label_num As Int) Dim the_label As Label = the_event_list.Get(label_num) Dim the_left As Int = the_label.Left + 2 the_label.Left = the_left End Sub and ... it doesn't work :-(, It seems the label object is not transfered from the list. It give a textview type, but not a label when I log the list content... I thought that we could get the full object attribute from an object in a list, but i certainly miss some thing. I have joined the a sample project that don't work... of course If any one have an idea. Pietro
LucaMs Expert Licensed User Longtime User Dec 7, 2020 #2 Change this line: B4X: Copy the_event_list.AddAll (Array As Label (Label1,Label2,Label3,Label4)) to B4X: Copy the_event_list.AddAll (Array (Label1,Label2,Label3,Label4)) ' it is the same of Array As Object Upvote 0
Change this line: B4X: Copy the_event_list.AddAll (Array As Label (Label1,Label2,Label3,Label4)) to B4X: Copy the_event_list.AddAll (Array (Label1,Label2,Label3,Label4)) ' it is the same of Array As Object
P Pietro Pancino Member Licensed User Longtime User Dec 7, 2020 #3 Great, great and tripple Great, I suspected that it was easy, but not like that!!! Many thanks )) Pietro Upvote 0
Great, great and tripple Great, I suspected that it was easy, but not like that!!! Many thanks )) Pietro