PGScrollFrame does not scroll

Hello,

I created a PGScrollFrame and attached a Text Node to it. The text and the sliders can be seen, but when I move the sliders, the text does not move. When moving the sliders, events are generated.
This is the code I used:

PT(PGSliderBar) h_slider = new PGSliderBar("Horizontal Slider");
h_slider->setup_scroll_bar(false, 0, 0, 0);
NodePath h_slider_np = window->get_aspect_2d().attach_new_node(h_slider);

PT(PGSliderBar) v_slider = new PGSliderBar("Vertical Slider");
v_slider->setup_scroll_bar(true, 0, 0, 0);
NodePath v_slider_np = window->get_aspect_2d().attach_new_node(v_slider);

float asp_ratio = (float)window->get_graphics_window()->get_x_size() / (float)window->get_graphics_window()->get_y_size();
// setup scroll frame
PT(PGScrollFrame) pgs_frame = new PGScrollFrame("PG Scroll Frame");
pgs_frame->setup(2, 2, 1, 1, 1, 1, 0.05, 0.005);
pgs_frame->set_horizontal_slider(h_slider);
pgs_frame->set_vertical_slider(v_slider);
NodePath pgsf_np = window->get_aspect_2d().attach_new_node(pgs_frame);

pgsf_np.set_pos(0 - asp_ratio * 1.2 * 0.5, 0, -0.8);

// add text elements
PT(TextNode) test_text = new TextNode("Test Text");
test_text->set_text("TestTextTestTextTestTextTestTextTestTextTestTextTestTextTestTextTestTextTestTextTestTextTestTextTestTextTestText");
//test_text->set_text_scale(0.05);
pgs_frame->get_canvas_node()->add_child(test_text);

Thank you

After I removed the two calls to pgs_frame->set_horizontal_slider(h_slider); pgs_frame->set_vertical_slider(v_slider); the sliders are working now.

1 Like