Original Post
Hello all I'm programming a Scrollbar for my software in OpenGL and so far so good I have my scrollbar able to perform up and down movement and stop at the areas I want it too with the mouse.
The problem is at this point is too determine the amount of movement the text will move up or down determining how many rows there are so the scrollbar can go through the hole list of rows correctly.
This is what I have:
The problem with that code is that if there is too little text then I have space on my Scrollbar that's wasting space and if there is more ... you get the point. Whats a good way to fix my scrollbar so that it will move through everything? I don't have my scrollbar resize by the way I was thinking it would be easier just to have it keep it's size no matter how big the list is.
Thanks, Andrew.
[Edited by - ajm113 on October 3, 2010 2:32:39 PM]
The problem is at this point is too determine the amount of movement the text will move up or down determining how many rows there are so the scrollbar can go through the hole list of rows correctly.
This is what I have:
//Is the scroll bar staying in it's area? if((LayerScrollBar.vec1.m_Y + Dir.m_Y) >= 140 && (LayerScrollBar.vec1.m_Y + Dir.m_Y) <= 230) {//Move the scrollbar in the direction the mouse is moving. LayerScrollBar.vec1.m_Y += Dir.m_Y; if(Dir.m_Y > 0) {//Are we scrolling up? if(m_Layers.m_Layers.size() > 13 && LayerScrollPos+13 < m_Layers.m_Layers.size()) LayerScrollPos++; } else { //Are we scrolling down? if(m_Layers.m_Layers.size() > 13 && LayerScrollPos > 0) LayerScrollPos--; } }The problem with that code is that if there is too little text then I have space on my Scrollbar that's wasting space and if there is more ... you get the point. Whats a good way to fix my scrollbar so that it will move through everything? I don't have my scrollbar resize by the way I was thinking it would be easier just to have it keep it's size no matter how big the list is.
Thanks, Andrew.
[Edited by - ajm113 on October 3, 2010 2:32:39 PM]