I Indy Active Member Licensed User Longtime User Jan 21, 2016 #1 Hi Folks, I need to set the height of a scrollview so the layout that I have loaded into is scrolls. This is what I have done to load the layout; Code: Copy Scrollview1.Panel.LoadLayout("formlayout") This works absolutely fine and the form is now within the scrollview. However, I need it to scroll so the remain parts can be accessed. There are 3 buttons that I cannot see. As a test I did the following; Code: Copy Scrollview1.Panel.Height=1000dip But that did nothing. Is there something I'm missing? Thanks
Hi Folks, I need to set the height of a scrollview so the layout that I have loaded into is scrolls. This is what I have done to load the layout; Code: Copy Scrollview1.Panel.LoadLayout("formlayout") This works absolutely fine and the form is now within the scrollview. However, I need it to scroll so the remain parts can be accessed. There are 3 buttons that I cannot see. As a test I did the following; Code: Copy Scrollview1.Panel.Height=1000dip But that did nothing. Is there something I'm missing? Thanks
klaus Expert Licensed User Longtime User Jan 21, 2016 #2 You need to give more information on what you have in the layout file. Upvote 0
I Indy Active Member Licensed User Longtime User Jan 22, 2016 #3 klaus said: You need to give more information on what you have in the layout file. Click to expand... I found what the issue was. I had declared and initialized the same ScrollView twice. Once in the Designer and again in code, which caused a conflict, that meant the command to resize was getting negated (or at least that's what appeared to be happening). Anyway, once I fixed this the resizing worked. However, having got passed this, I now have another question. Since I am loading a layout file into the Scrollview, is there anyway of determining using code what the height of the layout is so I can pass that to the Scrollview.Panel.Height method? At the moment I am getting the Bottom (Top+Height) value of the last Button view on the layout and passing that back. Quite happy to use this method as it works but, I always prefer to use system functions as they are far more reliable and take other factors into account, which I may not be aware of. Thanks Upvote 0
klaus said: You need to give more information on what you have in the layout file. Click to expand... I found what the issue was. I had declared and initialized the same ScrollView twice. Once in the Designer and again in code, which caused a conflict, that meant the command to resize was getting negated (or at least that's what appeared to be happening). Anyway, once I fixed this the resizing worked. However, having got passed this, I now have another question. Since I am loading a layout file into the Scrollview, is there anyway of determining using code what the height of the layout is so I can pass that to the Scrollview.Panel.Height method? At the moment I am getting the Bottom (Top+Height) value of the last Button view on the layout and passing that back. Quite happy to use this method as it works but, I always prefer to use system functions as they are far more reliable and take other factors into account, which I may not be aware of. Thanks
klaus Expert Licensed User Longtime User Jan 22, 2016 #4 There is no 'system function' to get directly the needed height. One solution is to put all your views onto a Panel and use use the height of this Panel for Scrollview.Panel.Height. If the views in your layout are not on a Panel the method you used is the right and only one. Upvote 0
There is no 'system function' to get directly the needed height. One solution is to put all your views onto a Panel and use use the height of this Panel for Scrollview.Panel.Height. If the views in your layout are not on a Panel the method you used is the right and only one.
I Indy Active Member Licensed User Longtime User Jan 22, 2016 #5 klaus said: One solution is to put all your views onto a Panel and use use the height of this Panel for Scrollview.Panel.Height. Click to expand... Excellent idea - Thank you! Would I be correct in thinking a Panel height can be extended beyond the physical device screen? A bit like having video buffer which sits outside of the video RAM range but, when scrolled becomes visible? Upvote 0
klaus said: One solution is to put all your views onto a Panel and use use the height of this Panel for Scrollview.Panel.Height. Click to expand... Excellent idea - Thank you! Would I be correct in thinking a Panel height can be extended beyond the physical device screen? A bit like having video buffer which sits outside of the video RAM range but, when scrolled becomes visible?
klaus Expert Licensed User Longtime User Jan 22, 2016 #6 Would I be correct in thinking a Panel height can be extended beyond the physical device screen? Click to expand... Yes ! Upvote 0
Would I be correct in thinking a Panel height can be extended beyond the physical device screen? Click to expand... Yes !
I Indy Active Member Licensed User Longtime User Jan 22, 2016 #7 klaus said: Yes ! Click to expand... Perfect. I will try this out. Thanks for your help and advice Klaus. Upvote 0
klaus said: Yes ! Click to expand... Perfect. I will try this out. Thanks for your help and advice Klaus.
I Indy Active Member Licensed User Longtime User Jan 23, 2016 #8 Hi Klaus I took your advice and added all the controls into a panel using the Designer and then used the following to load it into a Scrollview. Code: Copy ScrollView0.Panel.AddView(Panel0,0,0,100%x,100%y) However, this results in an error which is basic saying the view (panel) must be initialised. But surely if the panel I'm referrencing was created in the designer, there's no need to initilise it, right? Any thoughts? Upvote 0
Hi Klaus I took your advice and added all the controls into a panel using the Designer and then used the following to load it into a Scrollview. Code: Copy ScrollView0.Panel.AddView(Panel0,0,0,100%x,100%y) However, this results in an error which is basic saying the view (panel) must be initialised. But surely if the panel I'm referrencing was created in the designer, there's no need to initilise it, right? Any thoughts?
klaus Expert Licensed User Longtime User Jan 23, 2016 #9 If you have defined the panel in the designer and set all the views in it as childs you must use: Scrollview1.Panel.LoadLayout("formlayout") And set: Scrollview1.Panel.Height = Panel10.Height You may have a look at this example: ScrollView example with a Panel higher than the screen Upvote 0
If you have defined the panel in the designer and set all the views in it as childs you must use: Scrollview1.Panel.LoadLayout("formlayout") And set: Scrollview1.Panel.Height = Panel10.Height You may have a look at this example: ScrollView example with a Panel higher than the screen
I Indy Active Member Licensed User Longtime User Jan 23, 2016 #10 I'm beginning to loose my mind over this. Here's my code that I'm using; Code: Copy p.Initialize("Page0") p.Color = Colors.DarkGray PC.AddPage(p, "Incident") ScrollView0.Initialize(200) ScrollView0.Panel.LoadLayout("formlayout") p.AddView(ScrollView0, 0, 0, 100%x, 100%y) So instead of seeing the entire screen filled, I get only a fraction. See screenshot attached. I've also attached a screenshot of the Designer setup. Surely it can't be as difficult as I'm making it. All I want to do is, in the parent panel (p) I want insert a scrollview that has all the form views that should be scrollable because the device screen will be variable when used the customers. Upvote 0
I'm beginning to loose my mind over this. Here's my code that I'm using; Code: Copy p.Initialize("Page0") p.Color = Colors.DarkGray PC.AddPage(p, "Incident") ScrollView0.Initialize(200) ScrollView0.Panel.LoadLayout("formlayout") p.AddView(ScrollView0, 0, 0, 100%x, 100%y) So instead of seeing the entire screen filled, I get only a fraction. See screenshot attached. I've also attached a screenshot of the Designer setup. Surely it can't be as difficult as I'm making it. All I want to do is, in the parent panel (p) I want insert a scrollview that has all the form views that should be scrollable because the device screen will be variable when used the customers.
Erel B4X founder Staff member Licensed User Longtime User Jan 24, 2016 #11 Can you upload the project or a smaller project with the layout? Upvote 0
I Indy Active Member Licensed User Longtime User Jan 24, 2016 #12 Hi Erel, I have uploaded a test project which exhibits the same behaviour. I would be grateful if you can take a look. I'm obviously doing something wrong. Thanks Attachments scrollviewproblem.zip scrollviewproblem.zip 12 KB · Views: 410 Upvote 0
Hi Erel, I have uploaded a test project which exhibits the same behaviour. I would be grateful if you can take a look. I'm obviously doing something wrong. Thanks
Erel B4X founder Staff member Licensed User Longtime User Jan 24, 2016 #13 You should first add the ScrollView to the activity and only then load the layout: Code: Copy ScrollView0.Initialize(100%y) Activity.AddView(ScrollView0,0,0,100%x,100%y) ScrollView0.Panel.LoadLayout("formlayout") Otherwise the ScrollView size will not be known. BTW, you don't need any designer script for this layout. You can use anchors instead. Upvote 0
You should first add the ScrollView to the activity and only then load the layout: Code: Copy ScrollView0.Initialize(100%y) Activity.AddView(ScrollView0,0,0,100%x,100%y) ScrollView0.Panel.LoadLayout("formlayout") Otherwise the ScrollView size will not be known. BTW, you don't need any designer script for this layout. You can use anchors instead.
I Indy Active Member Licensed User Longtime User Jan 25, 2016 #14 Hi Erel, I see what I was doing wrong and it does make sense. However, having done what you suggested still didn't quite work but, no worries I abandoned the Scrollview and just stuck with the Panel. I think I need to spend a bit more time understanding Scrollviews and how to use them with other views. Thanks for you help anyway. Upvote 0
Hi Erel, I see what I was doing wrong and it does make sense. However, having done what you suggested still didn't quite work but, no worries I abandoned the Scrollview and just stuck with the Panel. I think I need to spend a bit more time understanding Scrollviews and how to use them with other views. Thanks for you help anyway.