Anyone know how to send a window to the bottom or top of the stack?
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
send window to bottom of stack
- BruceSteers
- Posts: 1608
- Joined: Thursday 23rd July 2020 5:20pm
- Location: Isle of Wight
- Contact:
send window to bottom of stack
If at first you don't succeed , try doing something differently.
BruceS
BruceS
Re: send window to bottom of stack
I notice no one has come back to you on this so I thought I'd ask for clarification.BruceSteers wrote: ↑Tuesday 8th December 2020 4:55am Anyone know how to send a window to the bottom or top of the stack?...
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?
- BruceSteers
- Posts: 1608
- Joined: Thursday 23rd July 2020 5:20pm
- Location: Isle of Wight
- Contact:
Re: send window to bottom of stack
Hi Steve , Cheers
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.. 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/-/co ... ation-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.
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.. 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/-/co ... ation-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.
If at first you don't succeed , try doing something differently.
BruceS
BruceS
- cogier
- Site Admin
- Posts: 1129
- Joined: Wednesday 21st September 2016 2:22pm
- Location: Guernsey, Channel Islands
Re: send window to bottom of stack
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?
- Attachments
-
- RaiseWindows-0.0.1.tar.gz
- (1.76 MiB) Downloaded 248 times
- BruceSteers
- Posts: 1608
- Joined: Thursday 23rd July 2020 5:20pm
- Location: Isle of Wight
- Contact:
Re: send window to bottom of stack
That's bizzarre
Seems to work okay on your app.
Does not work on my terminal window with GTK
If at first you don't succeed , try doing something differently.
BruceS
BruceS
Re: send window to bottom of stack
There is a loooong history of Gambas problems with gtk components.BruceSteers wrote: ↑Wednesday 9th December 2020 3:29pm ...Looks like Lower() works okay on QT it's just GTK it does nothing. (didn't think to check QT)...
I think this is because Gambas development has always been done in qt
- BruceSteers
- Posts: 1608
- Joined: Thursday 23rd July 2020 5:20pm
- Location: Isle of Wight
- Contact:
Re: send window to bottom of stack
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)stevedee wrote: ↑Wednesday 9th December 2020 6:22pmThere is a loooong history of Gambas problems with gtk components.BruceSteers wrote: ↑Wednesday 9th December 2020 3:29pm ...Looks like Lower() works okay on QT it's just GTK it does nothing. (didn't think to check QT)...
I think this is because Gambas development has always been done in qt
Turns out ncurses can only be used in a non-GUI app so I couldn't use it.BruceSteers wrote: ↑Wednesday 9th December 2020 3:29pm 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" ?
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
If at first you don't succeed , try doing something differently.
BruceS
BruceS
Re: send window to bottom of stack
That sounds a bit scary.BruceSteers wrote: ↑Wednesday 9th December 2020 3:29pm ...if any text is selected it copies text with ctrl-c press, if no selected text it sends ctrl-c break to term...
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.
- BruceSteers
- Posts: 1608
- Joined: Thursday 23rd July 2020 5:20pm
- Location: Isle of Wight
- Contact:
Re: send window to bottom of stack
I dunno , it seems to work okay.stevedee wrote: ↑Wednesday 9th December 2020 6:42pmThat sounds a bit scary.BruceSteers wrote: ↑Wednesday 9th December 2020 3:29pm ...if any text is selected it copies text with ctrl-c press, if no selected text it sends ctrl-c break to term...
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.
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"
If at first you don't succeed , try doing something differently.
BruceS
BruceS
Re: send window to bottom of stack
Yes sorry, Ncurses is for terminal use.BruceSteers wrote: ↑Wednesday 9th December 2020 6:40pm ...Turns out ncurses can only be used in a non-GUI app so I couldn't use it...
I did a horrible hack on an old ncurses test program earler to check 'Lower'
' Gambas module file
Public hTimerScreen As Timer 'screen update timer
Public hUserInterface As Window 'our user interface window
Public hUserInt2 As Window
Public lngCount As Long 'just a trivial counter
Public blnToggleFlag As Boolean
'
Public Sub Main()
'this timer re-writes the screen at 2s intervals
hTimerScreen = New Timer As "tmrScreenUpdate"
hUserInterface = New Window(True, 0, 0, 400, 15) As "qWindow"
hUserInt2 = New Window(True, 5, 10, 200, 15) As "qWindow2"
hTimerScreen.Delay = 2000
hTimerScreen.start
End
Public Sub tmrScreenUpdate_Timer()
Inc lngCount
Screen.Echo = False 'don't display key press
Screen.Cursor = Cursor.VeryVisible
With hUserInterface
.Border = Border.ACS
.Background = Color.Green
.Caption = "clock window\r"
.Print("Counter: " & lngCount, 2, 2, Attr.Blink, Pair[Color.Blue, Color.Green])
.PrintCenter(Format(Now, "hh:mm:ss"), Attr.Bold, Pair[Color.Black, Color.Green])
.Print("its a clock", 20, 13, Attr.Underline, Pair[Color.Blue, Color.Green])
.Raise()
.SetFocus()
End With
With hUserInt2
.Border = Border.ACS
.Background = Color.Cyan
.Caption = "whats this window?\r"
.Print("Counter: " & lngCount, 2, 2, Attr.Blink, Pair[Color.Red, Color.Magenta])
.PrintCenter(Format(Now, "hh:mm:ss"), Attr.Bold, Pair[Color.Black, Color.Green])
.Print("...what can I say?", 20, 13, Attr.Underline, Pair[Color.Blue, Color.Green])
.Raise()
.SetFocus()
End With
Toggle
End
Public Function Toggle()
If blnToggleFlag Then
hUserInt2.Lower()
Else
hUserInterface.Lower()
Endif
blnToggleFlag = Not blnToggleFlag
End