Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2020-10-30, 22:31


adaskOO

Ten który patrzy






Wiek: 24
Na forum: 3732 dni
Posty: 249
Nick w MP: adaskOO

Piwa: 3168

Respekt: 280
Respekt: 280Respekt: 280Respekt: 280

Witaaam ka?dy z was zna chyba skrypt freeroam a ja chcia?em go troch? przerobi? i zmieni? gui na DGS ale nie mog? znale?? funkcji kt?ra tworzy przyciski.. a wed?ug mnie jej nawet nie ma..

Najdziwniejsze jest to ?e gdy jest GUI standardowe to przyciski s? ale jak zamienie ca?y interfejs na DGS to nie ma ich.. nie widz? w ogole funkcji ktora by je tworzyla..

gui.lua - client

DGS exports.dgs

-- DGS:dgs
local CONTROL_MARGIN_RIGHT 5
local LINE_MARGIN 5
local LINE_HEIGHT 16
local g_gridListContents = {}   -- info about binded gridlists
local g_openedWindows = {}      -- {window1table truewindow2table true, ...}
local g_protectedElements = {}
local GRIDLIST_UPDATE_CHUNK_SIZE 10
--DGS exports.dgs

local classInfo = {
    wnd = {className 'Window'padding = {25101010}, isContainer true},
    tbp = {className 'TabPanel'},
    tab = {className 'Tab'padding 10isContainer true},
    lbl = {className 'Label'height 20},
    btn = {className 'Button'height 20padding = {04}},
    chk = {className 'CheckBox'height 20padding = {06}},
    rad = {className 'RadioButton'height 20padding = {010}},
    txt = {className 'Edit'width=100height 24},
    lst = {className 'GridList'width 250height 400},
    img = {className 'StaticImage'}
}

function createWindow(wndrebuild)
    if wnd.element then
        if rebuild then
            destroyElement(wnd.element)
        else
            DGS:dgsSetVisible(wnd.elementtrue)
            DGS:dgsBringToFront(wnd.element)
            g_openedWindows[wnd] = true
            if wnd.oncreate then
                wnd.oncreate()
            end
            return
        end
    end

    _planWindow(wnd)
    _buildWindow(wnd)
end

local function onProtectedClick(btn,state,x,y)

    if isFunctionOnCD(g_protectedElements[source]) then return end
    g_protectedElements[source](btn,state,x,y)

end

function _planWindow(wndbaseWndparentWndxymaxHeightInLine)
    -- simulate building a window to get the proper height
    local wndClass wnd[1]

    if not maxHeightInLine then
        maxHeightInLine LINE_HEIGHT
    end

    local textpaddingparentPadding
    if wndClass ~= 'br' then
        padding classInfo[wndClass].padding
        if type(padding) == 'number' then
            padding table.rep(padding4)
            classInfo[wndClass].padding padding
        elseif type(padding) == 'table' then
            if #padding == 1 then
                padding table.rep(padding[1], 4)
                classInfo[wndClass].padding padding
            elseif #padding == 2 then
                padding table.flatten(table.rep(padding2))
                classInfo[wndClass].padding padding
            elseif #padding == 3 then
                table.insert(paddingpadding[2])
                classInfo[wndClass].padding padding
            end
        elseif not padding then
            padding table.rep(04)
            classInfo[wndClass].padding padding
        end

        text wnd.text or wnd.id or ''
        if not wnd.width then
            wnd.width = (classInfo[wndClass].width or (8*text:len()) + (not classInfo[wndClass].isContainer and (padding[2] + padding[4]) or 0))
        end
        if not wnd.height and not classInfo[wndClass].isContainer then
            wnd.height = (classInfo[wndClass].height or LINE_HEIGHT) + padding[1] + padding[3]
        end
    end
    parentPadding parentWnd and classInfo[parentWnd[1]].padding

    if wndClass == 'br' or (not classInfo[wndClass].isContainer and wnd.width parentWnd.width parentPadding[2]) then
        -- line wrap
        x parentPadding[4]
        maxHeightInLine LINE_MARGIN

        maxHeightInLine LINE_HEIGHT
        if wndClass == 'br' then
            return nilxymaxHeightInLine
        end
    end
    if not wnd.x then
        wnd.x
    end
    if not wnd.y then
        wnd.y
    end
    wnd.parent parentWnd

    if wnd.controls then
        local childXchildY padding[4], padding[1]
        local childMaxHeightInLine LINE_HEIGHT
        local control
        for idcontrolwnd in pairs(wnd.controls) do
            controlchildXchildYchildMaxHeightInLine _planWindow(controlwndbaseWnd or wndwndchildXchildYchildMaxHeightInLine)
        end
        if classInfo[wndClass].isContainer then
            wnd.height childY childMaxHeightInLine padding[3]
        end
    end

    if wnd.tabs then
        local maxTabHeight 0
        for idtab in pairs(wnd.tabs) do
            tab[1] = 'tab'
            tab.width wnd.width
            _planWindow(tabbaseWndwnd)
            if tab.height maxTabHeight then
                maxTabHeight tab.height
            end
        end
        wnd.height maxTabHeight
    end

    if classInfo[wndClass].isContainer then
        return elem
    else
        if wnd.height maxHeightInLine then
            maxHeightInLine wnd.height
        end
        return elemwnd.width CONTROL_MARGIN_RIGHTymaxHeightInLine
    end
