Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Window maximize button ?  (Read 6650 times)

0 Members and 1 Guest are viewing this topic.

Redee

  • Jr. Member
  • **
  • Posts: 97
    • View Profile
Window maximize button ?
« on: January 22, 2018, 10:19:44 pm »
How to disable only one maximize button ?


eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Window maximize button ?
« Reply #1 on: January 22, 2018, 10:23:16 pm »
By removing sf::Style::Resize from the style set. But it also means that you can't manually resize the window anymore.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: Window maximize button ?
« Reply #2 on: January 23, 2018, 08:57:48 am »
On Windows WinApi almost surely could do it.
Back to C++ gamedev with SFML in May 2023

Redee

  • Jr. Member
  • **
  • Posts: 97
    • View Profile
Re: Window maximize button ?
« Reply #3 on: January 23, 2018, 10:23:07 am »
By removing sf::Style::Resize from the style set. But it also means that you can't manually resize the window anymore.
Me need exactly turn off this One thing. Resize need.

On Windows WinApi almost surely could do it.
Okey and how do this ???
I mean its handle window and then set something - you can help me what direct need set ?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Window maximize button ?
« Reply #4 on: January 23, 2018, 11:19:06 am »
So why should a user be allowed to resize the window, but not maximize it?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: Window maximize button ?
« Reply #5 on: January 23, 2018, 11:29:36 am »
This disables the maximize button (you need Windows.h included for these functions and it's best to do it in some separate cpp file because Windows.h has tons of weird crap defined in it). You should take a better look on MSDN too because most of simple things are simple to do with WinApi.

auto win = sfmlwindow.getSystemHandle();
auto style = GetWindowLong(win, GWL_STYLE);
SetWindowLong(win, GWL_STYLE, style & ~WS_MAXIMIZEBOX);
« Last Edit: January 23, 2018, 11:31:43 am by FRex »
Back to C++ gamedev with SFML in May 2023

Redee

  • Jr. Member
  • **
  • Posts: 97
    • View Profile
Re: Window maximize button ?
« Reply #6 on: January 23, 2018, 02:57:27 pm »
So why should a user be allowed to resize the window, but not maximize it?
eXpl0it3r I have proportional window like in Don't Starve, I thought do direct ratio after maximize but seems not Event which detect it to do this.

FRex thank you for need information, will be much easy for release for my goals.
« Last Edit: January 23, 2018, 03:01:34 pm by Redee »

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: Window maximize button ?
« Reply #7 on: January 23, 2018, 03:02:49 pm »
Did you see if that code does what you want?

Also - I quite dislike unmaximizable windows personally. I even play Minecraft and my favorite Flash games (via standalone Flash player on Windows) as a maximized window (Minecraft is 3D and stretches and Flash games seem to fill entire view or letterbox nicely with black bars on sides or top and bottom, depending on the game). I much prefer if game can stretch its view or letterbox it even if I get blackbars - I prefer that to seeing parts of desktop and other windows behind the game or being forced into fullscreen (in which case the window has to adjust still since screens vary a lot).
« Last Edit: January 23, 2018, 03:04:20 pm by FRex »
Back to C++ gamedev with SFML in May 2023

Redee

  • Jr. Member
  • **
  • Posts: 97
    • View Profile
Re: Window maximize button ?
« Reply #8 on: January 23, 2018, 06:31:28 pm »
Because SFML not have window maximize Event >> https://en.sfml-dev.org/forums/index.php?topic=8830.0
And I can't detect its manual resized or from Max button.

FullScreen with proportions I already have.

And Maximize not work for my logic Render, because my View is Original - not 1 to 1.
I can improve Maximize to my render logic only if detect exact sizes of visible Desktop area without Taskbar.
Maybe its help me >> http://forum.lazarus-ide.org/index.php/topic,9858.msg53098.html#msg53098

Or need simply check from window handle from WinApi Maximize status.

auto w_Hnd = win.getSystemHandle();
WINDOWPLACEMENT w_Plc;
GetWindowPlacement(w_Hnd, &w_Plc);
if (w_Plc.showCmd == SW_SHOWMAXIMIZED)
{
  // here do proportion adjustment
}

« Last Edit: January 24, 2018, 03:27:33 pm by Redee »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Window maximize button ?
« Reply #9 on: January 24, 2018, 06:14:41 pm »
The window size gives you the size of the drawable area and not the window's full size (including decorations).
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/