h6. [[WindowManager]] h6(. » [[WindowManager SWI Calls|SWI Calls]] h6((. » Wimp_GetMenuState h2. Wimp_GetMenuState h5. (SWI &400F4) |_<. Entry | | |<^. R0 |0 => return the current menu tree state, or | | |1 => report tree leading up to, but not including, a window/icon pair | |<^. R1 |Pointer to buffer for result| |<^. R2 |Window handle of menu (if R0 =1) | |<^. R3 |Icon handle of entry in menu (if R0 = 1) | |_<. Exit | | |<^. R0| Corrupt | |<^. R1 |Returned values in buffer | h4. Use The purpose of this call is to return the selected menu item and the sub-menus used. This is called the 'menu tree'. h4. Notes The buffer is filled with a list of numbers in the same format as returned by [[Menu_Selection|Menu_Selection]] by [[Wimp_Poll|Wimp_Poll]]. The buffer is terminated with the value of -1. The buffer will return null (-1) if: * R0 =1 and window or icon handle in R2/R3 is not in the tree, or * R0 = 0 and the menu belongs to another application, or has been closed. If the window is a dialog box, the list of sub-menus used will not include the dialog box. h4. See also * [[Wimp_Poll|Wimp_Poll]] * [[Menu_Selection|Menu_Selection]]