[ Curses::UI ] How to make application resize itself to size of terminal?

V

Vlad Tepes

Hi all!

I'm learning to make text-mode user interfaces with Curses::UI and
I have trouble making my applications resize themselves if the size
of the terminal changes. It would be great if someone could provide
tips on what I need to do.
 
T

Tassilo v. Parseval

Also sprach Vlad Tepes:
I'm learning to make text-mode user interfaces with Curses::UI and
I have trouble making my applications resize themselves if the size
of the terminal changes. It would be great if someone could provide
tips on what I need to do.

Back from my days when I used (n)curses from C, I remember having
defined a signal-handler for SIGWINCH (which should be triggered upon
resizing the terminal window). This should work likewise in Perl:

$SIG{ WINCH } = sub {
# do whatever is needed to refresh the screen here
};

I am not acquainted with Curses::UI myself, maybe you need to call
the leave_curses() and then reset_curses() methods in this handler. In
this case your curses object needs to be in the scope of the above
subroutine reference. So maybe you can use a global variable for it (or
at least a closure to restrict its scope as much as possible).

Tassilo
 
V

Vlad Tepes

* Tassilo v. Parseval (CCLXXXV'th day of year MMIII)
Also sprach Vlad Tepes:


Back from my days when I used (n)curses from C, I remember having
defined a signal-handler for SIGWINCH (which should be triggered upon
resizing the terminal window). This should work likewise in Perl:

$SIG{ WINCH } = sub {
# do whatever is needed to refresh the screen here
};

Thanks for the tip on SIGWINCH and leave/reset_curses. My app gets
this signal, but I still don't know how to make the C::UI widgets
lay out themselves on the screen according to the new terminal size.
According to the docs this could be done by simply calling layout()
on the root window. It doesn't work for me.
 
R

Rocco Caputo

Thanks for the tip on SIGWINCH and leave/reset_curses. My app gets
this signal, but I still don't know how to make the C::UI widgets
lay out themselves on the screen according to the new terminal size.
According to the docs this could be done by simply calling layout()
on the root window. It doesn't work for me.

Have you contacted the author? He's always been very good about
responding to mail about Curses::UI. Perhaps it's a bug nobody has
reported yet.

There's also (e-mail address removed), if you'd like your e-mail to be
tracked in the CPAN bug tracker.
 
V

Vlad Tepes

* Rocco Caputo <[email protected]> (CCLXXXVI'th day of year MMIII)

[ About resizing Curses::UI applications ]
Have you contacted the author?

Now I have been in contact with the maintainer of C::UI. He says
terminal resizing isn't supported and will be hard to implement.

Looks like I'm out of luck. said:
There's also (e-mail address removed), if you'd like your e-mail
to be tracked in the CPAN bug tracker.

If a feature is not supported then it is not a bug, or is it?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top