LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   How to dynamically change the window's layout and size in ncurses ? (https://www.linuxquestions.org/questions/programming-9/how-to-dynamically-change-the-windows-layout-and-size-in-ncurses-681685/)

john.daker 11-06-2008 10:19 PM

How to dynamically change the window's layout and size in ncurses ?
 
Hi all
I'm writing a program within ncurses and have no idea how to dynamically change the window's dimensions

I'm using Konsole to exec the program, and when I resize the Konsole, it seems that ncurses dont change the window to fit with Konsole.

So how to dynamically change the window's dimensions ?
What's the technique?

Thanks

jlinkels 11-07-2008 09:13 AM

In a GUI environment, objects send messages to each other, that is, if you resize your web browser, the object displaying the text get a message from the browser frame "Hey I have changed, rebuild the text you are displaying".

If you resize Konsole, the GUI objects will get messages, but not your CLI application. Try it: do a directory listing, resize the window until a part of the text is covered and then enlarge the window again. The text is not redisplayed.

In ncurses you are able to retrieve the screen dimensions. In your program, you should continously monitor these figures, and take appropriate action when they change, that is redraw your application using these new dimensions. This require that you don't have any modal dialogs in your application, or you have to accept that no resize is being performed during display of such a dialog.

jlinkels


All times are GMT -5. The time now is 05:35 AM.