Dirtylarry gui - how do you expand scrollarea

I tried many times but everything failed. So I ask the questions in a frustrating way.
I use scrollarea. I hope that the length of the scrollarea is extended when the scrollarea is lowered to the end. What should I do?

Am I understanding you correct, you cant to change the size of the scrollarea in runtime?

I think something like this might work;

    local new_height = 1000
    self.scrollarea.oh = new_height
    gui.set_size(gui.get_node("scrollarea"), vmath.vector3(250, new_height, 0))

(self.scrollarea.oh is the field that holds the original height for the scrollarea node.)

1 Like

The code which you tought me, it dose not solve my problem

I’ll show you the code I used the first time.

if gui.pick_node(n_node, action.x, action.y) then
	pos_y = pos_y + 200
	gui.set_size(scroll, vmath.vector3(720, pos_y, 0))
end

The screen still move to the first scrolling area only.
Second, I want to change the ‘oh’ value of

scroll = {drag=false,started=false,dx=0,dy=0,ox=p.x,oy=p.y,ow=s.x,oh=s.y}

in module ‘dirtylarry’, but I do not know how to change it.

I want the length of the scroll to be longer when the button is pressed and the scroll movement to be extended by the length.

I can not English very well. So I use translators. Even if English is strange, please understand.

I think my first post should solve what you want to do. I’m not sure what the code you pasted above will result in, since it’s unclear where pos_y and scroll comes from. Could you paste a bigger view of your code so I can see the context where the if-statement is included? :slight_smile:

yes.

local pos_y = 3000

function on_input(self, action_id, action)
	if action_id == hash("touch") and action.pressed then
		local n_node = gui.get_node("next_bt")
		local scroll = gui.get_node("talk_scroll")
		if gui.pick_node(n_node, action.x, action.y) then
			pos_y = pos_y + 200
			gui.set_size(scroll, vmath.vector3(720, pos_y, 0))	
	    end
    end
	self.scrolls = dirtylarry:scrollarea("talk_scroll", action_id, action, self.scrolls, function(self, action_id, action) 
	
	end)
end

And if you add the self.scrolls.oh = pos_y inside your if-statement, like this:

local pos_y = 3000

function on_input(self, action_id, action)
	if action_id == hash("touch") and action.pressed then
		local n_node = gui.get_node("next_bt")
		local scroll = gui.get_node("talk_scroll")
		if gui.pick_node(n_node, action.x, action.y) then
			pos_y = pos_y + 200
			self.scrolls.oh = pos_y
			gui.set_size(scroll, vmath.vector3(720, pos_y, 0))	
	    end
    end
	self.scrolls = dirtylarry:scrollarea("talk_scroll", action_id, action, self.scrolls, function(self, action_id, action) 
	
	end)
end

Does that work?

2 Likes

Cool that is what i want!, i couldn’t get your way. i was holding for 2 days because of this problem.
Thanks for your support

2 Likes

@sven I need you help again.

local pos_y = 0

function on_input(self, action_id, action)
	if action_id == hash("touch") and action.pressed then

		local n_node = gui.get_node("next_bt")
		local scroll = gui.get_node("talk_scroll")
		local size_s = gui.get_size(scroll)

		pos_y = size_s.y

		if gui.pick_node(n_node, action.x, action.y) then
			pos_y = pos_y + 200
			self.scrolls.oh = pos_y
			gui.set_size(scroll, vmath.vector3(720, pos_y, 0))
			gui.set_position(scroll, vmath.vector3(0, pos_y - 1210, 0))	
	    end
    end
	self.scrolls = dirtylarry:scrollarea("talk_scroll", action_id, action, self.scrolls, function(self, action_id, action) 
	
	end)
end

I added ‘gui.set_position’ in the code that Sven gave me.
The position of ‘scroll’ moves to the position I want, but when I drag it, it returns to the position where the position value is different.
Is it possible to drag at the current ‘scroll’ position when dragging?