bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Scroll in new CDK


From: Fu Steve X
Subject: Scroll in new CDK
Date: Fri, 6 Jan 2006 09:03:13 -0500

I found that the co-existing of a Label and a Scroll on the same cdkscreen causes some weird behavior of the highlighting in the scroll.

In the test program below, pressing ENTER key pops up/down a label and triggers the cdkscreen to refresh. After such a refresh, the item in the scroll that is used to be highlighted looses its highlighting. It stays like that when arrowing up and down. But the highlighting is back to normal if the label is commented out.

Thanks.


Steve Fu

----------------------------------  cut here ----------------------

#include <cdk.h>

static int enterCB (EObjectType cdktype GCC_UNUSED, void *object,
                      void *clientData GCC_UNUSED,
                      chtype input GCC_UNUSED)
{

   CDKSCROLL *s = (CDKSCROLL *)object;
        char *msg[3] = {
                "<C> ",
                "<C>                         press any key to continue       ",
                "<C> "};
       
        popupLabel(ScreenOf (s), msg, 3);

        return (TRUE); 
       
}

/*
 * This program demonstrates the Cdk scrolling list widget.
 */
int main (int argc, char **argv)
{
   /* Declare variables. */
   CDKSCREEN *cdkscreen = 0;
   CDKSCROLL *scrollList = 0;
   CDKLABEL *lbl = 0;
   WINDOW *cursesWin = 0;
   char **item = 0;
        char *temp[1];
   char *msg[1] = {"this label messes up scroll highlight"};
   int selection, count;

   CDK_PARAMS params;

   CDKparseParams (argc, argv, &params, "cs:t:" CDK_CLI_PARAMS);

   /* Set up CDK. */
   cursesWin = initscr ();
   cdkscreen = initCDKScreen (cursesWin);

   /* Set up CDK Colors. */
   initCDKColor ();

   /* Use the current diretory list to fill the radio list. */
   count = CDKgetDirectoryContents (".", &item);

        /* This label illustrates the confliction with scrollList
*/
        lbl = newCDKLabel ( cdkscreen,
      CDKparamValue(&params, 'X', CENTER),
      0,
      msg, 1,
      FALSE,
      FALSE
      );

   /* Create the scrolling list. */
   scrollList = newCDKScroll (cdkscreen,
                              CDKparamValue (&params, 'X', CENTER),
                              CDKparamValue (&params, 'Y', CENTER),
                              CDKparsePosition(CDKparamString2(&params, 's', "RIGHT")),
                              CDKparamValue (&params, 'H', 10),
                              /* CDKparamValue (&params, 'W', 50), */
                              CDKparamValue (&params, 'W', 78),
                              CDKparamString2(&params, 't', ""),
                              CDKparamNumber(&params, 'c') ? 0 : item,
                              CDKparamNumber(&params, 'c') ? 0 : count,
                              FALSE,
                              A_REVERSE,
                              CDKparamValue (&params, 'N', TRUE),
                              CDKparamValue (&params, 'S', FALSE));


   bindCDKObject (vSCROLL, scrollList, KEY_ENTER, enterCB, NULL);

        refreshCDKScreen(cdkscreen);

        traverseCDKScreen(cdkscreen);

   /* Clean up. */
   destroyCDKScroll (scrollList);
   destroyCDKScreen (cdkscreen);
   endCDK ();
   exit(EXIT_SUCCESS);
}


reply via email to

[Prev in Thread] Current Thread [Next in Thread]