Jump to content

dxGridList


Recommended Posts

1 minute ago, Trefeor said:

 


tables = { } 
dxCreateRenderTarget
'onClientRender'
dxSetRenderTarget
dxDrawRectangle
dxDrawText
dxDrawImage

وشوية حسابات

:) انا جيت اطلب هنا عن الفنكشنات الا عشان م ابي اسويه من ال0

Link to comment

ما يحتاج تجيب مود كامل تقدر تسويه بنفسك 

مثال : 

local testTable = {
	[1] = "me",
	[2] = "me again",
	[3] = "wow",
	[4] = "wooooow"
}

addEventHandler("onClientRender", root,
	function()
		for index = 1, #testTable do
			local x, y, w, h = 311, 173+(19*index), 227, 19
			if isMouseInPosition(x, y, w, h) then
				dxDrawRectangle(x, y, w, h, tocolor(100, 100, 100, 255), false)
				dxDrawText(testTable[index], x, y, w+x, h+y, tocolor(150, 150, 150, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false)
			else
				dxDrawRectangle(x, y, w, h, tocolor(20, 20, 20, 255), false)
				dxDrawText(testTable[index], x, y, w+x, h+y, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false)
			end
		end
	end
)

و عشان تحدد شي منو تقدر تسوي نفس الشي هيك : 

addEventHandler("onClientClick", root,
	function(b, s)
		if b == "left" and s == "down" then
			for index = 1, #testTable do
				local x, y, w, h = 311, 173+(19*index), 227, 19
				if isMouseInPosition(x, y, w, h) then
					outputChatBox("you clicked on "..testTable[index])
					break
				end
			end
		end
	end
)

+ طبعا بتحتاج وظيفه  inMouseInPosition

Link to comment
49 minutes ago, #َxLysandeR said:

ما يحتاج تجيب مود كامل تقدر تسويه بنفسك 

مثال : 


local testTable = {
	[1] = "me",
	[2] = "me again",
	[3] = "wow",
	[4] = "wooooow"
}

addEventHandler("onClientRender", root,
	function()
		for index = 1, #testTable do
			local x, y, w, h = 311, 173+(19*index), 227, 19
			if isMouseInPosition(x, y, w, h) then
				dxDrawRectangle(x, y, w, h, tocolor(100, 100, 100, 255), false)
				dxDrawText(testTable[index], x, y, w+x, h+y, tocolor(150, 150, 150, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false)
			else
				dxDrawRectangle(x, y, w, h, tocolor(20, 20, 20, 255), false)
				dxDrawText(testTable[index], x, y, w+x, h+y, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false)
			end
		end
	end
)

و عشان تحدد شي منو تقدر تسوي نفس الشي هيك : 


addEventHandler("onClientClick", root,
	function(b, s)
		if b == "left" and s == "down" then
			for index = 1, #testTable do
				local x, y, w, h = 311, 173+(19*index), 227, 19
				if isMouseInPosition(x, y, w, h) then
					outputChatBox("you clicked on "..testTable[index])
					break
				end
			end
		end
	end
)

+ طبعا بتحتاج وظيفه  inMouseInPosition

:)حبيبي ابي  اسوي السكور بار  م ابي اسوي القريد

Link to comment
2 hours ago, *RayaN-Alharbi. said:

:)حبيبي ابي  اسوي السكور بار  م ابي اسوي القريد

درس الرياضيات عندك كويس او لا؟ هه

السكرول بار ما بتقدر تسويه غير اذا تعرف رياضيات كويس

Link to comment
33 minutes ago, #َxLysandeR said:

هههه طيب اطرح لي كود الريندر بتاع الجريد لبست

