Updating a Memory File Displayed in a Window

You can perform many operations on a memory file while it is displayed in the window—including modifying the contents, searching, writing the contents to disk, sorting, and adding lines. You can even reset the keyword section that the memory file is supposed to operate on. You can do this in code or via event functions during mf_browse(). However, any changes in the contents of the memory file will not be updated in the window unless the memory file is redisplayed in the window with a call to mf_disp(), or wn_upd(), or is uncovered. If the change is made to a part of the memory file that is not currently displayed, there is no need to redisplay the memory file in the window.

The calling sequence for wn_upd() is:

void wn_upd(wnp)

WINDOWPTR wnp;

Specify the window associated with the memory file for wnp.

The calling sequence for mf_disp() is:

void mf_disp(wnp)

WINDOWPTR wnp;

Specify the window associated with the memory file for wnp.

If you are operating on the memory file in the code, you must call mf_disp() or wn_upd() whenever you change the part of the memory file that is already displayed in the window. The difference between the two functions is the way that they handle the physical cursor. mf_disp() checks the window options and calls csr_plwn() to put the physical cursor back into the window. wn_upd() does not. If you call wn_upd(), it is your responsibility to call csr_plwn() to restore the physical cursor if it should be visible.

For instance, if the entire memory file is displayed and you sort the memory file, the sequence of function calls to sort and redisplay the memory file would be as follows:

...

...

sw_mf(mfp, wnp);

wn_up(wnp);

mf_disp(wnp);

mf_sort(mfp);

mf_disp(wnp);

...

...

mf_browse() calls mf_disp() whenever the user causes the origin of the window in the memory file to change by scrolling through the memory file. If you change the contents of the memory file from within an event function but do not change the origin of the window within the memory file, you must call mf_disp(), wn_upd() or wn_updrgn() in the event function to redisplay the memory file.


Home Contents Previous Next