nurses menus, and windows.

This is a discussion on nurses menus, and windows. within the C++ Programming forums, part of the General Programming Boards category; Hey, I hope you can help. ive been batteling with this for about 2 days now. I would like to ...

  1. #1
    Registered User xconspirisist's Avatar
    Join Date
    Nov 2003
    Posts
    44

    nurses menus, and windows.

    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

    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
    Many thanks in advance.

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,484
    > I would like it say, at the bottom right of the window.

    Perhaps, change the 0,0 in this call?
    set_menu_position(xc_menu, 0,0);
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User xconspirisist's Avatar
    Join Date
    Nov 2003
    Posts
    44
    Oh, nah. that was just a random function I tried. It doesnt exist. There seems to be loads of set_menu type functions that deal with these menus. But I cant find a list...

    Any other thoughts, anyone ?

  4. #4
    Registered User xconspirisist's Avatar
    Join Date
    Nov 2003
    Posts
    44
    My god, I cant believe no one can answer this ... anyone, help...

  5. #5
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,484
    Well perhaps you should reply with better information than "Oh, nah. that was just a random function I tried. It doesnt exist."
    Like say a complete program which demonstrates the problem, not some random junk you just hacked together.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  6. #6
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,699

    The problem is...

    Most of us have never used that particular menu library you're using. Just test each individual function to make sure that you can work it properly (maybe 4 or 5 test ranges per parameter). Then group the initialization code, the code that alters appearance, graphics code, and so forth into more modular units.
    You could even throw it into a class. Just don't forget to test. And above all, read all the documentation you can (or working code), and keep it at your side at all times (even, better, memorize it).
    Code:
    bool fun(bool value)
    {
        return std::pow(std::exp(1), std::complex<float>(0, 1) 
        * std::complex<float>(std::atan(1)*(1 << (value + 2))))
        .real() > 0;
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Windows XP (and Vista) shiney look and feel
    By lightatdawn in forum A Brief History of Cprogramming.com
    Replies: 25
    Last Post: 09-18-2005, 02:56 PM
  2. Opening Windows from Menus
    By Goonlecker in forum Windows Programming
    Replies: 7
    Last Post: 12-04-2003, 01:45 PM
  3. SDL and Windows
    By nickname_changed in forum Windows Programming
    Replies: 14
    Last Post: 10-24-2003, 12:19 AM
  4. Menu Item Caption - /a for right aligned Accelerator?
    By JasonD in forum Windows Programming
    Replies: 6
    Last Post: 06-25-2003, 11:14 AM
  5. Books on C and C++
    By kermi3 in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-28-2002, 03:18 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21