Author Topic: Removing the tile bar/glitchy gui code  (Read 5305 times)

0 Members and 1 Guest are viewing this topic.

Offline Omerta7486

  • Newbie
  • Posts: 33
  • √𝜋²
    • View Profile
Removing the tile bar/glitchy gui code
« on: August 02, 2018, 11:27:54 am »
Is there a way to remove the title bar completely from an app frame? I would like to build custom GUIs for my programs, and the title bar gets in the way.

Also, when I use $Checking:OFF the close button[X] on the title bar doesn't function. When you click it, it will visually "click," but it will not close the app window.

And, one last thing. If I use _screenhide to minimize my window, I can't restore the app by clicking it's button on the taskbar. It stays minimized on my taskbar. Is there something I'm missing, or does _screenhide not do what I think it does?

Thanks in advance,

-Omerta
« Last Edit: August 02, 2018, 11:37:02 am by Omerta7486 »
The knowledge that's seeking the favor of another means the murder of self.

Latest version of my game, here  Omertris: Invasion

FellippeHeitor

  • Guest
Re: Removing the tile bar/glitchy gui code
« Reply #1 on: August 02, 2018, 12:10:48 pm »
Is there a way to remove the title bar completely from an app frame? I would like to build custom GUIs for my programs, and the title bar gets in the way.
There is currently no native way of doing that in QB64.

Quote
Also, when I use $Checking:OFF the close button[X] on the title bar doesn't function. When you click it, it will visually "click," but it will not close the app window.
It is not recommended to use $CHECKING:OFF an never to turn it back ON. The idea of checking:off is that is disables all event checking - system events like the close button and TIMERS included - for when your program needs to perform an intensive task. But then you should turn it back on, or you get side effects like the one you described.

Quote
And, one last thing. If I use _screenhide to minimize my window, I can't restore the app by clicking it's button on the taskbar. It stays minimized on my taskbar. Is there something I'm missing, or does _screenhide not do what I think it does?
It apparently doesn't do what you think it does. _SCREENHIDE literally hides the screen, which needs to be programmatically shown again with _SCREENSHOW.

What you want is _SCREENICON - that's what will minimize the current window.
« Last Edit: August 02, 2018, 12:13:32 pm by FellippeHeitor »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Removing the tile bar/glitchy gui code
« Reply #2 on: August 02, 2018, 01:41:44 pm »
Code: QB64: [Select]
  1. _TITLE "Aquarium with swaying kelp"
  2. 'QB64 X 64 version 1.2 20180228/86  from git b301f92
  3.  
  4. CONST xmax = 1260
  5. CONST ymax = 720
  6. CONST swayLimit = 3
  7. CONST maxFish = 1024
  8.  
  9. SCREEN _NEWIMAGE(xmax, ymax, 32)
  10.  

When I use this, there is no title bar displayed, is this a flaw?

FellippeHeitor

  • Guest
Re: Removing the tile bar/glitchy gui code
« Reply #3 on: August 02, 2018, 01:53:15 pm »
Fullscreen won't show a title bar, of course. I understand Omerta wants a borderless window - notice how he talks about removing the title bar from an app frame.

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Removing the tile bar/glitchy gui code
« Reply #4 on: August 02, 2018, 02:39:46 pm »
Fullscreen won't show a title bar, of course. I understand Omerta wants a borderless window - notice how he talks about removing the title bar from an app frame.

http://qb64.org/wiki/Windows_Libraries#Borderless_Window   <--- This is how we used to do it, but with _WINDOWHANDLE and such, the process should be a little simpler now, with even fewer DECLARE LIBRARY calls necessary. 
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

FellippeHeitor

  • Guest
Re: Removing the tile bar/glitchy gui code
« Reply #5 on: August 02, 2018, 03:04:17 pm »
Steve is right! And you can simplify that sample like this:

Code: QB64: [Select]
  1. '============
  2. 'NOBORDER.BAS
  3. '============
  4.  
  5.     FUNCTION GetWindowLongA& (BYVAL hwnd AS LONG, BYVAL nIndex AS LONG)
  6.     FUNCTION SetWindowLongA& (BYVAL hwnd AS LONG, BYVAL nIndex AS LONG, BYVAL dwNewLong AS LONG)
  7.     FUNCTION SetWindowPos& (BYVAL hwnd AS LONG, BYVAL hWndInsertAfter AS LONG, BYVAL x AS LONG, BYVAL y AS LONG, BYVAL cx AS LONG, BYVAL cy AS LONG, BYVAL wFlags AS LONG)
  8.  
  9. GWL_STYLE = -16
  10. WS_BORDER = &H800000
  11.  
  12. _TITLE "No Border"
  13.  
  14. PRINT "Press any key for no border...": A$ = INPUT$(1)
  15.  
  16. winstyle& = GetWindowLongA&(hwnd&, GWL_STYLE)
  17. a& = SetWindowLongA&(hwnd&, GWL_STYLE, winstyle& AND NOT WS_BORDER)
  18. a& = SetWindowPos&(hwnd&, 0, 0, 0, 0, 0, 39)
  19.  
  20. PRINT "Press any key to get back border...": SLEEP
  21.  
  22. winstyle& = GetWindowLongA&(hwnd&, GWL_STYLE)
  23. a& = SetWindowLongA&(hwnd&, GWL_STYLE, winstyle& OR WS_BORDER)
  24. a& = SetWindowPos&(hwnd&, 0, 0, 0, 0, 0, 39)
  25.  
  26. PRINT "The end"
  27.  
  28.  