addEventHandler ( "onClientRender", root,
    function ( )
        -- Is there any GridList to render?
        if #dxGrid.items > 0 then
            -- Loop through all grid lists
            for index, data in ipairs ( dxGrid.items ) do
                -- Is the GridList visible?
                if data.vis then
                    -- Draw the 'GridList' itself
                    dxDrawRectangle ( data.x, data.y, data.w, data.h, tocolor ( 0, 0, 0, 200 ), data.pg );

                    -- Draw the column bar
                    dxDrawRectangle ( data.x, data.y, data.w, 30 % data.h, tocolor ( 0, 0, 0, 220 ), data.pg );

                    -- Set cursorOn variable to the current GridList, if it's selected
                    cursorOn = nil
                    if __isMouseInPosition ( data.x, data.y, data.w, data.h ) then
                        cursorOn = index;
                    end

                    -- Check if there's any selected item
                    local seeFrom   =   data.s;
                    local seeTo     =   ( data.s + data.mi ) - 1;

                    if data.se and data.se <= data.r and data.se >= seeFrom and data.se <= seeTo then
                        local index     =   data.se - ( data.s - 1 );
                        local y2        =   data.y + ( ( index - 1 ) * 25 );

                        -- Draw a rectangle to make it looks like selected
                        dxDrawRectangle ( data.x, ( 30 % data.h ) + y2, data.w, 20, tocolor ( 0, 0, 0, 100 ), data.pg );
                    end

                    -- Is there any column?
                    if #data.i > 0 then
                    local cWidth = 0

                        -- Loop through all columns
                        for cIndex, cData in ipairs ( data.i ) do
                            -- we'll go beyond the GridList width with this column ?
                            if ( ( cWidth + cData.info.width ) <= data.w ) then
                                local x = data.x + cWidth;

                                -- Draw the column title
                                dxDrawText ( cData.info.title, x, data.y, cData.info.width + x, ( 30 % data.h ) + data.y, tocolor ( 255, 255, 255 ), FIT_MODE and ( 1 * SCALE ) or 1, "default-bold", "center", "center", true, true, data.pg, true, true );

                                -- Reset the selected item
                                cData.info.selected = -1;

                                -- Is there any item ?
                                if #cData > 0 then
                                    local seeFrom   =   data.s;
                                    local seeTo     =   ( data.s + data.mi ) - 1;

                                    -- Loop the items
                                    for iIndex = seeFrom, seeTo do
                                        -- There's a row with this index in the current column?
                                        if cData[iIndex] then
                                            local index     =   iIndex - ( data.s - 1 );
                                            local y         =   data.y + ( index * 25 );
                                            local y2        =   data.y + ( ( index - 1 ) * 25 );

                                            -- Check if cursor is on item position
                                            if __isMouseInPosition ( data.x, ( 30 % data.h ) + y2, data.w, 20 ) then
                                                -- Define the mouse-on variable
                                                data.mo = iIndex;
                                            end

                                            -- Draw the item text
                                            dxDrawText ( cData[iIndex]["text"], x, y, cData.info.width + x, ( 30 % data.h ) + y, tocolor ( unpack ( cData[iIndex]["color"] ) ), FIT_MODE and ( 1 * SCALE ) or 1, "default-bold", "center", "center", true, true, data.pg, true, true );
                                        end
                                    end
                                end

                                -- Increase cWidth variable (to draw the columns correctly)
                                cWidth = cWidth + cData.info.width;
                            end
                        end
                    end
                end
            end
        end
    end
, true, "low-5")

 

Link to comment
3 minutes ago, #َxLysandeR said:

وش هي

data.se

data.s

data.mi

 ?

 se      =       -1;                                                         -- Selected item

s       =       1;                                                          -- Scroll Level

mi      =       __calcMaxItems ( FIT_MODE and ( height * Y ) or height );    -- Max items

 

Link to comment

p_931kooym1.png

