Skip to content

Upgrading from NativeUI

Hannele Ruiz edited this page Jan 2, 2021 · 7 revisions

Upgrading from NativeUI to LemonUI is pretty straight forward. Most of the classes present on NativeUI are implemented on LemonUI with slight variations.

If a feature that you use in NativeUI is missing on LemonUI, create a new issue to take a more in depth look.

TL;DR

NativeUI Classes LemonUI Class Additional Info
NativeUI.MenuPool LemonUI.ObjectPool Object Pools support any class that implements LemonUI.IProcessable.
NativeUI.TimerBarPool LemonUI.TimerBarCollection N/A
NativeUI.UIMenu LemonUI.Menus.NativeMenu N/A
NativeUI.InstructionalButton LemonUI.Scaleform.InstructionalButton N/A
NativeUI.BigMessageHandler LemonUI.Scaleform.BigMessage LemonUI.Scaleform.BigMessage needs to be created with specific parameters for the message that you want to use.
NativeUI.Elements.NativeElement LemonUI.Elements.BaseElement LemonUI.Elements.BaseElement is an abstract class, unlike NativeUI.Elements.NativeElement.
NativeUI.Elements.NativeRectangle LemonUI.Elements.ScaledRectangle N/A
NativeUI.Elements.NativeSprite LemonUI.Elements.ScaledTexture N/A
NativeUI.Elements.NativeText LemonUI.Elements.ScaledText N/A
NativeUI.Elements.TextAlignment LemonUI.Alignment (SHVDN 2 Only) Use CitizenFX.Core.UI.Alignment on FiveM and GTA.UI.Alignment on SHVDN3.
NativeUI.IListItem LemonUI.Menus.ISlidableItem Completely different interface fields, but provides the same features overall.
NativeUI.UIMenuItem
NativeUI.UIMenuColoredItem
LemonUI.Menus.NativeItem N/A
NativeUI.UIMenuCheckboxItem LemonUI.Menus.NativeCheckboxItem N/A
NativeUI.UIMenuListItem LemonUI.Menus.NativeListItem You need to specify the type of object that the menu item will store (NativeListItem<T>). The name is fetched from the T.ToString() function.
NativeUI.UIMenuDynamicListItem LemonUI.Menus.NativeDynamicItem You need to specify the type of object that the menu item will store (NativeDynamicItem<T>). The name is fetched from the T.ToString() function.
NativeUI.UIMenuSliderItem LemonUI.Menus.NativeSliderItem N/A
NativeUI.UIMenuDynamicListItem.ChangeDirection LemonUI.Menus.Direction N/A
System.ComponentModel.CancelEventHandler LemonUI.CancelEventHandler (FiveM Only) Only in FiveM, where System.ComponentModel.CancelEventHandler is not implemented, see https://forum.cfx.re/t/1415267/2 for more information.
System.ComponentModel.CancelEventArgs LemonUI.CancelEventArgs (FiveM Only) Only in FiveM, where System.ComponentModel.CancelEventArgs is not implemented, see https://forum.cfx.re/t/1415267/2 for more information.

Object Pools

All of the NativeUI Pools have been replaced by LemonUI.ObjectPool. They behave almost the same and support any item that implements LemonUI.IProcessable.

The only difference is that you can't access the menu related options on the Pool, unless you use LemonUI.ObjectPool.With<NativeMenu>.

MenuPool Field/Property/Function LemonUI Replacement
MouseEdgeEnabled NativeMenu.RotateCamera
ControlDisablingEnabled None
ResetCursorOnOpen NativeMenu.ResetCursorWhenOpened
FormatDescriptions None (Descriptions are formatted automatically)
AUDIO_LIBRARY See the other AUDIO_* Properties below
AUDIO_UPDOWN NativeMenu.SoundUpDown
AUDIO_UPDOWN NativeMenu.SoundUpDown
AUDIO_SELECT NativeMenu.SoundActivated
AUDIO_BACK NativeMenu.SoundClose
AUDIO_ERROR NativeMenu.SoundDisabled
WidthOffset NativeMenu.Offset.Width
CounterPretext None
DisableInstructionalButtons NativeMenu.InstructionalButtons.Enabled
BannerInheritance None
OffsetInheritance None
AddSubMenu(UIMenu, string)
AddSubMenu(UIMenu, string, Point)
AddSubMenu(UIMenu, string, string)
AddSubMenu(UIMenu, string, string, Point)
NativeMenu.AddSubMenu(NativeMenu)
RefreshIndex() None (Index Refreshing is done automatically)
ToList() None
ProcessControl()
ProcessKey(Keys)
ProcessMouse(Keys)
None (Control Processing is done on the IProcessable.Process() implementation of each item)
Draw() None (Drawing is done on the IProcessable.Process() implementation of each item)
IsAnyMenuOpen() ObjectPool.AreAnyVisible
ProcessMenus() NativeMenu.Process()
CloseAllMenus() ObjectPool.HideAll()
SetBannerType(NativeSprite)
SetBannerType(IRectangle)
SetBannerType(string)
NativeMenu.Banner
SetKey(MenuControls, Control)
SetKey(MenuControls, Control, int)
SetKey(MenuControls, Keys)
None
ResetKey(MenuControls) None
Clone this wiki locally