Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Scroll View not wrapping words
Started by hayful59 Apr 29 2019 07:25 PM

3 replies to this topic
scrollview scroll wrap instructions contentheight smaller vertical

Best Answer roaminggamer , 29 April 2019 - 08:26 PM

You need to make a text object and put it in the scrollView.

 

https://docs.coronalabs.com/api/library/display/newText.html

 

That last bit of code in your post is just a variable with text in it.

 

Something like:

-- after code you showed
local options = 
{
    text = lotsOfText,     
    x = 0,
    y = 0,
    width = display.contentWidth/1.3,
    font = native.systemFont,   
    fontSize = 18,
}
 
local myText = display.newText( options )
myText:setFillColor( 1, 0, 0 )
myText.anchorX = 0
myText.anchorY = 0

scrollView:insert( myText )



[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

hayful59

[GLOBAL: userInfoPane.html]
hayful59
  • Enthusiast

  • 39 posts
  • Corona SDK

Hello, Im using scroll view to show the instructions, when I have it set to cover the whole screen using

display.contentWidth and display.contentHeight

the text wraps around to the next line fine. I want to make the scroll view be around 40% smaller than the total screen size but when I make the scroll view smaller the text still thinks its meant to be going to the total width of the screen and does wrap around at the new size.

local scrollView = widget.newScrollView
{
	left = display.contentWidth - 290,
	top = 0,
	width = display.contentWidth/1.3,
	height = display.contentHeight/3,
	topPadding = 380,
	bottomPadding = -350,
	horizontalScrollDisabled = true,
	verticalScrollDisabled = false,
	listener = scrollListener,
}

local lotsOfText = "--------------------------------------------------------\n               -- Help and Shortcuts --\n--------------------------------------------------------\n\n -- Issues --\n\n * If no result is shown, make sure the RUN has been selected FIRST, followed by the business's name.\n\n * If no result is shown, double check your spelling

Thanks for the help

 



[TOPIC: post.html]
#2

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 7,544 posts
  • Corona SDK

  Best Answer

You need to make a text object and put it in the scrollView.

 

https://docs.coronalabs.com/api/library/display/newText.html

 

That last bit of code in your post is just a variable with text in it.

 

Something like:

-- after code you showed
local options = 
{
    text = lotsOfText,     
    x = 0,
    y = 0,
    width = display.contentWidth/1.3,
    font = native.systemFont,   
    fontSize = 18,
}
 
local myText = display.newText( options )
myText:setFillColor( 1, 0, 0 )
myText.anchorX = 0
myText.anchorY = 0

scrollView:insert( myText )





[TOPIC: post.html]
#3

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 7,544 posts
  • Corona SDK

Also, you don't want to make the scrollview taller or wider than the display.  That is wrong.

 

Make it the same height and width as display.



[TOPIC: post.html]
#4

hayful59

[GLOBAL: userInfoPane.html]
hayful59
  • Enthusiast

  • 39 posts
  • Corona SDK

Also, you don't want to make the scrollview taller or wider than the display.  That is wrong.

 

Make it the same height and width as display.

 

Thank you for all the help, it works a treat




[topic_controls]
[/topic_controls]

Also tagged with one or more of these keywords: scrollview, scroll, wrap, instructions, contentheight, smaller, vertical