تشوف سكرول :( ؟

زي م قال روك هو مستخدمها للماوس بالماوس3 لما تحركه

         

                        if dxGrid.items[cursorOn].r > dxGrid.items[cursorOn].mi then
                            -- Define some variables
                            local index         =   cursorOn;
                            local currentValue  =   dxGrid.items[index].s;
                            local newValue      =   math.max ( 1, button == "mouse_wheel_down" and currentValue + 2 or currentValue -1 );

                            -- Check if we have spent the row's limit with the new value
                            if ( ( newValue + dxGrid.items[index].mi ) > dxGrid.items[index].r ) then
                                newValue = ( dxGrid.items[index].r - dxGrid.items[index].mi ) + 1;
                            end

                            -- Set the new scroll level
                            dxGrid.items[index].s = newValue;

 

Edited by *RayaN-Alharbi.
Link to comment

قصدك تبي تحط السكرول بار مع الجريد ليست يكون رسم يعني : تفضل

addEventHandler ( "onClientRender", root,
    function ( )
        -- Is there any GridList to render?
        if #dxGrid.items > 0 then
            -- Loop through all grid lists
            for index, data in ipairs ( dxGrid.items ) do
                -- Is the GridList visible?
                if data.vis then
                    -- Draw the 'GridList' itself
                    dxDrawRectangle ( data.x, data.y, data.w, data.h, tocolor ( 0, 0, 0, 200 ), data.pg );

                    -- Draw the column bar
                    dxDrawRectangle ( data.x, data.y, data.w, 30 % data.h, tocolor ( 0, 0, 0, 220 ), data.pg );
					--Create the Scrollbar
					if data.r > data.mi+1 then
						local x, y, w, h, totalRows, maxItems, scroll = data.x, data.y, data.w, data.h, data.r, data.mi+1, data.s-1
						dxDrawRectangle(x+w-10, y, 10, h, tocolor(0, 0, 0, 200), true);
						dxDrawRectangle(x+w-10, (y+h/totalRows*(scroll)), 10, (h/totalRows*maxItems), tocolor(255, 255, 255, 200), true );
					end
                    -- Set cursorOn variable to the current GridList, if it's selected
                    cursorOn = nil
                    if __isMouseInPosition ( data.x, data.y, data.w, data.h ) then
                        cursorOn = index;
                    end

                    -- Check if there's any selected item
                    local seeFrom   =   data.s;
                    local seeTo     =   ( data.s + data.mi ) - 1;

                    if data.se and data.se <= data.r and data.se >= seeFrom and data.se <= seeTo then
                        local index     =   data.se - ( data.s - 1 );
                        local y2        =   data.y + ( ( index - 1 ) * 25 );

                        -- Draw a rectangle to make it looks like selected
                        dxDrawRectangle ( data.x, ( 30 % data.h ) + y2, data.w, 20, tocolor ( 0, 0, 0, 100 ), data.pg );
                    end

                    -- Is there any column?
                    if #data.i > 0 then
                    local cWidth = 0

                        -- Loop through all columns
                        for cIndex, cData in ipairs ( data.i ) do
                            -- we'll go beyond the GridList width with this column ?
                            if ( ( cWidth + cData.info.width ) <= data.w ) then
                                local x = data.x + cWidth;

                                -- Draw the column title
                                dxDrawText ( cData.info.title, x, data.y, cData.info.width + x, ( 30 % data.h ) + data.y, tocolor ( 255, 255, 255 ), FIT_MODE and ( 1 * SCALE ) or 1, "default-bold", "center", "center", true, true, data.pg, true, true );

                                -- Reset the selected item
                                cData.info.selected = -1;

                                -- Is there any item ?
                                if #cData > 0 then
                                    local seeFrom   =   data.s;
                                    local seeTo     =   ( data.s + data.mi ) - 1;

                                    -- Loop the items
                                    for iIndex = seeFrom, seeTo do
                                        -- There's a row with this index in the current column?
                                        if cData[iIndex] then
                                            local index     =   iIndex - ( data.s - 1 );
                                            local y         =   data.y + ( index * 25 );
                                            local y2        =   data.y + ( ( index - 1 ) * 25 );

                                            -- Check if cursor is on item position
                                            if __isMouseInPosition ( data.x, ( 30 % data.h ) + y2, data.w, 20 ) then
                                                -- Define the mouse-on variable
                                                data.mo = iIndex;
                                            end

                                            -- Draw the item text
                                            dxDrawText ( cData[iIndex]["text"], x, y, cData.info.width + x, ( 30 % data.h ) + y, tocolor ( unpack ( cData[iIndex]["color"] ) ), FIT_MODE and ( 1 * SCALE ) or 1, "default-bold", "center", "center", true, true, data.pg, true, true );
                                        end
                                    end
                                end

                                -- Increase cWidth variable (to draw the columns correctly)
                                cWidth = cWidth + cData.info.width;
                            end
                        end
                    end
                end
            end
        end
    end
, true, "low-5")

 

  • Like 1
Link to comment
13 minutes ago, #َxLysandeR said:

قصدك تبي تحط السكرول بار مع الجريد ليست يكون رسم يعني : تفضل


addEventHandler ( "onClientRender", root,
    function ( )
        -- Is there any GridList to render?
        if #dxGrid.items > 0 then
            -- Loop through all grid lists
            for index, data in ipairs ( dxGrid.items ) do
                -- Is the GridList visible?
                if data.vis then
                    -- Draw the 'GridList' itself
                    dxDrawRectangle ( data.x, data.y, data.w, data.h, tocolor ( 0, 0, 0, 200 ), data.pg );

                    -- Draw the column bar
                    dxDrawRectangle ( data.x, data.y, data.w, 30 % data.h, tocolor ( 0, 0, 0, 220 ), data.pg );
					--Create the Scrollbar
					if data.r > data.mi+1 then
						local x, y, w, h, totalRows, maxItems, scroll = data.x, data.y, data.w, data.h, data.r, data.mi+1, data.s-1
						dxDrawRectangle(x+w-10, y, 10, h, tocolor(0, 0, 0, 200), true);
						dxDrawRectangle(x+w-10, (y+h/totalRows*(scroll)), 10, (h/totalRows*maxItems), tocolor(255, 255, 255, 200), true );
					end
                    -- Set cursorOn variable to the current GridList, if it's selected
                    cursorOn = nil
                    if __isMouseInPosition ( data.x, data.y, data.w, data.h ) then
                        cursorOn = index;
                    end

                    -- Check if there's any selected item
                    local seeFrom   =   data.s;
                    local seeTo     =   ( data.s + data.mi ) - 1;

                    if data.se and data.se <= data.r and data.se >= seeFrom and data.se <= seeTo then
                        local index     =   data.se - ( data.s - 1 );
                        local y2        =   data.y + ( ( index - 1 ) * 25 );

                        -- Draw a rectangle to make it looks like selected
                        dxDrawRectangle ( data.x, ( 30 % data.h ) + y2, data.w, 20, tocolor ( 0, 0, 0, 100 ), data.pg );
                    end

                    -- Is there any column?
                    if #data.i > 0 then
                    local cWidth = 0

                        -- Loop through all columns
                        for cIndex, cData in ipairs ( data.i ) do
                            -- we'll go beyond the GridList width with this column ?
                            if ( ( cWidth + cData.info.width ) <= data.w ) then
                                local x = data.x + cWidth;

                                -- Draw the column title
                                dxDrawText ( cData.info.title, x, data.y, cData.info.width + x, ( 30 % data.h ) + data.y, tocolor ( 255, 255, 255 ), FIT_MODE and ( 1 * SCALE ) or 1, "default-bold", "center", "center", true, true, data.pg, true, true );

                                -- Reset the selected item
                                cData.info.selected = -1;

                                -- Is there any item ?
                                if #cData > 0 then
                                    local seeFrom   =   data.s;
                                    local seeTo     =   ( data.s + data.mi ) - 1;

                                    -- Loop the items
                                    for iIndex = seeFrom, seeTo do
                                        -- There's a row with this index in the current column?
                                        if cData[iIndex] then
                                            local index     =   iIndex - ( data.s - 1 );
                                            local y         =   data.y + ( index * 25 );
                                            local y2        =   data.y + ( ( index - 1 ) * 25 );

                                            -- Check if cursor is on item position
                                            if __isMouseInPosition ( data.x, ( 30 % data.h ) + y2, data.w, 20 ) then
                                                -- Define the mouse-on variable
                                                data.mo = iIndex;
                                            end

                                            -- Draw the item text
                                            dxDrawText ( cData[iIndex]["text"], x, y, cData.info.width + x, ( 30 % data.h ) + y, tocolor ( unpack ( cData[iIndex]["color"] ) ), FIT_MODE and ( 1 * SCALE ) or 1, "default-bold", "center", "center", true, true, data.pg, true, true );
                                        end
                                    end
                                end

                                -- Increase cWidth variable (to draw the columns correctly)
                                cWidth = cWidth + cData.info.width;
                            end
                        end
                    end
                end
            end
        end
    end
, true, "low-5")

 

شكرا لك :)

لكن كيف لو ابي استخدمه خخ

ابي اخليها سكرول بار زي حق الجيو

انت فاهمني ؟ :)

 

Edited by *RayaN-Alharbi.
Link to comment
2 hours ago, *RayaN-Alharbi. said:

شكرا لك :)

لكن كيف لو ابي استخدمه خخ

ابي اخليها سكرول بار زي حق الجيو

انت فاهمني ؟ :)

 

كيف يعني هو ذي حق الجي يو اي 

تدوس بعجلت الماوس اظن ( ذا الي فهمتو من الأكواد )..ي

Link to comment
9 hours ago, #َxLysandeR said:

كيف يعني هو ذي حق الجي يو اي 

تدوس بعجلت الماوس اظن ( ذا الي فهمتو من الأكواد )..ي

حبيبي ابي اقدر اتحكم بالسكرول بارل بماوس 1 يعني اضغط عليه واسحب لتحت او فوق

Edited by *RayaN-Alharbi.
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...