ScrollView

roarnold

Active Member
Licensed User
Longtime User
It appears that I may be running around and not getting it quite right yet. The enclosed zip file needs to be able to scroll horizontally. If someone could take a look and resolve it or point me in the right direction I would be most grateful.

Thanks,
Ron
 

Attachments

This one runs as designed but doesn't horizontal scroll. Not sure if I am missing something or not.

You will notice that I have the HSV set in Designer thus I can see all my labels and buttons but no scroll.

I tried to set and initialize in Activity and that did not go well. Left me with nothing but a black emulator.

There are a couple of lines in there that will place four buttons along the top and those I was just trying to work out how to scale.

Appreciate any help I can get. This is the last hurtle, I hope.

Thanks,
Ron:BangHead:
 

Attachments

Upvote 0
I had a look at your code and have following questions and comments:
1) On my Nexus One the horizontal scrolling works !
2) Do you test it on an Emulator or a device ?
2.1) What is the screen size where you test the program ?
3) I'm not sure that Buttons are the best way to show and select the information.
What do you want to show ?
What about when Yes was clicked you show a green check character but the two other buttons remain as they are.
4) I don't understand the logic behind the button numbering beginning with 108 (for the three buttons on each line) ?
5) You are using two buttons btn92 and btn93 with the same event name as the other button. I would seperate the event routines for these.
And also rename them to btnBack and btnNext so you know what they are doing.
6) Do you also need vertical scrolling ?
In that case you could use ScrollView2D.
7) There are some errors in your code:
7.1) In the btn_Click routine you are adding a new button overlaying the button that was clicked, you shouldn't.
7.2) These new buttons don't have a Tag value so the second time you click on a same button you get an error.
7.3) Still in the btn_Click routine this line Case "btn109" will not work but this one will Case "109".
8) Your code could be simplifyed a lot.
8.1) I would put the text for the labesl in an Array and use a loop to initiate the lines.
8.2) The btn_Click routine could be reduced to this instead of your 250 lines with the advantage that clicking a second time onto the same button you get the original text back:
Code: Copy
Sub btn_Click
    Dim btn As Button
    Dim tg As Int

    btn = Sender
    tg = btn.Tag

    If btn.Text = "√" Then
        btn.TextColor = Colors.Black
        If (tg - 108) Mod 3 = 0 Then
            btn.Text = "Yes"
        Else If (tg - 108) Mod 3 = 1 Then
            btn.Text = "No"
        Else
            btn.Text = "N/A"
        End If
    Else
        btn.TextColor = Colors.Green
        btn.Text = "√"
    End If
End Sub
Attached your program with some changes.

Best regards.
 

Attachments

Last edited:
Upvote 0
Klaus.

Thanks for the reply. You are right on simplifying the code which at 3am this morning it hit me. So the HSV is working after all course I did not check it on a tablet or phone just the emulator and it would not respond. I for got the reasoning behind the button route which I think it was a first shot at getting it running but have since been removed for text route you mention. Screen size was 320 X 430 for Samsung GII.

Presently, the requirement is for horizontal only given the app, however, rev 2 will account for both horizontal and vertical with autoscaling.

So, if I add more label and edits to the screen it should scroll for me. Cool.

Thank you for the array code to manage labels.

Appreciate the help,
Ron
 
Upvote 0
Back
Top