Author Topic: Bordersize and Titlebar Height  (Read 9863 times)

0 Members and 1 Guest are viewing this topic.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Bordersize and Titlebar Height
« Reply #15 on: November 11, 2021, 01:51:05 pm »
Code: QB64: [Select]
  1. If taskbar_top > 0 Then ScreenX = 0 Else ScreenX = TBH
  2. If taskbar_left > 0 Then Screeny = 0 Else Screeny = TBW
  3.  
ScreenX and screenY look switched to me. taskbar_top would effect ScreenY and taskbar_left effect screenX

I tried fixing and but didn't help, maybe screwed up, distracted today,

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Bordersize and Titlebar Height
« Reply #16 on: November 11, 2021, 03:05:21 pm »
Code: QB64: [Select]
  1. If taskbar_top > 0 Then ScreenX = 0 Else ScreenX = TBH
  2. If taskbar_left > 0 Then Screeny = 0 Else Screeny = TBW
  3.  
ScreenX and screenY look switched to me. taskbar_top would effect ScreenY and taskbar_left effect screenX

I tried fixing and but didn't help, maybe screwed up, distracted today,

Like I said, I think this will fix it:

If taskbar_bottom = TBH Then 'bar is at top
    ScreenY = TBH
Else
    ScreenY = 0
END IF

If taskbar_right = TBW THEN 'bar is on left
   ScreenX = TBW
ELSE
    ScreenX = 0
END IF

I'll try and hunt down a Win 10 PC later and play with it if that doesnt work.
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • View Profile
    • GitHub
Re: Bordersize and Titlebar Height
« Reply #17 on: November 11, 2021, 03:10:26 pm »
I think you can also use WinAPI for this. I haven't looked at it yet but I did find this Stack Overflow post:
https://stackoverflow.com/questions/21566307/how-to-get-the-title-bar-height-and-width-for-aero-and-basic-design
Shuwatch!

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Bordersize and Titlebar Height
« Reply #18 on: November 11, 2021, 06:49:52 pm »
I think you can also use WinAPI for this. I haven't looked at it yet but I did find this Stack Overflow post:
https://stackoverflow.com/questions/21566307/how-to-get-the-title-bar-height-and-width-for-aero-and-basic-design

Those are for the title bar, which we can get cross-platform via glut.  The .h which I'm using is for the taskbar.  I'm certain we can do it with QB64 itself, but it'd require a custom data type (RECT structure), and a couple declare library calls, so I just figured, "Heck, if I'm going to have to do that anyway, it's just as easy to just make a .h header," and it grew from there.  Originally all I needed was the height of the taskbar, but then width, and finally all 4 coordinates got involved in the process, and my "simple" solution has grown a lot more complicated -- and all just to become obsolete in a few years as WIN 11 doesn't allow for the window to go anywhere but at the bottom of the screen.

With Win11, as long as you know the height, you know all 4 coordinates.

Top = _desktopheight - taskbarheight
Bottom = _desktopheight
Left = 0
Right = _desktopwidth

😁
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!