scrolling panel height problem

ansoUzr

Member
Licensed User
Longtime User
First post; new to the software. I've been trying out examples I've found on this site. It's being going well up to now.

For the code below (pasted in), modified from something I found on the site, the scrolling canvas works for '40 rows',.e., all 40 text rows are drawn. When I set rows to 41, no text is drawn; however the loop is executed.

Help would be appreciated.

Thanks.


Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.

End Sub

Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim SV As ScrollView
Dim canvas1 As Canvas

End Sub

Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
Dim rows As Int = 41
SV.Initialize(500dip)
SV.Panel.Height = rows * 50dip
SV.Panel.Width = 500dip
Activity.AddView(SV,0,0,200,500)
canvas1.Initialize(SV.Panel)
For i = 1 To rows
canvas1.DrawText("row: " & i,50dip,i*50dip,Typeface.MONOSPACE,18,Colors.Yellow,"CENTER")
Next
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub
 

stevel05

Expert
Licensed User
Longtime User
I don't see that behavior, 41 (and more) rows are displayed on my device.

You could try adding Activity.Invalidate after the loop to see if that'll force it to draw.
 
Upvote 0

ansoUzr

Member
Licensed User
Longtime User
I tried adding the Activity.Invalidate - didn't work.

I can see a thin vertical scrolling line, but no text. I'm using an ASUS tf101 pad.

Thanks.
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
I have an Asus TF101, which I have just tried it on and it works as expected.

Can you post your project, Export as Zip from the Files Menu, then use the Manage Attachment option in additional options below the edit window.
 
Upvote 0

ansoUzr

Member
Licensed User
Longtime User
Canvas scrolling problem

I've attached the zip file.

Thanks for taking the time.
 

Attachments

  • canvas_scrolling.zip
    6.1 KB · Views: 124
Upvote 0

stevel05

Expert
Licensed User
Longtime User
Hmmm, your project doesn't work and neither did one that I cut and pasted into a new one.

The attached one does for me, I don't know why they are different. Try this one and see if it works for you.
 

Attachments

  • test.zip
    3.9 KB · Views: 140
Upvote 0

Geezer

Active Member
Licensed User
Longtime User
Hmmm, your project doesn't work and neither did one that I cut and pasted into a new one.

The attached one does for me, I don't know why they are different. Try this one and see if it works for you.

This is the same code as the other project. The only difference I see is the target SDK. But, they still both work for me.
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
Yes I know, one works on the TF101, the other doesn't. Both work on my phone.

That seems to have done it here, change the manifest line to:

<uses-sdk android:minSdkVersion="9" /> and it works on the TF101.
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
No, it appears to be something to do with the minimum and target SDK levels as set in the manifest file.

I don't now enough about it at the moment to explain it, but I'll do some research when I get some spare time, unless someone knows a reason this would happen.
 
Last edited:
Upvote 0

ansoUzr

Member
Licensed User
Longtime User
I changed the manifest line as you suggested, however, when I run the debug, the value is changed back to the previous value and the code behaves the same - no text is drawn. Might be a problem in how the SDK was set up?

Also, I looked at the version that was posted that does work on my pad, it was similar. The major difference is the Key/value: android:targetSdkVersion="14" is not in the version that works. I removed that key and ran the debugger. The program didn't work and the key was regenerated.

???

Thanks.
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
Does the version that won't run have Do not overwrite manifest file option checked in the project menu?
 
Upvote 0

ansoUzr

Member
Licensed User
Longtime User
I pasted the manifest file from the working version into my non-working version. Ran the debugger and it ... worked!

I checked the files previously and edited to be the same, but that didn't work.

Don't know why it now works. I'll copy the "working" manifest into another version of the file I was originally working on before I had the problem.

Thanks.
 
Upvote 0

ansoUzr

Member
Licensed User
Longtime User
worked.

Here's the "working" manifest followed by my "non-working" one (generated by my IDE code)

Thanks.

'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: Manifest Editor
AddActivityText(Main,
android:theme="@android:style/Theme.NoDisplay")
AddManifestText(
<uses-sdk android:minSdkVersion="4" />
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
'End of default text.

'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: Manifest Editor
AddManifestText(
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="14"/>
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
'End of default text.
 
Upvote 0
Top