Log in to reply

[SOLVED] NativeUI Parent, Child menu processing.

  • Does anyone have any experience with parent/child menus in NativeUI at all. I had a look at the documentation for a sample but that's a bit like going to the Sahara Desert to get a snow sample. :D

    I mean, there's this OnMenuChange (UIMenu sender, UIMenu nextMenu, bool forward)

    So you think, oh, that's fine then, I can just trigger a Menu.Change() event and that will handle it for me... except there is no Menu.Change() event and absolutely no indication of what triggers that event. :rolling_eyes: So you look in the docume... you get my point? I can't see the point in creating libraries that you can't be bothered to document... it's a major pet peeve of mine.

    Normally I only have a single menu in any mod I have written but my current mod is best suited to nested (parent/child) menus, so if anyone can offer any enlightenment, I would be more than grateful to hear.

    Edit: Doh! It seems Snow in the Sahara desert is in fact more likely than getting a useful code sample. ;)

    alt text

  • @Frazzlee I have a Main Menu, from that I would like to have a Camera Menu that appears, which then closes the Main Menu. From the Camera Menu, I have an Environement Menu, that closes the Camera Menu when that appears.

    If I exit back out of the Environment Menu, the Camera Menu comes back and if I exit the Camera Menu, I end up back at the Main Menu.

    It's a fairly standard nested menu system, that NativeUI appears to support, I just have no idea how to implement it.

  • Use BindMenuToItem.
    So you have a main menu first define a button.
    private UIMenuItem GotoCamMenuButton;
    Then add to main menu.
    mainMenu.AddItem(GotoCamMenuButton= new UIMenuItem("GotoCamMenu", ""));
    Then bind. after you create your cam menu.
    mainMenu.BindMenuToItem(CamMenu, GotoCamMenuButton);

  • @aimless Ah... thank you.

    Interestingly, I was just about to post to say I had sorted this with the OnMenuChange() event by manually calling that in a MeniItem.OnItemSelect() Event.

    Your method seems to tie in better with what the documentation hints at, so it is more likely to be the correct way to do things... thank you. :slight_smile:

  • No problem.

  • @aimless Turns out that's what triggers the OnMenuChange() event as well, so that's all up and running perfectly now. :)

Log in to reply

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