cli_del()

Deletes the specified item from the choice list

Call  
#include <vv_clist.h>
int cli_del(item_num, clistp)

int item_num

Number of item to delete from choice list

CLISTPTR clistp Choice list from which to delete item
Returns  
1 The item was deleted from the choice list
0 Error. VV_ERR is set to one of the following:
  KWDNOTFOUND

ERRREAD

FILETOOBIG

The keyword marking the choice list was not found in the memory file.

An error occurred while trying to read the memory file.

The keyworded section used by the choice list is too large to fit in the memory file.

Description

cli_del() first calls mf_kwdset() to set the memory file to operate within the section marked by the choice list's keyword. mf_rowdel() is called to delete the item from the choice list.

If the deleted item precedes the currently active item, the number of the active item is decremented so that the item remains current. In addition, the origin of the memory file in the choice list window and the choice list window's virtual cursor are adjusted to ensure that the highlight bar lies on the same item after the deletion.

If the deleted item is visible within the window, a flag is set to ensure that the choice list is updated on the screen.

If a keyword was set prior to calling this function, the memory file is restored so that it operates on the keyworded section that was active when cli_del() was called.

Related Functions

cl_itemq(), cli_ins(), cli_rpl()

Cautions

cli_del() should not be called from an event function if there is only one item in the choice list. In this case, cli_del() would delete the one item in the choice list and there would be nothing left to be presented when the choice list is called again. You can use cl_itemq() to determine the number of items in the choice list.

If you delete the current item with cli_del(), use scl_curnum() to set the new item number.


Home Contents Previous Next