send window to bottom of stack
Posted
#1
(In Topic #513)
Guru

I'm using the Window object and win.Raise() and win.Lower() do nothing.
setting win.Stacking = Window.Top or Window.Bottom sends to top or bottom but keeps it there and if i set stacking back to normal the window returns to it's position. ?
I'm stumped.
tia
Bruce
Posted
Regular

BruceSteers said
Anyone know how to send a window to the bottom or top of the stack?…
I notice no one has come back to you on this so I thought I'd ask for clarification.
I've only used Window Raise/Lower in the Ncurses component which is simpler, but worked fine. I had no reason to know where a window was within the 'stack', only how to bring it towards the foreground.
Which component are you using: gtk, qt4, qt5?
So maybe you can post some simple test code?
Posted
Guru

Looks like Lower() works okay on QT it's just GTK it does nothing. (didn't think to check QT)
I just tried adding ncurses to the project (and another blank project) and all i got was failure to run saying "Screen is incorrectly overridden in class Screen" ?
I've been making a terminal..
(attachment removed)
unlike the std gambas terminal it supports XTerm window manipulation codes like window resize/minimise/send to back of stack etc.
unlike mate-terminal it also supports "\033[10;2t" (toggle full screen)
Unlike ANY terminal it also supports using ctrl-C and ctrl-V copy/paste text. (if any text is selected it copies text with ctrl-c press, if no selected text it sends ctrl-c break to term)
but to support the echo -en "\033[6t" to send to back all i could do was use window.stacking as win.Lower() did nothing.
Seems it's a gtk (or gambas) problem though.
Cheers
Bruce
Here's how i've updated the gambas gb.form.terminal object to support CSI t commands..
I sent a merge request but not got any response from Ben.
https://gitlab.com/bsteers4/gambas/-/commits/VT100-WinManipulation-1cmt
[GB.FORM.TERMINAL]
* NEW: various XTerm window manipulation escape sequences added to VT100
* NEW: Added Boolean Property WinManipulation to enable manipulations.
Useful if your terminalview is standalone in a form/window.
Set property TerminalView1.WinManipulations to True and it
enables the following XTerm escape sequences on the top window…
Eg. Type 'echo -en "\033[10;2t"' to toggle fullscreen.\
Handles the following modes…
1, minimize false
2, minimize true
3, move window (x,y)
4, Resize (h,w) in pixels
5, stack front (this sets or unsets Stacking=Window.Above)
6, stack back (this sets or unsets Stacking=Window.Below)
7, Refresh
8, Resize (lines, cols) text characters
9;0 maximize false
9;1 maximize true (also works as true/false toggle)
10;0 full screen off
10;1 full screen on
10;2 full screen toggle\
5 and 6 should ideally just send window to front or back and not set stacking but i do not know how.
Posted
Guru

<IMG src="https://www.cogier.com/gambas/RaiseWindow.png">
</IMG>
Posted
Guru

cogier said
I have done a little research on this. I found that the 'Raise' method works well in both QT & GTK, though GTK is noticeably slower! The 'Lower' method is not as good. So using 'Raise' only I came up with this. Am I getting close to what you want?
<IMG src="https://www.cogier.com/gambas/RaiseWindow.png"></IMG>
That's bizzarre
Seems to work okay on your app.
Does not work on my terminal window with GTK
Posted
Regular

BruceSteers said
…Looks like Lower() works okay on QT it's just GTK it does nothing. (didn't think to check QT)…
There is a loooong history of Gambas problems with gtk components.
I think this is because Gambas development has always been done in qt
Posted
Guru

stevedee said
BruceSteers said
…Looks like Lower() works okay on QT it's just GTK it does nothing. (didn't think to check QT)…
There is a loooong history of Gambas problems with gtk components.
I think this is because Gambas development has always been done in qt
I see , i guess it's going to change though as Benoít has set gambas IDE to use GTK by default now so forcing most to use GTK will find all the bugs. (eventually)
BruceSteers said
Hi Steve , Cheers
I just tried adding ncurses to the project (and another blank project) and all i got was failure to run saying "Screen is incorrectly overridden in class Screen" ?
Turns out ncurses can only be used in a non-GUI app so I couldn't use it.
My guess (after trying Charlies working example) is it's something to do with TerminalView.
Who knows? I guess Ben does , I've sent a bug report.
cheers folks
Bruce
Posted
Regular

BruceSteers said
…if any text is selected it copies text with ctrl-c press, if no selected text it sends ctrl-c break to term…
That sounds a bit scary.
Historically, <ctrl><c> was used in editors, and now is more widespread. But its so well known as the way you stop a program running in a terminal, that I'd use the universal terminal method <shift><ctrl><c> for copy and <shift><ctrl><v> for paste.
Posted
Guru

stevedee said
BruceSteers said
…if any text is selected it copies text with ctrl-c press, if no selected text it sends ctrl-c break to term…
That sounds a bit scary.
Historically, <ctrl><c> was used in editors, and now is more widespread. But its so well known as the way you stop a program running in a terminal, that I'd use the universal terminal method <shift><ctrl><c> for copy and <shift><ctrl><v> for paste.
I dunno , it seems to work okay.
It checks if you have selected any text. stopping a program with ctrl-c still works fine if no text is selected.
I didn't know about shift + Ctrl-C lol. Talk about "We learn something new every day"
Posted
Regular

BruceSteers said
…Turns out ncurses can only be used in a non-GUI app so I couldn't use it…
Yes sorry, Ncurses is for terminal use.
I did a horrible hack on an old ncurses test program earler to check 'Lower'
Code (gambas)
- ' Gambas module file
- '
- 'this timer re-writes the screen at 2s intervals
- hTimerScreen.Delay = 2000
- hTimerScreen.start
- Inc lngCount
- With hUserInterface
- .Border = Border.ACS
- .Background = Color.Green
- .Caption = "clock window\r"
- .SetFocus()
- With hUserInt2
- .Border = Border.ACS
- .Background = Color.Cyan
- .Caption = "whats this window?\r"
- .SetFocus()
- Toggle
- hUserInt2.Lower()
- hUserInterface.Lower()
- blnToggleFlag = Not blnToggleFlag
Posted
Guru

stevedee said
BruceSteers said
…Turns out ncurses can only be used in a non-GUI app so I couldn't use it…
Yes sorry, Ncurses is for terminal use.
I did a horrible hack on an old ncurses test program earler to check 'Lower'
Sadly i can't use it though.
My app is not a terminal program it's a terminal
so it's got gb.gui and a TerminalView component rendering ncurses unusable
I have an easy hack to get .Raise() working.
win.TopOnly = True
win.TopOnly = False
Raises the window and does not alter Stacking property and leaves window on top.
that works fine but .Lower() does not want to play ball.
Like i said i tried setting the Stacking property to Window.Below but is sends the window to back and when resetting the Stacking back to Window.Normal the window comes to front again
Shame there's not a BottomOnly property to set/unset.
Posted
Guru

Ben has fixed it in latest commit <EMOJI seq="1f60e" tseq="1f60e">😎</EMOJI>
1 guest and 0 members have just viewed this.


