Log in to reply
 

[Resolved] Any NativeUI experts in here? I need UIMenuListItem help if possible.



  • I've asked this same question on GTAForums in the hope that one of them provides a solution.

    My problem is this... I have a menu with two UIMenuListItem controls on it. When I change the first one, I want the contents of the second one to change based on what the first one changed to.

    To put it into an easier to understand context... Imagine you have a list that is for all the vehicle classes in the game. The second List item contains all the vehicles from that specific class. So when you change the class of the first item, all the vehicles need to change to reflect that class.

    This isn't what I am working on btw, I am just putting it into a context that is easy to relate to.

    No matter what I try, the second list refuses to change the contents, so I am wondering if I am barking up the wrong tree completely and doing that just isn't possible. I do have another solution(s) but it's a hack and I hate having to hack solutions into things, if there is a proper way to do this.

    Just to point out the other solutions in case anyone is thinking of suggestion one of the ones I already know about...

    1. Use a standard UIMenuItem control for the second List and just change the Text property when you press left and right when it is selected.
    2. Instead of using separate Lists, use one big one and store a table of boundaries for each section, based on the contents of the first list, that sets and manages the index property. That's a really messy solution because if an item gets added or removed, all of the boundaries get affected... that really is a hack.

    Both of them are possible but I'd like to consider the proper solution before using one of those... if there is one.



  • @Guadmaz You are the best one who know this things :D



  • @yeahhmonkey That's a good idea in theory but probably a waste of time. I have discovered that the only way to find out things about these libraries is to get the source and fix things yourself... as I have done with this.

    This simple bit of code makes it work how I want it to work, I have no idea why it wasn't already there. I now have a dynamic UIMenuListItem :) I just need to work out how to make the whole menu wider to cater for the extended width I need,

    public List<dynamic> List
    {
    	get { return _items; }
    	set { _items = value; }
    }
    

    This is the second modification I have made to NativeUI, the problem is, only I have them so I can never release mods that use them. But it gives me a more flexible system to create testbed mods, so it's worth it for me.



  • @LeeC2202 fork it on Git and have your addition added to the Core, help make tools better :)



  • @Tanjitsu I mentioned previous ideas to the author and didn't get much interest in return, so I just keep them in my own version. I have never used Git for that and didn't want to mess about learning for something that the author didn't seem interested in. :expressionless:

    I have another control much like the Windows numeric up-down control added which I find really useful... I don't release mods with menus in them so it's not too bad, it just helps me build testbed mods easier. :slight_smile:



  • I added a pull request for

    public List<dynamic> List
    {
    get { return _items; }
    set { _items = value; }
    }

    In the version 3 branch as i too needed this for a menu feature.
    I would hope the pull is accepted and this will be available in future versions.



  • @Tanjitsu Excellent... you can do so much more with lists with that simple addition. :slight_smile:



  • @LeeC2202 If you need anything else i would be happy to submit additions for you.
    The simple get set option was all i needed :)



  • @Tanjitsu Thank you, that is very generous.

    Because I am by profession an artist rather than coder, I am always concerned that my code might not be anywhere near an acceptable standard for something produced by a dedicated coder, so I tend to avoid submitting changes out of fear of doing something really bad.

    If I break something in my own version, or don't do something quite right, it's not so bad. But the last thing I want, is to give the owner of the project headaches trying to figure out my code. :blush:



  • @LeeC2202 Haha, there is always someone who is a better.
    But scripts usually become better with community input.

    I would suggest that if your code is clean and has a valid function it's worth submitting.

    If the code has issues or is unreadable your submission will prob be denied, at which point you can then post it on somewhere like this, or create a GIT question and ask for help cleaning / correcting the solution.



  • @Tanjitsu I'll dig out my code for the UIMenuIncDecItem that I added, I find that very useful for my test mods.

    It basically lets you set a Minimum and Maximum value that you can change it's value between and you define a Step parameter that decides how big the increments or decrements are. If you've used the windows NumericUpDown control, it's exactly like that.

    I wrote it when I saw that MapEditor was defining a list of something like 100,000 values, so it could move something by 0.01 units in the map.


Log in to reply
 

Looks like your connection to GTA5-Mods.com Forums was lost, please wait while we try to reconnect.