Available in:
Apps (win)
Apps (char)
Reportwriter
RPC
Standalone PL
X
void list_edit(list-name[,trigger-name[,menu-item1[, ...]]]) list list-name trigger trigger-name string menu-item1
list-name | specifies the list to edit.
| |||||||||||||||
trigger-name | (optional) specifies the user-written trigger to invoke for
customized editing function control.
list_edit invokes the trigger with four parameters:
| |||||||||||||||
menu_item1, menu_item2, ... |
specifies the names of items you can specify in the default User in the
menu bar. If you don't specify any items, then the menu item is a single
callback event, list_edit_user.
If you define and list some menu_items, then the events are specified as list_edit_user, list_edit_user+1, etc. By returning data of different types (for example, int or char), you can control if a single field is to be updated or the whole grid, which in the Edit window is defined as 128 rows by 256 columns. |
Event code | What |
---|---|
list_edit_change | Updates field (subject to legal conversion) |
list_edit_insert | Adds blank row before current row |
list_edit_append | Adds blank row after current row |
list_edit_dup | Duplicates current row |
list_edit_delete | Deletes current row |
list_edit_more | Nothing |
list_edit_user list_edit_user+1 ... | Nothing |
Command | Action |
---|---|
[Enter] | Enters the edit field and invokes the callback trigger the list_edit_change option if the data has changed. |
[Home]* | Moves the first page of the list into the grid with row 0, column 0, as the active position. |
[PgUp]* | Moves a new page into the grid. |
[PgDn]* | This function requires a trigger to handle the action. If you haven't specified a trigger, [PgDn] does nothing. Moves a new page into the grid. If not enough new rows exist in memory and the list_eos() is false then, it needs a callback trigger (that you have provided) with the list_edit_more option, to fetch more data into memory. |
[End]* | The last page of the list is moved into the grid. If list_eos() is false then a trigger (that you have supplied) is invoked with the list_edit_more option. The last column of the last row becomes the active item. |
[Tab] | Completes any edits and moves the cursor to the next column in the current row, making it active. It remains in a row and when it reaches the last column, wraps to the first column in the same row. |
[Shift,Tab] | Completes any edits and moves the cursor to the previous column in the current row, making it active. It remains in a row and when it reaches the first column, wraps to the last column in the same row. |
[Down] | Moves the cursor to the next row, making it active. When the end user reaches the last row of the page, it stops. |
[Up] | Moves the cursor to the previous row, making it active. When the end user reaches the first row in the page, it stops. |
/* ** A simple table list editor */ { list LL; char ss[256]; trigger tt = { if (parm.1 == list_edit_change) return(parm.3); if (parm.1 == list_edit_delete) { list_mod(parm.0,0); return(1); } if (parm.1 == list_edit_more) { list_more(parm.0,1000,false); return(1); } if (parm.1 == list_edit_user+0) return(upper(parm.3)); if (parm.1 == list_edit_user+1) return(lower(parm.3)); if (parm.1 == list_edit_user+2) { int i; i = to_int(prompt("How many rows so you want to delete?")); while (i > 0) { list_mod(parm.0,0); i--; } return(1); } return(-1); }; while (true) { ss = prompt("Enter table name"); if (ss == NULL) break; if (trap( { LL = list_open("select * from " ^^ ss,1000); } )) prompt(error_msg()); else list_edit(LL,tt,"Uppercase","Lowercase","DeleteManyRows"); } }