Announcement

Collapse
No announcement yet.

C++ Slate Scrollbox Widget Limitations & Lag

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Found solution
    TSharedRef<SScrollBar> MyScrollBar = SNew(SScrollBar);



    Still not having luck without doing that though and still no luck WITH, this is the error with your provided code
    see reference to function template instantiation 'TSharedRef<ObjectType,0>::TSharedRef(void)' being compiled
    2> with
    2> [
    2> ObjectType=SScrollBar
    Last edited by NachoBiznezz; 09-14-2017, 09:38 PM.

    Comment


    • #17
      Definitely hitting a solid road block again. Just not connecting the puzzle.

      Comment


      • #18
        You'd define it in the header file.

        Just search the code for SScrollBar and you'll find plenty of examples to look at.
        Able Ability System - A high performance, robust ability system for UE4. Now Available!

        Comment


        • #19
          Hey man just figured I'd update you
          The solution I conjured up in combination with your's ended up being the answer to this problem.
          Through a lot of trial and error I figured out how to dynamically change the SScrollBar's position and from that I can basically do everything else. That 3 months of no GPU really made me mad rusty but I'm starting to grease the gears and learn what I'm doing again. I'll throw another post up if I have any more issues, you tha man.

          .h
          Code:
          TSharedRef<SScrollBar> MyScrollBar = SNew(SScrollBar);
          .cpp
          Code:
          MyScrollBar->SetState(0.2, 0.2);
          Then to actually get it to appear in slate
          Code:
          SNew(SBorder)
          [
          MyScrollBar
          ]
          Last edited by NachoBiznezz; 09-16-2017, 04:06 PM.

          Comment


          • #20
            Now that I got that tested and working, I've been reading into the ScrollBar & Box source codes and still not really quite figuring out exactly what I have to do to hook into the SScrollBar::OnUserScrolled() function. You think you could point me in the right direction to being able to change these variables dynamically? Not figuring out how to begin the click detection on the scrollbar and the Y-Axis movement to make it go up and down, ect.

            Comment


            • #21
              Originally posted by NachoBiznezz View Post
              Now that I got that tested and working, I've been reading into the ScrollBar & Box source codes and still not really quite figuring out exactly what I have to do to hook into the SScrollBar::OnUserScrolled() function. You think you could point me in the right direction to being able to change these variables dynamically? Not figuring out how to begin the click detection on the scrollbar and the Y-Axis movement to make it go up and down, ect.
              You shouldn't have to do the click detection and all that, the widget should do that for you. You just need to make some method that takes in a float, and then pass that into the OnUserScrolled as a delegate (function pointer).

              Let's assume all this code is in some object called MyObject. Then, if I wanted to add a callback for when the user scrolls, you'd do something like:

              In your header file.
              Code:
              // ...
              
              public:
              void MyOnUserScrolledCallback(float scrollValue);
              In your Source file
              Code:
              // Where you are setting up the scroll bar widget.
               TSharedRef<SScrollBar> MyScrollBar = SNew(SScrollBar).OnUserScrolled(this, &MyObject::MyOnUserScrolledCallback);  
              
              // Define the method
              void MyObject::MyOnUserScrolledCallback(float scrollValue)
              {    
              // scrollValue is a value between 0 - 1. Figure out where that ratio lies in comparison to your data set and repopulate your widget those items.
              }
              Able Ability System - A high performance, robust ability system for UE4. Now Available!

              Comment


              • #22
                How exactly would you recommend comparing the 0-1 ratio of scrollValue to a data set of say 5,000,000 items? (All of my numbers are basically just me attempting to create something almost infinite if not entirely) I've tried converting floats to double and using the decimal as a number but I'm failing pretty hard. Here's another post related. https://forums.unrealengine.com/deve...01-storedfloat

                Comment


                • #23
                  Just multiply the ratio value (e.g. 0 - 1) times your total items, so scrollValue * MaxItems = Your new offset for data. The post you linked doesn't matter in this case. A standard float should have enough precision, even if your max number of items is huge (which will cause memory and other issues ) - it should still be fine.
                  Able Ability System - A high performance, robust ability system for UE4. Now Available!

                  Comment

                  Working...
                  X