Jump to content

guiScrollBarGetScrollPosition value lacks fractional part


DiSaMe

Recommended Posts

This seems like a bug. Description of function guiScrollBarGetScrollPosition says it returns a float between 0 and 100. However, it actually returns an integer. I have this code:

function createScroll() 
    local scrollbar = guiCreateScrollBar (0.95,0,0.05,1,false,true) 
    guiSetProperty(scrollbar,"StepSize",0.1/19.5) 
    addEventHandler("onClientGUIScroll",scrollbar,onScroll) 
    showCursor(true) 
end 
  
function onScroll() 
    outputChatBox(tostring(guiScrollBarGetScrollPosition(source))) 
end 
  
createScroll() 

When I'm clicking the lower arrow of the scrollbar, it outputs these numbers: 0,1,1,2,2,3,3,4,4... Numbers in the sequence are increasing, what means the scroll position stored in MTA is a floating point value. But the function returns an integer, so I can't get an accurate position. Can I do something to get a float or at least a more accurate integer (for example, a value between 0 and 1000)?

Link to comment
1. function createScroll() 
   2.     local scrollbar = guiCreateScrollBar (0.95,0,0.05,1,false,true) 
   3.     guiSetProperty(scrollbar,"StepSize",0.1/19.5) 
   4.     addEventHandler("onClientGUIScroll",scrollbar,onScroll) 
   5.     showCursor(true) 
   6. end 
   7.   
   8. function onScroll() 
   9.     outputChatBox(tostring(guiScrollBarGetScrollPosition(source)*10)) 
  10. end 
  11.   
  12. createScroll() 

Link to comment
function createScroll() 
    scrollbar = guiCreateScrollBar (0.95,0,0.05,1,false,true) 
    guiSetProperty(scrollbar,"StepSize",0.1/19.5) 
    showCursor(true) 
end 
  
function onScroll() 
    outputChatBox(tostring(guiScrollBarGetScrollPosition(source)*1.0)) 
end 
addEventHandler("onClientGUIScroll",scrollbar,onScroll) 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...