Scrollview on a tabhost not scrolling

onikudaki

Member
Licensed User
Longtime User
i'm looking for some guidance here.

I have an application, which uses a tabhost. I have then created a number of layouts that I load into the tabs.

On one of the layouts, I have a scrollview

everything seems to work well, I get all of the controls where I expect them and they correctly show the data correctly and respond to interactions.

The only Issue is with the scrollview. I have an expanding list, which I can expand and contract tree elements, however I cannot seem to get the scroll working. I can see my entries going of the screen at the bottom, but am not sure if I should be doing something special to handle this, or to use the scrolling.

anyone got any thoughts ? I've tried to call the Initialise function, but then it all seems to fall apart. I think this is because I am not creating the control dynamically..

thanks for any ideas.

Oni
 

onikudaki

Member
Licensed User
Longtime User
ok, I've attached the zip file of the project.

at the moment it is a work in progress and far from elegant :/

but, any help would be greatly appreciated

Note - the relevant code is in the screen_selection file

Also, just to note that the main elements of the scrollview contents comes from - the expandable listview by TheDesolateSoul.
 

Attachments

  • kb.zip
    67.5 KB · Views: 282
Last edited:
Upvote 0

klaus

Expert
Licensed User
Longtime User
Well, I can't test the program because no *.KBP files.
In the FindPatterns routine you could add a line to make the directory if it doesn't exist.
B4X:
Directory = File.DirRootExternal & "/knitting patterns"
File.MakeDir(File.DirRootExternal, "/knitting patterns")
Try to add a DoEvents after setting the internal panel height.
B4X:
ScrollView1.Panel.Height = pHeight
DoEvents
Best regards.
 
Upvote 0

onikudaki

Member
Licensed User
Longtime User
Hi Klaus,

thanks for the help so far, please find the zip on this email and copy the contents to the root of your storage.

Then if you run the app, and select the Patterns tab, and expand some of the items, you should see the list drop off the bottom of the tab.

my problem as I said, is I cant then scroll down the list :(

I have tried the doevents, but that made no difference,

here's hoping you can point me in the right direction, as I've been struggling with this all day :(

many thanks

Steve
 

Attachments

  • knitting patterns.zip
    84.7 KB · Views: 231
Last edited:
Upvote 0

klaus

Expert
Licensed User
Longtime User
The problem is the ScrollView1.Height, it's value is too big !
In the Sub SortTabs routine you set
ScrollView1.Height = 100%x
which is much heigher than the avaliable space for the ScrollView !
You work in landscape mode and you set the height equal to the whole screen width ?

Even if you had
ScrollView1.Height = 100%y
it wouldn't work because of the Tab headers.
I changed the line
ScrollView1.Height = 100%x
to
ScrollView1.Height = TabHost1.Height - 120dip
this works on my screen, perhaps you should adapt the 120dip value.
Have a look at the TabHostExtras library where you should get the internal height of the TabHost.

Best regards.
 
Upvote 0

onikudaki

Member
Licensed User
Longtime User
Klaus,

Many thanks for that. I really appreciate the help.

I'll look at the TabHostExtras too :p

as you can tall, i'm fairly new to B4A, being more of a Windows (C++/MFC) programmer myself

Once again, thank you for the help

regards

Steve
 
Upvote 0
Top