Page 1 of 1

[Solved] Refreshing the menu using ZForms

PostPosted: Thu Jul 29, 2021 2:00 pm
by Jarewill
Recently I started using ZForms for making my custom menus, however I have encountered a small problem.
I don't know how to refresh the current menu so it would get redrawn.

My use case is drawing an inventory and letting the player discard items from it, however when the item is discarded, it remains in the inventory and causes a VM abort.
I currently use Init(mParentMenu) to do it, and while it works, it also breaks all the buttons and makes the menu unusable.
I also tried putting the item drawing function into Ticker() instead of Init(), but that also broke the buttons, only giving the player a very tiny window when they are usable.

Does anyone here know how should I approach this situation?

Edit: Okay, I managed to fix this by replacing Init with SetMenu and waiting 1 tic before doing that, so a network event passes.
For those curious:
Code: Select allExpand view
    bool restartint restimer;
Override void Ticker()
Override void Init(Menu parent)
let parmnu ZFMenuBase(parent);