0 Üye ve 1 Ziyaretçi konuyu incelemekte.
-- full gui_guiCreateTabPanel = guiCreateTabPanel_guiCreateTab = guiCreateTab_guiSetSelectedTab = guiSetSelectedTab_guiGetSelectedTab = guiGetSelectedTab_guiDeleteTab = guiDeleteTabfunction resimOlustur(isim,a) if fileExists(isim.."png") then return isim.."png" end local texture = dxCreateTexture(1,1) local pixels = dxGetTexturePixels(texture) local a = a or 255 local r,g,b = 255,255,255 dxSetPixelColor(pixels,0,0,r,g,b,a) dxSetTexturePixels(texture, pixels) local pxl = dxConvertPixels(dxGetTexturePixels(texture),"png") local nImg = fileCreate(isim..".png") fileWrite(nImg,pxl) fileClose(nImg) return isim..".png" endfunction renkVer(resim,hex) guiSetProperty(resim,"ImageColours","tl:FF"..hex.." tr:FF"..hex.." bl:FF"..hex.." br:FF"..hex)endlocal tabs = {}function guiCreateTabPanel(x,y,g,u,relative,parent) local sira = #tabs+1 if not tabs[sira] then tabs[sira] = {} end local t = tabs[sira] local kenarrenk = "1883D7" if relative then px,pu = guiGetSize(parent,false) x,y,g,u = x*px,y*pu,g*px,u*pu relative = false end t.back = guiCreateLabel(x,y,g,u,"",relative,parent) t.x,t.y = guiGetPosition(t.back,false) t.g,t.u = guiGetSize(t.back,false) t.secili,t.tabciklar = nil,{} t.tabciklar[0] = {} t.tabciklar[0].arka = guiCreateLabel(0,0,0,0,"",false,t.back) t.kenarlar = { ordaUst = guiCreateStaticImage(0,20,t.g,1,resimOlustur("test"), false, t.back), ortaAlt = guiCreateStaticImage(0,t.u-4,t.g,1,resimOlustur("test"), false, t.back), sol = guiCreateStaticImage(0,20,1,t.u-20,resimOlustur("test"), false, t.back), sag = guiCreateStaticImage(t.g-1,20,1,t.u-20,resimOlustur("test"), false, t.back) } for i,v in pairs(t.kenarlar) do renkVer(v,kenarrenk) guiSetProperty(v, "AlwaysOnTop", "True") guiSetAlpha(v, 0.4) end return t.backendfunction guiCreateTab(yazi,parent) local t = getTabPanel(parent) local sira = #t.tabciklar+1 if not t.tabciklar[sira] then t.tabciklar[sira] = {} end local tab = t.tabciklar[sira] local ox,oy = guiGetPosition(t.tabciklar[sira-1].arka,false) local og,op = guiGetSize(t.tabciklar[sira-1].arka,false) tab.arka = guiCreateStaticImage((ox+og),0,string.len(yazi)*8,20,resimOlustur("test",150),false,parent) tab.kose = guiCreateStaticImage((string.len(yazi)*8)-1,0,1,20,resimOlustur("test",200),false,tab.arka) renkVer(tab.arka,"000000") tab.yazi = guiCreateLabel(0,0,string.len(yazi)*8,20,yazi,false,tab.arka) guiLabelSetHorizontalAlign(tab.yazi, "center") guiLabelSetVerticalAlign(tab.yazi, "center") tab.alan = guiCreateStaticImage(0,20,t.g,t.u,resimOlustur("test",255),false,parent) renkVer(tab.alan,"000000") guiSetVisible(tab.alan,false) guiSetAlpha(tab.arka,0.7) if sira == 1 then tab.secili = true guiSetVisible(tab.alan,true) guiSetSelectedTab(parent,tab.alan) guiSetAlpha(tab.arka,1) end return tab.alanendfunction guiSetSelectedTab(tabpanel,tab) local t = getTabPanel(tabpanel) local ttab = getTab(t,tab) if t.secili then -- eskisini deaktif local ttab = getTab(t,t.secili) guiSetVisible(t.secili,false) guiSetAlpha(ttab.arka,0.7) end -- yenisini aktif guiSetVisible(tab,true) guiSetAlpha(ttab.arka,1) ttab.secili = true t.secili = tabendfunction guiGetSelectedTab(tabpanel) local t = getTabPanel(tabpanel) return t.seciliendfunction guiDeleteTab(tab,tabpanel) local t = getTabPanel(tabpanel) local ttab,sira = getTab(t,tab) for i,v in pairs(ttab) do if isElement(v) then destroyElement(v) end end table.remove(t.tabciklar,sira) for i=1,#t.tabciklar do local ox,oy = guiGetPosition(t.tabciklar[i-1].arka,false) local og,op = guiGetSize(t.tabciklar[i-1].arka,false) guiSetPosition(t.tabciklar[i].arka,ox+og,0,false) endendaddEventHandler("onClientMouseEnter", resourceRoot, function() for i,v in pairs(tabs) do for i,t in pairs(v.tabciklar) do if source == t.yazi and not t.secili then guiSetAlpha(t.arka,0.6) end end endend)addEventHandler("onClientMouseLeave", resourceRoot, function() for i,v in pairs(tabs) do for i,t in pairs(v.tabciklar) do if source == t.yazi and not t.secili then guiSetAlpha(t.arka,0.7) end end endend)addEventHandler("onClientGUIClick", resourceRoot, function() for i,v in pairs(tabs) do for i,t in pairs(v.tabciklar) do if source == t.yazi then guiSetSelectedTab(v.back,t.alan) triggerEvent("onClientGUITabSwitched", t.alan, t.alan) end end endend)function getTabPanel(element) if type(element) ~= "table" then for i,v in pairs(tabs) do if v.back == element then return tabs[i] end end else return element end endfunction getTab(tabpanel,element) for i,v in pairs(tabpanel.tabciklar) do if v.alan == element then return v,i end end return falseend
local sx,sy = guiGetScreenSize()local pg,pu = 500,337local x,y = (sx-pg)/2, (sy-pu)/2local pencere = guiCreateWindow(x,y,pg,pu,"img tab çalışmaları",false)tab = guiCreateTabPanel(10,25,pg-20,pu-30,false,pencere)tab2 = guiCreateTab("Test", tab,"9e9e9e")tab3 = guiCreateTab("Testttt2", tab,"9e9e9e")tab4 = guiCreateTab("uzunyazitestdfgdfg", tab,"9e9e9e")tab5 = guiCreateTab("Testttt4", tab,"9e9e9e")tab6 = guiCreateTab("Testsssss5", tab,"9e9e9e")local label = guiCreateLabel(10,10,100,100,"Testlabel",false,tab2)local buton = guiCreateButton(10,30,100,20,"testButon",false,tab2)local liste = guiCreateGridList(10,100,100,100,false,tab2)guiGridListAddColumn(liste,"TestCol",1)local edit = guiCreateEdit(10,0,100,25,"Test Edit",false,tab3)local memo = guiCreateMemo(20,50,100,50,"Test Memo",false,tab4)bindKey("3","down",function() guiDeleteTab(tab4,tab)end)showCursor(true)
aha eyw da bunu senın önceki kodladıgın pxlib le bunu birleştirirsek sorun çıkarmı
çok güzel