X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=test%2Fdemo_forms.c;h=afa4ed32c22d2e3959d85a824a15b26fc943bb92;hp=a649a5ceb101cbfb465778559c3a5a84ebe00b43;hb=44a4147009bf2978d342175fb52b7f0999e11b5f;hpb=92e187a3459ab7ce1613a3684ca6642447c73620 diff --git a/test/demo_forms.c b/test/demo_forms.c index a649a5ce..afa4ed32 100644 --- a/test/demo_forms.c +++ b/test/demo_forms.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2003-2009,2010 Free Software Foundation, Inc. * + * Copyright (c) 2003-2010,2011 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -26,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: demo_forms.c,v 1.35 2010/05/01 21:56:10 tom Exp $ + * $Id: demo_forms.c,v 1.38 2011/01/15 18:15:11 tom Exp $ * * Demonstrate a variety of functions from the form library. * Thomas Dickey - 2003/4/26 @@ -83,7 +83,7 @@ make_label(int frow, int fcol, NCURSES_CONST char *label) if (f) { set_field_buffer(f, 0, label); - set_field_opts(f, (int) (field_opts(f) & ~O_ACTIVE)); + set_field_opts(f, (int) ((unsigned) field_opts(f) & ~O_ACTIVE)); } return (f); } @@ -216,7 +216,7 @@ my_form_driver(FORM * form, int c) case MY_EDT_MODE: if ((field = current_field(form)) != 0) { set_current_field(form, another_field(form, field)); - if (field_opts(field) & O_EDIT) { + if ((unsigned) field_opts(field) & O_EDIT) { field_opts_off(field, O_EDIT); set_field_status(field, 0); } else { @@ -254,12 +254,14 @@ show_current_field(WINDOW *win, FORM * form) char *buffer; int nbuf; int field_rows, field_cols, field_max; + int currow, curcol; if (has_colors()) { wbkgd(win, COLOR_PAIR(1)); } werase(win); - wprintw(win, "Cursor: %d,%d", form->currow, form->curcol); + form_getyx(form, currow, curcol); + wprintw(win, "Cursor: %d,%d", currow, curcol); if (data_ahead(form)) waddstr(win, " ahead"); if (data_behind(form)) @@ -292,7 +294,7 @@ show_current_field(WINDOW *win, FORM * form) waddstr(win, "other"); } - if (field_opts(field) & O_EDIT) + if ((unsigned) field_opts(field) & O_EDIT) waddstr(win, " editable"); else waddstr(win, " readonly");