Hey, I hope you can help. ive been batteling with this for about 2 days now.
I would like to create a menu at a specific position within a window. At the moment it just creates the menu, and places it at the upper left corner of the window. I would like it say, at the bottom right of the window. How could I do this ?
I've posted a bit of code below, i've commeneded myself on what I think most of the functions do, however, im not completly sure. This is only a bit of code from the program - if you need more bits, just ask
Many thanks in advance.Code:int number_choices, i; ITEM **my_items; number_choices = ARRAY_SIZE(items); // how many choices do we have in the CHOICES variable, load this into number_choices my_items = (ITEM **)calloc(number_choices + 1, sizeof(ITEM *)); // create menu items depending on number_choices, if we have 4 choices, we make 4 items. for(i = 0; i < number_choices; ++i) // while ' i ' is under number of choices we have, add 1 to i, and add a new item { my_items[i] = new_item(items[i], items[i]); // assign these new items to the text choices. } xc_menu = new_menu((ITEM **)my_items); // create and print the menu from the items, that have just been assigned their choices text xc_window=newwin(w,x,y,z); // create a new window, for our new menu keypad(xc_window, TRUE); // enable keyboard selection for our new window set_menu_win(xc_menu, xc_window); // put the menu window the window set_menu_sub(xc_menu, derwin(xc_window, 1, 1, 5,1)); // what the $$$$ does this do ? set_menu_mark(xc_menu, ">> "); // put a pretty selection thingy on. set_menu_position(xc_menu, 0,0); wbkgd(xc_window,COLOR_PAIR (4) ); // colorize the new window box(xc_window,ACS_VLINE,ACS_HLINE); // border the new window post_menu(xc_menu); // print the menu wrefresh(xc_window); // print the window



LinkBack URL
About LinkBacks



