[Release][Dev] NativeUILua

function AddMenuAnotherMenu(menu)
    local submenu = _menuPool:AddSubMenu(menu, "Another Menu")
    for i = 1, 2, 1 do
        submenu:AddItem(NativeUI.CreateItem("PageFiller", "Sample description"))
    end
    
    local othermenu = _menuPool:AddSubMenu(submenu, "Other Menu")

    for i = 1, 2, 1 do
        othermenu:AddItem(NativeUI.CreateItem("OtherMenu", "Sample description"))
    end

end
1 Like

Ok, thanks! :slight_smile:
(20 chars)

Thank you for you’r sharing!

need more example…

how to set right label at sub menu???
like “>>” to mark this is a sub menu…

and how to create a dynamic menu…
like “online player”…

thanks…

Time for me to sit down and try to learn how to create a menu from NativeUI. Been looking for a way to make a LEO/CIV toolbox with basic animations and such.

2018-05-02%2021_17_11-Window

Hmm :thinking:

The menu description needs boundaries

1 Like

Noice

1 Like

how can i use this to change es_extended default menu graphics

How am I gonna assign a function to a certain Item such as

function AddMenuVehicle(menu)
    local submenu = _menuPool:AddSubMenu(menu, "Vehicle")
    for i = 1, 10, 1 do
        submenu:AddItem(NativeUI.CreateItem("Lock Vehicle", ""))
		LockVehicle()
    end
end
function AddMenuVehicle(menu)
    local submenu = _menuPool:AddSubMenu(menu, "Vehicle")
    for i = 1, 10, 1 do
    	local Item = NativeUI.CreateItem("Lock Vehicle", "")
    	Item.Activated = function(ParentMenu, SelectedItem)
    		--Do stuff
    		LockVehicle()
    	end
        submenu:AddItem(Item)
    end
end
1 Like

How would we go around using UIMenuItem:RightLabel() ?

Using it results in

@NativeUI/NativeUI.lua:823: attempt to index a nil value (field ‘Label’)

whilst when for example using UIMenuListItem:RightLabel() it returns

@NativeUI/NativeUI.lua:1135: This item does not support a right label

				local UpgradeItem = NativeUI.CreateItem("Purchase slot", "A slot in the garage that you can purchase?")
				UpgradeItem:RightLabel("$"..math.floor(SlotPrice))
				UpgradeItem.Activated = function(ParentMenu, SelectedItem)
					if SelectedItem:Enabled() then
						SelectedItem:Enabled(false)
						table.insert(DisabledItems, SelectedItem)
						TriggerServerEvent("Garages.Upgrade", Type, GarageId)
					end
				end

Here’s a snippet from one of my scripts

1 Like

Im using an 32:9 ultrawide (3840x1080) and the nativeUI is going crazy…
any idea where i can adapt the nativeUI for resolution like mine?

got screenshots? and are you using the latest version?

here are 2 screenshots… i didnt made them from my whole screen… to save you from eye cancer haha
my friends with normal screens dont have this issue ofcourse…
its because of my resolution…but is there any fix possible? (i have access to the script, as i am the admin of the server)

edit:
yes im using the latest version

got to do with display setting maybe… did u check safezone

ofcourse its because of my resolution… i have the issue (or some comparable ones) with most of the scripts, as you can see, the normal UI is also in the middle of my screen… but i dont care about that.
but that i cannot read the menu cleary is an issue for me …

but what do you mean with safezone?

look in settings safezone moves radar and stuff left or right of the screen… … don’t really know how to explain just look for safezone and u will know what i mean…

as urs looks like its in middle safezone might move the radar and others left of screen and right

the funny text and trainer may get fixed too if not i don’t know

I was wondering how to use the ListSelected function here is how I tried it

menu.OnListSelected = function(sender, item, index)
        if item == genderItem then
        	Gender = item:IndexToItem(index)
            base.ShowNotification("Selecting ~b~" .. Gender .. "~w~...")
        end
    end

Fixed this by changing it to

genderItem.OnListSelected = function(sender, item, index)
        if item == genderItem then
        	Gender = item:IndexToItem(index)
            base.ShowNotification("Selecting ~b~" .. Gender .. "~w~...")
        end
    end