|
From: | Pablo Cazallas Gonzÿffffe1lez |
Subject: | Re: set_field_back A_BLINK problem |
Date: | Mon, 28 Nov 2011 12:57:28 +0000 (GMT) |
Hi again, When trying to blink a field, if its buffer is longer than 13 bytes (not being filled with any data) the routine "set_field_back" doesn't work, but it still returns E_OK. When doing the same with a field buffer not longer than 13 bytes, it works fine. Here is an example test program that demonstrates it: ============================================================== #include <stdio.h> #include <stdlib.h> #include <string.h> #include <menu.h> #include <form.h> #include <panel.h> #include <ncurses.h> void initNCURSES(); void endNCURSES(); int main(int argc, char *argv[]) { /** *** Variables **/ WINDOW *win; FORM *form; FIELD *campo[3]; PANEL *panel; int doWork = 1; int tecla = -1; /** *** Initializes NCURSES **/ initNCURSES(); /** *** Window creation **/ win = newwin(7, 55, 6, 15); /** *** This field blinks without any problem **/ campo[0] = new_field(1, 13, 2, 19, 0, 0); set_field_back(campo[0], A_BLINK); field_opts_off(campo[0], O_BLANK); /** *** This field does not blink, it seems there is any kind of issue *** changing a field to A_BLINK attribute if it is longer than 13 bytes **/ campo[1] = new_field(1, 34, 3, 19, 0, 0); set_field_back(campo[1], A_BLINK); field_opts_off(campo[1], O_BLANK); /** *** Last field (NULL) of the form **/ campo[2] = NULL; /** *** Prints form **/ form = new_form(campo); set_form_win(form, win); set_form_sub(form, derwin(win, 1, 34, LINES, COLS)); post_form(form); /** *** Prints box **/ box(win, 0, 0); wattron(win, A_REVERSE); mvwprintw(win, 0, 2, " TITLE WIN..."); wattroff(win, A_REVERSE); /** *** Prints literals **/ mvwprintw(win, 2, 1, "Blinking.......: "); mvwprintw(win, 3, 1, "Not blinking...: "); mvwprintw(win, 4, 1, " PF10.- END "); keypad(win, TRUE); /** *** Shows panel **/ panel = new_panel(win); update_panels(); doupdate(); wrefresh(win); form_driver(form, REQ_FIRST_FIELD); /** *** Key handling loop **/ while(doWork) { tecla = wgetch(win); switch(tecla) { case KEY_F(10): doWork = 0; break; case KEY_LEFT: form_driver(form, REQ_PREV_CHAR); break; case KEY_RIGHT: form_driver(form, REQ_NEXT_CHAR); break; case KEY_BACKSPACE: form_driver(form, REQ_DEL_PREV); break; case 9: form_driver(form, REQ_NEXT_FIELD); break; default: form_driver(form, REQ_OVL_MODE); form_driver(form, tecla); break; } /* switch */ } /** *** Free form **/ free_form(form); form = NULL; /** *** Free fields **/ free_field(campo[0]); campo[0] = NULL; free_field(campo[1]); campo[1] = NULL; free_field(campo[2]); campo[2] = NULL; hide_panel(panel); /** *** Clean Screen **/ wclear(win); delwin(win); win = NULL; refresh(); /** *** Ends NCURSES **/ endNCURSES(); /** *** Main return **/ return 0; } void initNCURSES() { setlocale(LC_ALL, ""); initscr(); cbreak(); keypad(stdscr, TRUE); nodelay(stdscr, FALSE); nonl(); noecho(); curs_set(FALSE); refresh(); } void endNCURSES() { curs_set(TRUE); clear(); echo(); refresh(); endwin(); } ============================================================== I'm getting almost crazy with this issue, so any help or suggestion will be appreciated. Thanks again, and regards, Pablo. LRU #493328 --- El vie, 25/11/11, Thomas Dickey <address@hidden> escribió:
|
[Prev in Thread] | Current Thread | [Next in Thread] |