Offline Omerta7486

  • Newbie
  • Posts: 33
  • √𝜋²
    • View Profile
Re: Removing the tile bar/glitchy gui code
« Reply #6 on: August 02, 2018, 08:50:45 pm »
Thank you, Fillippe, BPlus, Steve!

I have a few questions. Both _SCREENICON and _WINDOWHANDLE show up in QB64 as valid commands, but neither has documentation on the wiki, and _WINDOWHANDLE doesn't even have an F1 help page in the IDE! Is there some documentation I am missing?

[EDIT]: Okay, I found their reference under the alphabetical list, but not the usage list. '~' I shall get to studying! Haha. Thank you, all!
« Last Edit: August 02, 2018, 08:53:01 pm by Omerta7486 »
The knowledge that's seeking the favor of another means the murder of self.

Latest version of my game, here  Omertris: Invasion

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Removing the tile bar/glitchy gui code
« Reply #7 on: August 03, 2018, 09:50:20 am »
I don't know if ~ is that easy to look up, check out variable types topic, it is the symbol for unsigned used to modify a signed type.
http://qb64.org/wiki/Variable_Types

FellippeHeitor

  • Guest
Re: Removing the tile bar/glitchy gui code
« Reply #8 on: August 03, 2018, 10:06:57 am »
I really believe that

Quote
'~'

is a confused smiley.

Offline Fifi

  • Forum Regular
  • Posts: 181
    • View Profile
    • My small QB64 contribution
Re: Removing the tile bar/glitchy gui code
« Reply #9 on: August 15, 2018, 12:19:30 pm »
Hi Fellippe,

Steve is right! And you can simplify that sample like this:

Code: QB64: [Select]
  1. '============
  2. 'NOBORDER.BAS
  3. '============
  4.  
  5.     FUNCTION GetWindowLongA& (BYVAL hwnd AS LONG, BYVAL nIndex AS LONG)
  6.     FUNCTION SetWindowLongA& (BYVAL hwnd AS LONG, BYVAL nIndex AS LONG, BYVAL dwNewLong AS LONG)
  7.     FUNCTION SetWindowPos& (BYVAL hwnd AS LONG, BYVAL hWndInsertAfter AS LONG, BYVAL x AS LONG, BYVAL y AS LONG, BYVAL cx AS LONG, BYVAL cy AS LONG, BYVAL wFlags AS LONG)
  8.  
  9. GWL_STYLE = -16
  10. WS_BORDER = &H800000
  11.  
  12. _TITLE "No Border"
  13.  
  14. PRINT "Press any key for no border...": A$ = INPUT$(1)
  15.  
  16. winstyle& = GetWindowLongA&(hwnd&, GWL_STYLE)
  17. a& = SetWindowLongA&(hwnd&, GWL_STYLE, winstyle& AND NOT WS_BORDER)
  18. a& = SetWindowPos&(hwnd&, 0, 0, 0, 0, 0, 39)
  19.  
  20. PRINT "Press any key to get back border...": SLEEP
  21.  
  22. winstyle& = GetWindowLongA&(hwnd&, GWL_STYLE)
  23. a& = SetWindowLongA&(hwnd&, GWL_STYLE, winstyle& OR WS_BORDER)
  24. a& = SetWindowPos&(hwnd&, 0, 0, 0, 0, 0, 39)
  25.  
  26. PRINT "The end"
  27.  
  28.  

I think such a check box option would be great in InForm to create windows without a frame border.

What do you think?

Best regards.
It's better to look like an idiot for a short time while asking something obvious to an expert than pretending to be smart all your life. (C) Me.

FellippeHeitor

  • Guest
Re: Removing the tile bar/glitchy gui code
« Reply #10 on: August 15, 2018, 12:20:44 pm »
I'll take it into consideration, Fifi. Thanks!

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Removing the tile bar/glitchy gui code
« Reply #11 on: September 16, 2018, 09:35:24 am »
The biggest problem is GLUT doesn't play nice with all versions of Linux and borderless Windows.

http://openglut.sourceforge.net/group__window.html

Quote
GLUT_BORDERLESS seems to vary by the window manager on X11, though twm (for example) performs very similarly to WIN32. But KDE's window manager (for example) does not let you send keystrokes to borderless windows without OpenGLUT hacks.
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline Omerta7486

  • Newbie
  • Posts: 33
  • √𝜋²
    • View Profile
Re: Removing the tile bar/glitchy gui code
« Reply #12 on: September 16, 2018, 12:54:38 pm »
Quote
The world don't move to the beat of just one drum,
what might be right for you, may not be right for some.

Mm. Wise words Mr. Thicke!

The problem with an OS independent solution is that each OS handles window creation and functionality differently. For instance, Mac OSX uses GLUT, while Windows uses USER. Just look up documentation for both and compare the two. High level programming languages(Such as all forms of BASIC) are built to function generally under multiple environments; it's up to the programmer to pull in the OS specific functionality from OS native APIs. This means that you have to create OS specific versions of your app built around the different APIs. If you only wish to target a specific OS, that would take a lot of pain out of the game. Hint: Over 95% of all Steam users are on PC(That's what I put a link to).

There's a reason developers often send their software off to a third party studio to be ported to a different OS. But, for us little guys, we usually pick an OS and stick with it.

By the by, Steve. If I may ask, can QB64 use different interpreters, or are the interpreters built in to the different versions(Win/Mac/Lin)? Not interested, just curious.
The knowledge that's seeking the favor of another means the murder of self.

Latest version of my game, here  Omertris: Invasion