Jump to content

Search the Community

Showing results for tags 'dx list'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Multi Theft Auto: San Andreas 1.x
    • Support for MTA:SA 1.x
    • User Guides
    • Open Source Contributors
    • Suggestions
    • Ban appeals
  • General MTA
    • News
    • Media
    • Site/Forum/Discord/Mantis/Wiki related
    • MTA Chat
    • Other languages
  • MTA Community
    • Scripting
    • Maps
    • Resources
    • Other Creations & GTA modding
    • Competitive gameplay
    • Servers
  • Other
    • General
    • Multi Theft Auto 0.5r2
    • Third party GTA mods
  • Archive
    • Archived Items
    • Trash

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Gang


Location


Occupation


Interests

Found 1 result

  1. well i am trying to create a dx list but im stuck on creating a scroll bar well i tried in a few different ways but none worked. please give me some examples of how to make a scroll function createList(x,y,w,h,parent) local id = #elements_Table.list + 1 elements_Table.list[id] = {} if not x or not y or not w or not h then outputDebugString("Error: Missing some arguments (x,y,w,h)") end elements_Table.list[id].x = x elements_Table.list[id].y = y elements_Table.list[id].w = w elements_Table.list[id].h = h elements_Table.list[id].parent = parent or nil elements_Table.list[id].visible = false elements_Table.list[id].items = {} elements_Table.list[id].selected = 0 elements_Table.list[id].scroll = 0 if parent then table.insert(parent.children,elements_Table.list[id]) elements_Table.list[id].x = elements_Table.list[id].x + parent.px elements_Table.list[id].y = elements_Table.list[id].y + parent.py end return elements_Table.list[id] end function addItem(grid,text) if grid then table.insert(grid.items,{text = text, alpha = 0}) return #grid.items end return false end function onHover() for i,list in pairs(elements_Table.list) do for num,rows in pairs(list.items) do if isCursorHover(list.x,list.y+(num*20)-17,list.w,20) then rows.alpha = 150 else rows.alpha = 0 end end end end addEventHandler( "onClientRender", root, onHover) function onClick() for i,list in pairs(elements_Table.list) do for num,rows in pairs(list.items) do if isCursorHover(list.x,list.y+(num*20)-17,list.w,20) then list.selected = num end end end end addEventHandler( "onClientClick", root, onClick ) function renderList() for i,v in pairs(elements_Table.list) do if v.visible then dxDrawRectangle(v.x,v.y,v.w,v.h + 10,tocolor(0,0,0,150)) for num,row in pairs(v.items) do if (num*20)-v.scroll < v.h then v.showingr = num if v.selected ~= num then dxDrawRectangle( v.x, v.y+(num*20)-17, v.w, 20,tocolor(0,0,0,row.alpha)) else dxDrawRectangle( v.x, v.y+(num*20)-17, v.w, 20,tocolor(0,0,0,255)) end dxDrawText(row.text,v.x + 1,v.y+(num*20)-17,v.w+v.x,v.y+20,tocolor(255,255,255,255),1,"default-bold","left","top") end end end end end addEventHandler( "onClientRender", root, renderList)
×
×
  • Create New...