Horizontal Scroll View part2!!!

Cableguy

Expert
Licensed User
Longtime User
Hi...its me again!:sign0148::BangHead::sign0013:

So... I added a Horizontal Scroll View in the designer, along with 4 Buttons... all childs of the "activity" as we cannot set the views directly to the Scroll View's panel...

Then I added this code:

B4X:
   Button1.RemoveView
   Button2.RemoveView
   Button3.RemoveView
   Button4.RemoveView
   
   HorizontalScrollView1.Initialize(96.6%x, "HorizontalScrollView")
   
   HorizontalScrollView1.Panel.AddView(Button1, 0,0,20.7%x,20.7%x)
   HorizontalScrollView1.Panel.AddView(Button2, 27.6%x,0,20.7%x,20.7%x)
   HorizontalScrollView1.Panel.AddView(Button3, 51.75%x,0,20.7%x,20.7%x)
   HorizontalScrollView1.Panel.AddView(Button4, 75.9%x,0,20.7%x,20.7%x)



BUT.... The Buttons don't show up!

What's wrong with my code?:sign0163:
 

mc73

Well-Known Member
Licensed User
Longtime User
Since you added the horizontalView using the designer, I think you should try removing the horizontalView1.Initialize.
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
Thanks...

You were correct!
The question now is, is this a BUG or a normal S.O. behavior?
 
Upvote 0

JonPM

Well-Known Member
Licensed User
Longtime User
This is normal. You don't initialize any views in code if you have added them in designer
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
Yes, I know... it slipped me...but the strange thing is that no error was issued...
and if I understand correctly, initializing a view should render it to it's unsetted state...
when we re-initialize objects like the canvas or an array, we nknow we are reseting it... So in the case of a view, initializing it for a second time should either reset it or bring an error message up.
 
Upvote 0
Top