السلام عليكم
اول مره اطرح وظيفه ☺
الوظيفه هي اغلاق اللوحه مثل اللي بالجيو اديتور
function CreateButtonClose( GuiElement , text,d)
if getElementType(GuiElement) == 'gui-window' then
local Text = '|'..text..' |'
local Font = 'default-bold-small'
local width = dxGetTextWidth(Text, 1, Font)
local x = d == 'left' and guiGetSize(GuiElement, false)-50 or d == 'right' and 5
local ln = guiCreateLabel(x,2,width+5,15,Text, false,GuiElement)
guiSetProperty(ln ,'ClippedByParent', 'False')
guiSetProperty(ln ,'AlwaysOnTop', 'True')
guiSetFont(ln , Font)
guiLabelSetColor(ln ,150,150,150)
guiLabelSetHorizontalAlign(ln , 'center', false)
--- Events
addEventHandler('onClientGUIClick',ln, function() guiSetVisible(GuiElement, false ) end,false)
addEventHandler('onClientMouseEnter',ln, function() guiLabelSetColor(source ,255, 69, 59) end,false)
addEventHandler('onClientMouseLeave',ln, function() guiLabelSetColor(source ,150,150,150) end,false)
else
print('This function is a static function the Window')
end
end
--- Test Code
window1 = guiCreateWindow(0.01, 0.04, 0.70, 0.70, "Window1", true)
window2 = guiCreateWindow(0.43, 0.04, 0.38, 0.29, "Window2", true)
for k,element in ipairs(getElementsByType('gui-window',getResourceGUIElement(getThisResource()))) do
CreateButtonClose ( element,'Close','right' )
--CreateButtonClose ( element,'Close','left' )
end
معلش مابعرف اشرح بس تقدرو تجربو الوظيفه واتمني ان تنال اعجابكم ?