Skip to content

finite_button_delete

The finite_button_delete function removes a FiniteBtn from a FiniteShell, freeing its memory and maintaining the integrity of the FiniteShell.btns array.

void finite_button_delete(FiniteShell *shell, int id);
TypeDescription
FiniteShell *shellThe shell containing the button to delete.
int idThe id of the button to delete in the shell’s button array.
FiniteBtn *btn = finite_button_create(shell, select_cb, NULL, NULL, NULL);
FiniteBtn *btn2 = finite_button_create(shell, select_cb, NULL, NULL, NULL);
finite_button_delete(shell, 1);

The shell must be valid and contain the button to delete.

id must be within the range of existing buttons (0 to shell->_btns - 1).

After deletion, all buttons after the removed one are shifted to maintain contiguous indexing.