I have a line of code
which adds an edit text box called "textbox" to a scrollview (scvText) but whatever text is in the edit field is always displayed way down the scrollview near the bottom, not at the top as it should be.
If I change the code to
then the edit text contents are displayed at the top of the scrollview. My question is what am I doing wrong in the first code that would cause this as there are no other views added to the scrollview.
The full code (if it helps) is
I know there is probably a really stupidly simple reason but for some reason I just can't see it and I have searched the forums before posting but didn't find it so I have to ask as I won't understand why it's not doing what I expect (putting text at top of scrollview) if I don't.
Thanks,
Dave
B4X:
scvText.Panel.AddView(textbox,1%x, 0, scvText.Width-1%x, 100%y)
which adds an edit text box called "textbox" to a scrollview (scvText) but whatever text is in the edit field is always displayed way down the scrollview near the bottom, not at the top as it should be.
If I change the code to
B4X:
scvText.Panel.AddView(textbox,1%x, -39%y, scvText.Width-1%x, 100%y)
then the edit text contents are displayed at the top of the scrollview. My question is what am I doing wrong in the first code that would cause this as there are no other views added to the scrollview.
The full code (if it helps) is
B4X:
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 decoded_message As String ' holds message
Dim textbox As EditText
Dim scvText As ScrollView
Dim copy_button As Button
Dim decode_button As Button
Dim paste_button As Button
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("main")
decoded_message = "Top" & CRLF & CRLF & "Hello" & CRLF & CRLF & "Testing"
textbox.Initialize("")
scvText.Panel.AddView(textbox,1%x, 0, scvText.Width-1%x, 100%y)
textbox.TextSize = 18
textbox.text = decoded_message
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub paste_button_Click
textbox.text = decoded_message
End Sub
Sub decode_button_Click
End Sub
Sub copy_button_Click
End Sub
I know there is probably a really stupidly simple reason but for some reason I just can't see it and I have searched the forums before posting but didn't find it so I have to ask as I won't understand why it's not doing what I expect (putting text at top of scrollview) if I don't.
Thanks,
Dave