Recent

Author Topic: Hiding the window caption  (Read 1409 times)

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Hiding the window caption
« on: February 23, 2023, 07:25:19 pm »
This code suffices to toggle the display of the application caption

Code: Pascal  [Select][+][-]
  1.     'z': begin
  2.            case BorderStyle of
  3.              bsSizeable: BorderStyle := bsNone
  4.            otherwise
  5.              BorderStyle := bsSizeable
  6.            end;
  7.            testCard(true)
  8.          end;
  9.  

but only works reliably for Qt/Qt5 (i.e. not GTK2/GTK3).

Does anybody have anything better?

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Blaazen

  • Hero Member
  • *****
  • Posts: 3237
  • POKE 54296,15
    • Eye-Candy Controls
Re: Hiding the window caption
« Reply #1 on: February 23, 2023, 09:08:43 pm »
It seems I found GTk2 hack: set Constraints.MinHeight and Constraints.MinWidth to something (in OI or in code).

GTk2 probably sets Width and Height to zero somewhere during the switching the BorderStyle.
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Re: Hiding the window caption
« Reply #2 on: February 24, 2023, 09:08:28 am »
Is that using the contsraint of the form, or getting at the caption in some way?

Trying that using code below (Laz 2.2.4, FPC 3.2.2) using GTK2 on KDE hides/unhides the entire window.

Code: Pascal  [Select][+][-]
  1.     'z': begin
  2.            with Constraints do begin
  3.              MinWidth := 0;
  4.              MinHeight := 0
  5.            end;
  6.            case BorderStyle of
  7.              bsSizeable: BorderStyle := bsNone
  8.            otherwise
  9.              BorderStyle := bsSizeable
  10.            end;
  11.            testCard(true)
  12.          end;
  13.  

Added detail: what I'm doing isn't entirely cosmetic, since it makes sure that space on the physical display being calibrated isn't occupied by the caption. I can work around the problem by using Qt5 as the widget set, although that does mean that I can't run it on the old laptop I was hoping to use... I've got a slightly rickety optical bench setup and there's a big advantage to being able to keep the video generation well separated from the computer I'm sitting at.

MarkMLl
« Last Edit: February 24, 2023, 09:32:06 am by MarkMLl »
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

zeljko

  • Hero Member
  • *****
  • Posts: 1594
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Hiding the window caption
« Reply #3 on: February 24, 2023, 12:18:05 pm »
From Qt world: When changing windowFlags (that's border etc) you should hide(), set new windowflags, show(). Try that with gtk2, x11 philosophy should be same.

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Re: Hiding the window caption
« Reply #4 on: February 24, 2023, 01:07:03 pm »
With GTK2, the entire form/window appears to be being hidden (I didn't remember that behaviour, but I've upgraded the distro since writing this and there was a point-level libgtk upgrade).

It's the same irrespective of the presence or hide/show (I've stuck the form name in there to be absolutely unambiguous), of the constraint change, or of the APM I added for good measure.

Code: Pascal  [Select][+][-]
  1.     'z': begin
  2. Form1.Hide;
  3. {           with Constraints do begin
  4.              MinWidth := 0;
  5.              MinHeight := 0
  6.            end; }
  7.            case BorderStyle of
  8.              bsSizeable: BorderStyle := bsNone
  9.            otherwise
  10.              BorderStyle := bsSizeable
  11.            end;
  12. Form1.Show;
  13. Application.ProcessMessages;
  14.            testCard(true)
  15.          end;
  16.  

Everything else works fine: testcard() basically paints a bullseye with rings at adjustable positions.

I wonder whether there's any overlap here with people who've used circular output which presumably didn't have a caption?

In any event, Qt5 works and I suspect I might have to live with that.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Blaazen

  • Hero Member
  • *****
  • Posts: 3237
  • POKE 54296,15
    • Eye-Candy Controls
Re: Hiding the window caption
« Reply #5 on: February 24, 2023, 04:14:36 pm »
Why you tried zeros?
Code: Pascal  [Select][+][-]
  1.   with Constraints do begin
  2.              MinWidth := 0;
  3.              MinHeight := 0
  4.            end;
I meant non-zero. But I tested it by setting constraints in OI.
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Re: Hiding the window caption
« Reply #6 on: February 24, 2023, 06:07:46 pm »
The reason I put it in code was that I've also been testing this on GTK1 (for the Hell of it, and because the laptop I'm using to derive the device still has a usable copy of a suitably-old Lazarus/FPC) and it saves putting anything which might be unsupported in the .lfm.

Anyway, the result with the minimum values set to 1 was definitely interesting: either with or without the hide/show and APM the first z caused the caption to disappear and the second brought it back (yay!). However the third z hid the entire form, the fourth brought it back and so on.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Re: Hiding the window caption
« Reply #7 on: February 24, 2023, 07:08:36 pm »
I'm tacking a "published" version of the project on as a zipfile, in case anybody wants to play with it. However I'd emphasise that this is for the sake of interest only, and that I am definitely not stuck because of this.

I've set it to talk to stdin/out rather than Telnet and believe it's complete, but there might be minor directory issues.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

 

TinyPortal © 2005-2018