Resize textbox based on amount of text

N1c0_ds

Active Member
Licensed User
Would there be a way to calculate the textbox size based on how much lines of text there is in it? I don't want to have a scollable control in another scrollable control and that seems to be the best solution.
 

johnpc

Member
Licensed User
Thank you Klaus but I am having trouble implementing this. How would one go
about it on App Start just showing one textbox?
 

klaus

Expert
Licensed User
Erel's solution is easier than what I proposed.

But the App_Start routine would look like this.
B4X:
[FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]obj.New1([/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]False[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2])[/SIZE][/FONT]
[SIZE=2][FONT=Courier New]obj.FromControl([/FONT][/SIZE][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000]"TextBox1"[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2])[/SIZE][/FONT]
[SIZE=2][FONT=Courier New][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]obj.SetProperty([/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000]"ScrollBars"[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2],[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000]"None"[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2])[/SIZE][/FONT][/SIZE][/FONT][/SIZE][/FONT][/SIZE][/FONT][/FONT][/SIZE][/SIZE][/FONT]
Best regards.
 

N1c0_ds

Active Member
Licensed User
Thanks for the info. I'll use a textbox without a scrollbar to put a bigger scrollbar (with ControlsEx) to its side. The only thing is that I don't know how to tell the scrollbar the textbox was scrolled (using TouchFlo, for example).

Anyone got an idea?
 

johnpc

Member
Licensed User
Sub App_Start

Form1.Show
obj.New1(False)
obj.FromControl("TextBox1")
obj.SetProperty("ScrollBars","None")

TextBox1.Text="TextBox is used mostly to recieve user input."&CRLF
TextBox1.Text=TextBox1.Text&"TextBox Control can be single line OR multiline."

'Keep the focus off the TextBox set focus to a label that has no text
Label1.Focus = True
Label1.Focus

End Sub
 
Top