Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualiGoogleThis

Posted 18 April 2013 - 04:07 PM

This is an edit to a previous post I had up here asking for help on this topic.  Since I figured out what the hell was up I thought I'd share my finding in hopes of providing an obvious and straight-forward approach for some other frustrated soul.  After a weeks worth of a headache, the answer to right side alignment was to calculate the max x coordinate minus the window size. In my case, window size was 25, in turn the drawn window overshot the standard screen by 25 ich happens with (n, PD)curses, you can try bitshifting to some degree of success but it depends on what you're trying to accomplish. I needed a very specific sized window with specific placement. So, I had to take a step back and find a second obvious approach. Here's the function as it stands now:

 

void eventfeed(void)
{
    int maxy, maxx, newx;

    getmaxyx(stdscr, maxy, maxx);

    newx = maxx - 25;

    refresh();
    WINDOW *feed;
    feed = newwin(0, 25, 0, realx);

    box(feed, 0, 0);
    wrefresh(feed);
}

 

This aligns a 25 character window to the right side of a curses terminal, God speed.


#3iGoogleThis

Posted 16 April 2013 - 02:44 AM

This is an edit to a previous post I had up here asking for help on this topic.  Since I figured out what the hell was up I thought I'd share my finding in hopes of providing an obvious and straight-forward approach for some other frustrated soul.  After a weeks worth of a headache, the answer to right side alignment was to calculate the max x coordinate minus the window size. In my case, window size was 25, in turn the drawn window overshot the standard screen by 25 ich happens with (n, PD)curses, you can try bitshifting to some degree of success but it depends on what you're trying to accomplish. I needed a very specific sized window with specific placement. So, I had to take a step back and find a second obvious approach. Here's the function as it stands now:

 

void eventfeed(void)
{
    int maxy, maxx, newx;

    getmaxyx(stdscr, maxy, maxx);

    newx = maxx - 25;

    refresh();
    WINDOW *feed;
    feed = newwin(0, 25, 0, halfx);

    box(feed, 0, 0);
    wrefresh(feed);
}

 

This aligns a 25 character window to the right side of a curses terminal, God speed.


#2iGoogleThis

Posted 13 April 2013 - 12:57 AM

Hey GD. I'm having an issue with getting a window to display on the rightmost side of the screen using ncurses. I just can't wrap my head around how, maybe it's a sleep thing. I got as far as using getmaxyx to determine the size of the stdscr(terminal width/height) but I just can't figure out how to get it over to where it needs to be, it ends up everywhere but there. Here's the function:
 

void eventfeed(void)
{
int maxy, maxx, halfy, halfx;

getmaxyx(stdscr,maxy,maxx);

halfx = maxx >> 1; //Not even sure if I should keep this here

refresh();
WINDOW *feed;
feed = newwin(maxy, 25, 0, halfx);

box(feed, 0, 0);
wrefresh(feed);
} 

 



Which get's it close,  but I need it on the edge of the screen. I know how to bind the window to the maximum height but I just can't get it over to the farthest right side.  This is written in C.


#1iGoogleThis

Posted 13 April 2013 - 12:54 AM

Hey GD. I'm having an issue with getting a window to display on the rightmost side of the screen using ncurses. I just can't wrap my head around how, maybe it's a sleep thing. I got as far as using getmaxyx to determine the size of the stdscr(terminal width/height) but I just can't figure out how to get it over to where it needs to be, it ends up everywhere but there. Here's the function:
 

void eventfeed(void)
{
int maxy, maxx, halfy, halfx, nmaxy, nmaxx;

getmaxyx(stdscr,maxy,maxx);

halfx = maxx >> 1;

refresh();
WINDOW *feed;
feed = newwin(maxy, 25, 0, halfx);

box(feed, 0, 0);
wrefresh(feed);
} 

 



Which get's it close,  but I need it on the edge of the screen. I know how to bind the window to the maximum height but I just can't get it over to the farthest right side.  This is written in C.


PARTNERS