end

function _buildWindow(wndbaseWndparentWnd)
    local wndClass wnd[1]
    if wndClass == 'br' then
        return
    end

    local relXrelYrelWidthrelHeight
    if parentWnd then
        if wnd.and wnd.y then
            relX wnd.x/parentWnd.width
            relY wnd.y/parentWnd.height
        end
        relWidth wnd.width parentWnd.width
        relHeight wnd.height parentWnd.height
    end

    local elem
    if wndClass == 'wnd' then
        local screenWidthscreenHeight guiGetScreenSize()
        if not wnd.x then
            wnd.screenWidth/wnd.width/2
        else
            local imath.modf(wnd.x)
            if ~= 0 then
                wnd.screenWidth wnd.x
            end
            if wnd.0 then
                wnd.screenWidth math.abs(wnd.x) - wnd.width
            end
        end
        if not wnd.y then
            wnd.screenHeight/wnd.height/2
        else
            local imath.modf(wnd.y)
            if ~= 0 then
                wnd.screenHeight wnd.y
            end
            if wnd.0 then
                wnd.screenHeight math.abs(wnd.y) - wnd.height
            end
        end
        elem DGS:dgsCreateWindow(wnd.xwnd.ywnd.widthwnd.heightwnd.textfalse)
        DGS:dgsWindowSetSizable(elemfalse)
        DGS:dgsBringToFront(elem)
        g_openedWindows[wnd] = true
    elseif wndClass == 'chk' then
        elem DGS:dgsCreateCheckBox(relXrelYrelWidthrelHeightwnd.text or wnd.id or ''falsetrueparentWnd.element)
    elseif wndClass == 'tbp' then
        elem DGS:dgsCreateTabPanel(relXrelYrelWidthrelHeighttrueparentWnd.element)
    elseif wndClass == 'tab' then
        elem DGS:dgsCreateTab(textparentWnd.element)
    elseif wndClass == 'lst' then
        elem DGS:dgsCreateGridList(relXrelYrelWidthrelHeighttrueparentWnd.element)
        if wnd.columns then
            DGS:dgsGridListSetSortingEnabled(elemfalse)
            for icolumn in ipairs(wnd.columns) do
                DGS:dgsGridListAddColumn(elemcolumn.text or column.attr or ''column.width or 0.9)
            end
        end
    elseif wndClass == 'img' then
        elem DGS:dgsCreateStaticImage(relXrelYrelWidthrelHeightwnd.src or ''trueparentWnd.element)
    else
        elem _G['DGS:dgsCreate' .. classInfo[wndClass].className](relXrelYrelWidthrelHeightwnd.text or wnd.id or ''trueparentWnd.element)
        if wnd.align and wndClass == 'lbl' then
            DGS:dgsLabelSetHorizontalAlign(elemwnd.aligntrue)
        end
    end
    wnd.element elem

    if wnd.controls then
        for idcontrolwnd in pairs(wnd.controls) do
            _buildWindow(controlwndbaseWnd or wndwnd)
        end
    end

    if wnd.tabs then
        for idtab in pairs(wnd.tabs) do
            _buildWindow(tabbaseWndwnd)
        end
    end

    if wnd.rows then
        if wnd.rows.xml then
            -- get rows from xml
            bindGridListToTable(wndnot gridListHasCache(wnd) and xmlToTable(wnd.rows.xmlwnd.rows.attrs) or false,
                wnd.expandlastlevel or wnd.expandlastlevel == nil)
        else
            -- rows hardcoded in window definition
            bindGridListToTable(wndnot gridListHasCache(wnd) and wnd.rows or falsefalse)
        end
    end

    local clickhandler nil
    if wnd.onclick then
        if wndClass == 'img' then
            clickhandler = function(btnstatexy)
                local imgXimgY getControlScreenPos(wnd)
                wnd.onclick((imgX)/wnd.width, (imgY)/wnd.heightbtn)
            end
        else
            clickhandler = function() wnd.onclick() end
        end
    elseif wnd.window then
        clickhandler = function() toggleWindow(wnd.windowend
    elseif wnd.inputbox then
        clickhandler = function()
            wndInput = {
                'wnd',
                width 170,
                height 60,
                controls = {
                    {'txt'id='input'text=''width=60},
                    {'btn'id='ok'onclick=function() wnd.inputbox.callback(getControlText(wndInput'input')) closeWindow(wndInputend},
                    {'btn'id='cancel'closeswindow=true}
                }
            }
            for propnamepropval in pairs(wnd.inputbox) do
                wndInput[propname] = propval
            end
            createWindow(wndInput)
            DGS:dgsBringToFront(getControl(wndInput'input'))
        end
    elseif wnd.closeswindow then
        clickhandler = function() closeWindow(baseWndend
    end
    if clickhandler then
        if wnd.ClickSpamProtected then
            g_protectedElements[elem] = clickhandler
            addEventHandler('onDgsMouseClickUp'elemonProtectedClickfalse)
        else
            addEventHandler('onDgsMouseClickUp'elemclickhandlerfalse)
        end
    end
    if wnd.ondoubleclick then
        local doubleclickhandler
        if wndClass == 'img' then
            doubleclickhandler = function(btnstatexy)
                local imgXimgY getControlScreenPos(wnd)
                wnd.ondoubleclick((imgX)/wnd.width, (imgY)/wnd.height)
            end
        else
            doubleclickhandler wnd.ondoubleclick
        end
        if wnd.DoubleClickSpamProtected then
            g_protectedElements[elem] = doubleclickhandler
            addEventHandler('onDgsMouseDoubleClick'elemonProtectedClickfalse)
        else
            addEventHandler('onDgsMouseDoubleClick'elemdoubleclickhandlerfalse)
        end
    end

    if wnd.oncreate then
        wnd.oncreate()
    end
end

function isWindowOpen(wnd)
    return wnd.element and DGS:dgsGetVisible(wnd.element)
end

function getControlScreenPos(wnd)
    local x00
    local curXcurY
    local curWnd wnd
    while curWnd do
        curXcurY DGS:dgsGetPosition(curWnd.elementfalse)
        curX
        y curY
        curWnd curWnd.parent
    end
    return xy
end

function closeWindow(...)
    -- closeWindow(window1window2, ...)
    local args = { ... }
    for i=1,#args do
        g_openedWindows[args[i]] = nil
        if not args[i].element then
            return
        end

        if args[i].onclose then
            args[i].onclose()
        end
        DGS:dgsSetVisible(args[i].elementfalse)
    end
    if not isAnyWindowOpen() then
        showCursor(false)
    end
end

function toggleWindow(...)
    local args = { ... }
    for i=1,#args do
        if isWindowOpen(args[i]) then
            closeWindow(args[i])
        else
            createWindow(args[i])
        end
    end
end

function isAnyWindowOpen()
    for wnd,_ in pairs(g_openedWindows) do
        if isWindowOpen(wndthen
            return true
        end
    end
    return false
end

function hideAllWindows()
    for wnd,_ in pairs(g_openedWindows) do
        DGS:dgsSetVisible(wnd.elementfalse)
    end
end

function showAllWindows()
    for wnd,_ in pairs(g_openedWindows) do
        DGS:dgsSetVisible(wnd.elementtrue)
    end
end

function showControls(wnd, ...)
    for i,ctrlName in ipairs({ ... }) do
        DGS:dgsSetVisible(getControl(wndctrlName), true)
    end
end

function hideControls(wnd, ...)
    for i,ctrlName in ipairs({ ... }) do
        DGS:dgsSetVisible(getControl(wndctrlName), false)
    end
end

function getControlData(...)
    local lookIn
    local currentData
    local args = { ... }
    if type(args[1]) == 'string' then
        currentData _G[args[1]]
    else
        currentData args[1]
    end

    for i=2,#args do
        if args[i] == '..' then
            currentData currentData.parent
        else
            lookIn currentData.controls or currentData.tabs
            if not lookIn then
                return false
            end
            currentData false
            for j,control in pairs(lookIn) do
                if control.id == args[ithen
                    currentData control
                    break
                end
            end
            if not currentData then
                return false
            end
        end
    end
    return currentData
end

function getControl(...)
    if type(({...})[1]) == 'userdata' then
        -- if a control element was passed
        return ({...})[1]
    end

    local data getControlData(...)
    if not data then
        return false
    end
    return data.element
end

function getControlText(...)
    return DGS:dgsGetText(getControl(...))
end

function getControlNumber(...)
    return tonumber(DGS:dgsGetText(getControl(...)))
end

function getControlNumbers(...)
    -- getControlNumbers(..., controlnames)
    -- ... = path to parent window
    -- controlnames: array of control names
    -- returns a list value1value2, ... with the numbers entered in the specified controls
    local args = {...}
    local controlnames table.remove(args)
    local result = {}
    for i,name in ipairs(controlnames) do
        result[i] = getControlNumber(unpack(args), name)
    end
    return unpack(result)
end

function setControlText(...)
    local args = {...}
    local text table.remove(args)
    local element getControl(unpack(args))
    if (element and isElement(element) and textthen
        DGS:dgsSetText(elementtext)
    end
end

function setControlNumber(...)
    local args = {...}
    local num table.remove(args)
    DGS:dgsSetText(getControl(unpack(args)), tostring(num))
end

function setControlNumbers(...)
    -- setControlNumbers(..., controlvalues)
    -- ... = path to parent window
    -- controlvaluesa table {controlname value, ...} with the numbers to set the control texts to
    local args = {...}
    local controlvalues table.remove(args)
    for name,value in pairs(controlvalues) do
        setControlNumber(unpack(args), namevalue)
    end
end

function getControlBaseWindow(...)
    local control getControlData(...)
    while control.parent do
        control control.parent
    end
    return control
end

function appendControl(...)
    -- appendControl(..., newChildControlData)
    local args = {...}
    local newChild table.remove(args)
    local parent getControlData(unpack(args))
    if not parent.controls then
        parent.controls = {}
    end
    table.insert(parent.controlsnewChild)
    local wnd getControlBaseWindow(parent)
    local visible isWindowOpen(wnd)
    createWindow(wndtrue)
    if not visible then
        DGS:dgsSetVisible(wnd.elementfalse)
    end
    return newChild.element
end

function getSelectedGridListData(...)
    -- Returns the data associated with the first item of the selected row in a grid list
    local list = getControl(...)
    local selID DGS:dgsGridListGetSelectedItem(list)
    if not selID then
        return false
    end
    return DGS:dgsGridListGetItemData(list, selID1), selID
end

function getSelectedGridListItem(...)
    -- getSelectedGridListItem(...[, column])
    -- Returns the text of the specified item in the selected row of a grid list.
    -- The column parameter may be omitted and in that case defaults to 1.
    local list
    local column
    local args = {...}
    if type(arg[arg.n]) == 'number' then
        column table.remove(args)
    else
        column 1
    end
    list = getControl(unpack(args))
    local selID DGS:dgsGridListGetSelectedItem(list)
    if not selID then
        return false
    end
    return DGS:dgsGridListGetItemText(list, selIDcolumn), selID
end

function getSelectedGridListLeaf(...)
    local listControl getControlData(...)
    local selData getSelectedGridListData(listControl.element)
    if not selData then
        return false
    end
    local listdata g_gridListContents[listControl]
    return followTreePath(listdata.datalistdata.currentPathtable.map(string.split(selData'/'), tonumber))
end

function bindGridListToTable(...)
    -- bindGridListToTable(..., texpandLastLevel)
    -- ... = control path to gridlist
    -- table to set. If false, use the cached table
    -- expandLastLevel = if a group occurs in the list with only leaves as direct children,
    --    show those leaves under the group name in the list

    -- Makes a table created by xmlToTable() browsable in a gridlist.
    local args = {...}
    local expandLastLevel table.remove(args)
    local t table.remove(args)
    if and not treeHasMetaInfo(tthen
        addTreeMetaInfo(t)
    end

    local gridListControlData getControlData(unpack(args))
    local gridlist gridListControlData.element
    local columns table.merge({}, gridListControlData.columns'attr')

    -- currentPath: list of indices to follow through the groups table
    -- to get to the current groupf.e. {1,3} = third child group of first main group
    local listdata g_gridListContents[gridListControlData]
    if not listdata then
        listdata = {currentPath={}, data=tcolumns=columns}
        if gridListControlData.pathlbl then
            listdata.pathlbl getControl(gridListControlData'..'gridListControlData.pathlbl)
        end
        g_gridListContents[gridListControlData] = listdata
    elseif t then
        listdata.data t
        listdata.currentPath = {}
    end
    if not t then
        t g_gridListContents[gridListControlData].data
    end
    _updateBindedGridList(gridlistlistdataexpandLastLevel)

    if not listdata.clickHandlersSet then
        -- set item click handler
        if gridListControlData.onitemclick then
            if gridListControlData.ClickSpamProtected then
                addEventHandler('onDgsMouseClickUp'gridlist,
                    function()
                        if isFunctionOnCD(gridListControlData.onitemclickthen return end
                        local leaf getSelectedGridListLeaf(gridListControlData)
                        if leaf then
                            gridListControlData.onitemclick(leaf)
                        end
                    end,
                    false
                )
            else
                addEventHandler('onDgsMouseClickUp'gridlist,
                    function()
                        local leaf getSelectedGridListLeaf(gridListControlData)
                        if leaf then
                            gridListControlData.onitemclick(leaf)
                        end
                    end,
                    false
                )
            end
        end

        -- set double click handler
        addEventHandler('onDgsMouseDoubleClick'gridlist,
            function()
                local listdata g_gridListContents[gridListControlData]
                local previousGroup followTreePath(listdata.datalistdata.currentPath)

                local selDataselRow getSelectedGridListData(gridlist)
                if not selData then
                    return
                end
                if tonumber(selData) == 0 then
                    -- Go to parent group
                    table.remove(listdata.currentPath)
                else
                    -- Go into child group or do item double click callback
                    local clickedNode followTreePath(listdata.datalistdata.currentPathtable.map(string.split(selData'/'), tonumber))
                    if clickedNode[1] == 'group' then
                        table.insert(listdata.currentPathtonumber(selData))
                    else
                        if gridListControlData.onitemdoubleclick then
                            if gridListControlData.DoubleClickSpamProtected then
                                if isFunctionOnCD(gridListControlData.onitemdoubleclickthen return end
                                gridListControlData.onitemdoubleclick(clickedNodeselRow)
                            else
                                gridListControlData.onitemdoubleclick(clickedNodeselRow)
                            end
                        end
                        return
                    end
                end
                applyToLeaves(previousGroup, function(itemitem.row nil end)
                _updateBindedGridList(gridlistlistdataexpandLastLevel)
            end,
            false
        )
        listdata.clickHandlersSet true
    end

    local modifiableCols table.findall(gridListControlData.columns'enablemodify'true)
    if #modifiableCols then
        local mt = {
            __index = function(leafk)
                return leaf.shadow[k]
            end,

            __newindex =
                function(leafkv)
                    if ~= 'row' and leaf.row then
                        leaf.shadow[k] = v
                        DGS:dgsGridListSetItemText(gridlistleaf.rowtable.find(columnsk), type(v) == 'boolean' and (and 'X' or '') or tostring(v), falsefalse)
                        DGS:dgsSetAlpha(gridlistDGS:dgsGetAlpha(gridlist))    -- force repaint
                    else
                        rawset(leafkv)
                    end
                end
        }

        local attr
        applyToLeaves(t,
            function(leaf)
                -- move modifiable attributes into shadow so that __newindex triggers
                if not leaf.shadow then
                    leaf.shadow = {}
                    for i,index in ipairs(modifiableCols) do
                        attr gridListControlData.columns[index].attr
                        leaf.shadow[attr] = leaf[attr]
                        leaf[attr] = nil
                    end
                end
                setmetatable(leafmt)
            end
        )
    end
end

function gridListHasCache(...)
    local listControl getControlData(...)
    return g_gridListContents[listControl] and true or false
end

function getGridListCache(...)
    local listControl getControlData(...)
    return g_gridListContents[listControl] and g_gridListContents[listControl].data
end

function resetGridListPath(...)
    g_gridListContents[getControlData(...)].currentPath = {}
end

function _updateBindedGridList(gridlistlistdataexpandLastLevelisContinuation)
    -- Updates the contents of a binded gridlistfollowing the current path
    -- If expandLastLevel is truewhen entering a view of groups with leaves right under
    -- themthe leaves will be displayed in the list under the group headers
    -- (instead of having to double click the group to view the leaves)

    -- isContinuation is used for adding list items in small groups at frame updates
    -- to improve responsiveness. Do not specify this parameter when calling this
    -- function.

    -- find current group
    local group followTreePath(listdata.datalistdata.currentPath)
    local toDisplay group.children or group

    if not isContinuation then
        -- clear eventual previous event
        if _updateGridListOnFrame then
            _removeGridListFrameUpdate(listdata)
        end

        DGS:dgsGridListClear(gridlist)

        -- set update event if necessary
        if not expandLastLevel and toDisplay[1][1] ~= 'group' then
            _updateGridListOnFrame = function()
                _updateBindedGridList(gridlistlistdatafalsetrue)
            end
            addEventHandler('onClientRender'getRootElement(), _updateGridListOnFrame)
        end

        -- update path label if necessary
        if listdata.pathlbl then
            DGS:dgsSetText(listdata.pathlbltreePathToString(listdata.datalistdata.currentPath))
        end

        -- add row to go back to parent group if necessary
        if #(listdata.currentPath) > 0 then
            DGS:dgsGridListAddRow(gridlist)
            DGS:dgsGridListSetItemText(gridlist01'..'falsefalse)
            DGS:dgsGridListSetItemData(gridlist01'0')
        end
    end

    -- display the group contents
    local rowIDleafRowID
    if expandLastLevel or toDisplay[1][1] == 'group' then
        for i,item in ipairs(toDisplay) do
            if type(item) == 'table' then
                rowID DGS:dgsGridListAddRow(gridlist)
                if item[1] == 'group' then
                    -- group
                    if expandLastLevel and (listdata.data.maxSubDepth == or item.depth 1) and item.maxSubDepth == item.depth 1 then
                        DGS:dgsGridListSetItemText(gridlistrowID1item.namefalsefalse)
                        for j,leaf in ipairs(item.children) do
                            leafRowID DGS:dgsGridListAddRow(gridlist)
                            _putLeafInGridListRow(gridlistleafRowIDleaflistdata.columns)
                            DGS:dgsGridListSetItemData(gridlistleafRowID1.. '/' .. j)
                            leaf.row leafRowID
                        end
                    else
                        DGS:dgsGridListSetItemText(gridlistrowID1'+ ' .. item.namefalsefalse)
                    end
                else
                    -- leaf
                    _putLeafInGridListRow(gridlistrowIDitemlistdata.columns)
                end
                DGS:dgsGridListSetItemData(gridlistrowID1tostring(i))
                item.row rowID
            end
        end
    else
        local startIndex listdata.nextChunkStartIndex or 1
        local endIndex math.min(startIndex GRIDLIST_UPDATE_CHUNK_SIZE 1#toDisplay)
        for i=startIndex,endIndex do
            rowID DGS:dgsGridListAddRow(gridlist)
            _putLeafInGridListRow(gridlistrowIDtoDisplay[i], listdata.columns)
            DGS:dgsGridListSetItemData(gridlistrowID1tostring(i))
            toDisplay[i].row rowID
        end
        if endIndex == #toDisplay then
            _removeGridListFrameUpdate(listdata)
        else
            listdata.nextChunkStartIndex endIndex 1
        end
    end
end

function _putLeafInGridListRow(gridlistrowleafcolumnAttrs)
    for k,attr in ipairs(columnAttrs) do
        DGS:dgsGridListSetItemText(gridlistrowktype(leaf[attr]) == 'boolean' and (leaf[attr] and 'X' or '') or ('    ' .. tostring(leaf[attr])), falsefalse)
    end
end

function _removeGridListFrameUpdate(listdata)
    removeEventHandler('onClientRender'getRootElement(), _updateGridListOnFrame)
    listdata.nextChunkStartIndex nil
    _updateGridListOnFrame nil
end



Podpis

Zapraszam do współpracy :)
Discord: adaskOO#8255
Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-10-30, 22:47


vAnimo

Zielony w luła






Wiek: 19
Na forum: 2312 dni
Posty: 165
Nick w MP: vAnimo

Piwa: 882

Respekt: 70

https://wiki.multitheftauto.com/wiki/OnDgsMouseClick

[ Dodano: 2020-10-30, 23:46 ]

Więcej informacji znajdziesz w Wikipedii MTA:

OnDgsMouseClick


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-10-31, 11:30


adaskOO

Ten który patrzy






Wiek: 24
Na forum: 3732 dni
Posty: 249
Nick w MP: adaskOO

Piwa: 3168

Respekt: 280
Respekt: 280Respekt: 280Respekt: 280

"vAnimo" napisał/a:

https://wiki.multitheftauto.com/wiki/OnDgsMouseClick

[ Dodano: 2020-10-30, 23:46 ]

Więcej informacji znajdziesz w Wikipedii MTA:

OnDgsMouseClick


To jest event a ja chc? w tym kodzie znale?? co tworzy przyciski a nie jak je wykonywa?.

Podpis

Zapraszam do współpracy :)
Discord: adaskOO#8255
Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-10-31, 12:20


vAnimo

Zielony w luła






Wiek: 19
Na forum: 2312 dni
Posty: 165
Nick w MP: vAnimo

Piwa: 882

Respekt: 70

local classInfo = {
    wnd = {className 'Window'padding = {25101010}, isContainer true},
    tbp = {className 'TabPanel'},
    tab = {className 'Tab'padding 10isContainer true},
    lbl = {className 'Label'height 20},



    btn = {className 'Button'height 20padding = {04}}, -- to jest definicja chyba




    chk = {className 'CheckBox'height 20padding = {06}},
    rad = {className 'RadioButton'height 20padding = {010}},
    txt = {className 'Edit'width=100height 24},
    lst = {className 'GridList'width 250height 400},
    img = {className 'StaticImage'}
}


                controls = {
                    {'txt'id='input'text=''width=60},
                    {'btn'id='ok'onclick=function() wnd.inputbox.callback(getControlText(wndInput'input')) closeWindow(wndInputend},
                    {'btn'id='cancel'closeswindow=true}
                }

a tu masz tworzenie przycisk?w


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-10-31, 12:37


adaskOO

Ten który patrzy






Wiek: 24
Na forum: 3732 dni
Posty: 249
Nick w MP: adaskOO

Piwa: 3168

Respekt: 280
Respekt: 280Respekt: 280Respekt: 280

No dobra wiem ?e to s? potrzebne rzeczy takie jak wysokosc, szeroko??, nazwa to trzeba u?y? w funkcji guiCreateButton? Ale gdzie ona jest? O o to w tym wszystkim chodzi jak mo?na utworzy? przycisk bez guiCreateButton, bo nigdzie nie widz? tego w kodzie?

To powinno go stworzy? z tego ci mi si? wydaje ale tego nie robi..

elem _G['DGS:dgsCreate' .. classInfo[wndClass].className](relXrelYrelWidthrelHeightwnd.text or wnd.id or ''trueparentWnd.element)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-10-31, 12:46


vAnimo

Zielony w luła






Wiek: 19
Na forum: 2312 dni
Posty: 165
Nick w MP: vAnimo

Piwa: 882

Respekt: 70

['DGS:dgsCreate' .. classInfo[wndClass].className]
tu masz odpowied? tworzy dobrze, bo pobiera z tabeli btn i daje tam po Create Button wi?c czego nie rozumiesz?? Jak mia?o by by? guiCreateButton jak to jest dgs sam sobie zaprzeczy?e?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-10-31, 13:56


adaskOO

Ten który patrzy






Wiek: 24
Na forum: 3732 dni
Posty: 249
Nick w MP: adaskOO

Piwa: 3168

Respekt: 280
Respekt: 280Respekt: 280Respekt: 280

Ch?opie to ty nie rozumiesz wiem, ?e mam dgs i chodzi mi o to ?e gdy ca?y intefejs jest w ce gui to przyciski s? ale gdy ustawiam na dgs nie ma ich i wcale ich nie tworzy. Z guiCreateButton chodzilo mi o to ?e potrzebna jest aby stworzyc BUTTON bez niej si? nie pojawi znik?d.. tak samo jak dla DGS dgsCreateButton.

Skoro:

 elem _G['guiCreate' .. classInfo[wndClass].className](relXrelYrelWidthrelHeightwnd.text or wnd.id or ''trueparentWnd.element)


tworzy dzia?aj?ce i pokazuj?ce si? przyciski dla CEGUI to dlaczego:

elem _G['DGS:dgsCreate' .. classInfo[wndClass].className](relXrelYrelWidthrelHeightwnd.text or wnd.id or ''trueparentWnd.element)

nie tworzy przyciskow wcale?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-10-31, 18:19


vAnimo

Zielony w luła






Wiek: 19
Na forum: 2312 dni
Posty: 165
Nick w MP: vAnimo

Piwa: 882

Respekt: 70

Pyta?e? o funkcje a nie czemu nie dzia?a ...
Sprawd? czy wszystko w tych tabelach si? zgadza

[ Dodano: 2020-10-31, 18:20 ]
Nie masz czasami jakiego? b??du z db3??

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-11-01, 11:07


RudyTMM
[Usunięty]









[lua]btn = {className = 'Button', height = 20, padding = {0, 4}},[/lua]

 

 
Tagi: freeroam :: która :: funkcja :: odpowiada?
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA Odpowiedz do tematu

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku