Thread: Positioning of Text under Graphical Environment

  1. #1
    Registered User
    Join Date
    Dec 2008
    Posts
    36

    Exclamation Positioning of Text under Graphical Environment

    Using C++, how can we precisely display text/strings on the screen exactly where we want to?

    I am writing a very long C++ program, of course by making use of my own functions or sub routines, to make a game. I have this particular scenerio in question here:

    Code:
    Menu Options
    
    [1] New
    [2] Open
    [3] View All
    [4] Go to Main Menu
    
    Select your choice [1/2/3/4]:
    The pieces of text shown above are displayed in colors on the user screen having background color as well. The problem arises when we select the option# 4 which simply returns control to the parent Menu. The presented screen is removed and the previous one is displayed. But the text then is not displayed precisely in the center of the screen. The menu options are bottom aligned as if they were being pushed up from the bottom.

    Note: I am using
    Code:
    cout<<
    to output the texts.

    Can you show me a better way to accomplish the task?


    Please, also note that whenever an option is selected the presented screen is to be removed and another screen is to be shown on the user screen.

    There is one more problem to it, when an option number is entered via keyboard, it is not displayed just infront of the prompt:
    Code:
    Select your choice [1/2/3/4]:
    Instead, it is put arbitrarily anywhere which seems to be crazy.


    N.B.: Platform: Windows XP (DOS Console)
    Last edited by devarishi; 03-17-2009 at 03:15 PM.

  2. #2
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    on *nix ncurses, not sure about the ++
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  3. #3
    apprentiCe
    Join Date
    Oct 2008
    Location
    Hyderabad,India
    Posts
    136
    use a standard compiler like gnu-C++ and use this library (as suggested by MK27)
    http://opengroup.org/onlinepubs/0079.../curses.h.html
    Last edited by creeping death; 03-17-2009 at 02:21 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. struct question
    By caduardo21 in forum Windows Programming
    Replies: 5
    Last Post: 01-31-2005, 04:49 PM
  2. Appending text to an edit control
    By dit6a9 in forum Windows Programming
    Replies: 3
    Last Post: 08-13-2004, 09:52 PM
  3. Text positioning and Text scrolling
    By RealityFusion in forum C++ Programming
    Replies: 3
    Last Post: 08-13-2004, 12:35 AM
  4. Scrolling The Text
    By GaPe in forum C Programming
    Replies: 3
    Last Post: 07-14-2002, 04:33 PM
  5. Replies: 1
    Last Post: 07-13-2002, 05:45 PM

Tags for this Thread