Recent

Author Topic: Unable to move form out of visible screen area  (Read 3266 times)

Aruna

  • Hero Member
  • *****
  • Posts: 513
Unable to move form out of visible screen area
« on: August 04, 2024, 01:50:59 am »
I am running Linux debian 6.4.8-usb #8 SMP PREEMPT_DYNAMIC Fri Feb  9 17:21:43 EST 2024 x86_64 GNU/Linux and Lazarus 3.4 (rev Unknown) FPC 3.2.0 x86_64-linux-gtk2.

I have a form. I set it's Left property to zero and it gets aligned to the left border of the IDE which is what I wanted. Now if I try to get the form to move further left by giving the Left property a negative value like -100 it is instantly removed and zeroed. The form does not move any further left than x=0px.

When I try to move the form through code it works up to the screen edge then goes no further. 
Code: Pascal  [Select][+][-]
  1. procedure TForm1.Button1Click(Sender: TObject);
  2. begin
  3.   Left := Left -100;
  4. end;
  5.  

I have attached the source. So how does one move the form beyond the visible screen area?

dbannon

  • Hero Member
  • *****
  • Posts: 3156
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Unable to move form out of visible screen area
« Reply #1 on: August 04, 2024, 02:25:36 am »
I am running Linux debian 6.4.8-usb

I am guessing that is the kernel version rather than the Debian version ?

I use Debian 12 (bookworm) and routinly test my app on Debian 13 (trixie) and don't see the problem you mention.  I suspect it might be a Desktop thing ?  What desktop are you using ?  (I use Mate).

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

Aruna

  • Hero Member
  • *****
  • Posts: 513
Re: Unable to move form out of visible screen area
« Reply #2 on: August 04, 2024, 02:48:27 am »
I am running Linux debian 6.4.8-usb

I am guessing that is the kernel version rather than the Debian version ?

Hey Davo long time, must be two years or so I think? My apologies. Yes that is a custom kernel I built while testing a arduino-nano and usb issue a while back. Below is the Debian Version:

Code: Bash  [Select][+][-]
  1. aruna@debian:~/lazarus3/lazarus$ lsb_release -a
  2. No LSB modules are available.
  3. Distributor ID: Debian
  4. Description:    Debian GNU/Linux 11 (bullseye)
  5. Release:        11
  6. Codename:       bullseye

I use Debian 12 (bookworm) and routinly test my app on Debian 13 (trixie) and don't see the problem you mention.  I suspect it might be a Desktop thing ?  What desktop are you using ?  (I use Mate).
Davo

I use Gnome Classic.
Code: Pascal  [Select][+][-]
  1. aruna@debian:~/lazarus3/lazarus$ echo $XDG_CURRENT_DESKTOP
  2. GNOME-Classic:GNOME

And you can have a look here it shows you the problem I am experiencing.
« Last Edit: August 04, 2024, 02:54:31 am by Aruna »

dbannon

  • Hero Member
  • *****
  • Posts: 3156
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Unable to move form out of visible screen area
« Reply #3 on: August 04, 2024, 01:45:30 pm »
OK, thats unexpected !  I can confirm what you say. If left is positive, changing it to some negative number sets it to zero. 

But if you drag the form so Left is negative, further negative is possible ! But not so far as the form becomes invisible. Wow.

(make the form wider, move the button to right hand side, grab the title bar at run time and drag it left, then press your button).

Applies to both gtk2 and qt5. Applies to any form, not just the main form. 

I have to assume this is intended behaviour, maybe even a Window Manager rule ?  But I am surprised I have not noticed it before, I guess I concentrate on ensuring user can see the form rather than the reverse.

Setting a negative Left before Show does not help either.

Beats me !

Hmm, Aruna, why do you want to move form to left anyway ?



Davo

Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

VisualLab

  • Hero Member
  • *****
  • Posts: 569
Re: Unable to move form out of visible screen area
« Reply #4 on: August 04, 2024, 02:47:51 pm »
OK, thats unexpected !  I can confirm what you say. If left is positive, changing it to some negative number sets it to zero. 

But if you drag the form so Left is negative, further negative is possible ! But not so far as the form becomes invisible. Wow.

(make the form wider, move the button to right hand side, grab the title bar at run time and drag it left, then press your button).

Applies to both gtk2 and qt5. Applies to any form, not just the main form. 

I have to assume this is intended behaviour, maybe even a Window Manager rule ?  But I am surprised I have not noticed it before, I guess I concentrate on ensuring user can see the form rather than the reverse.

Is it possible that it's something in the display server? I wonder how the test program behaves in Linux with graphics servers: X.org (gtk2/qt5) and Wayland (gtk2/qt5)?

Thaddy

  • Hero Member
  • *****
  • Posts: 16158
  • Censorship about opinions does not belong here.
Re: Unable to move form out of visible screen area
« Reply #5 on: August 04, 2024, 03:10:44 pm »
It has nothing to do with the graphics drivers. To - almost - make it disappear set left/top to screenwidth-1/screenhight-1 which leaves one pixel to drag the window into view again.
If I smell bad code it usually is bad code and that includes my own code.

jcmontherock

  • Sr. Member
  • ****
  • Posts: 270
Re: Unable to move form out of visible screen area
« Reply #6 on: August 04, 2024, 03:55:31 pm »
... or
Code: Pascal  [Select][+][-]
  1. Form1.visible := False;
Windows 11 UTF8-64 - Lazarus 4RC1-64 - FPC 3.2.2

Aruna

  • Hero Member
  • *****
  • Posts: 513
Re: Unable to move form out of visible screen area
« Reply #7 on: August 04, 2024, 03:58:19 pm »
... or
Code: Pascal  [Select][+][-]
  1. Form1.visible := False;
Hi @jcmontherock thank you that will hide the form yes but I want to slide in the form from the left to the visible screen area. To do this I have to first position the form fully 'away' from the visible screen area and so far this has not been possible.

Aruna

  • Hero Member
  • *****
  • Posts: 513
Re: Unable to move form out of visible screen area
« Reply #8 on: August 04, 2024, 04:19:45 pm »
OK, thats unexpected !  I can confirm what you say. If left is positive, changing it to some negative number sets it to zero.
Correct that is the same behaviour I have. 

But if you drag the form so Left is negative, further negative is possible ! But not so far as the form becomes invisible. Wow.
Yes same behaviour as mine.

But if you drag the form so Left is negative, further negative is possible ! But not so far as the form becomes invisible. Wow.
(make the form wider, move the button to right hand side, grab the title bar at run time and drag it left, then press your button).
Davo, keep clicking the button and at one point it will stack up against the edge of the screen and refuse to move further. Test it please.

But if you drag the form so Left is negative, further negative is possible ! But not so far as the form becomes invisible. Wow.
Applies to both gtk2 and qt5. Applies to any form, not just the main form.
I have only tested in gtk but I would think it would have the same behaviour in other popular gui libraries. 

I have to assume this is intended behaviour, maybe even a Window Manager rule ?  But I am surprised I have not noticed it before, I guess I concentrate on ensuring user can see the form rather than the reverse.
So far from what I have seen in the code yes this is intended behaviour. I do not think it is a window manager rule. Ensuring the user can see the User Interface is always good. But.. What about users who may actually want to have a form positioned away from the visible screen? Then this becomes restrictive. This is just a personal thought, if someone wishes to move a form away from the visible screen then they should be allowed to do that?

Hmm, Aruna, why do you want to move form to left anyway ?
Remember Testall days? I am slowly compiling a set of demos and in one demo I want to slide the form into the visible area from the left (currently impossible to do ) I will attach a very small sample for you to review soon. I have attached a screenshot as a teaser  ;)

alpine

  • Hero Member
  • *****
  • Posts: 1297
Re: Unable to move form out of visible screen area
« Reply #9 on: August 04, 2024, 04:31:57 pm »
Quote
I have attached a screenshot as a teaser  ;)
I very much like it!
"I'm sorry Dave, I'm afraid I can't do that."
—HAL 9000

Aruna

  • Hero Member
  • *****
  • Posts: 513
Re: Unable to move form out of visible screen area
« Reply #10 on: August 04, 2024, 04:54:45 pm »
Quote
I have attached a screenshot as a teaser  ;)
I very much like it!
I was going to wait until I had a finished product but since you seem to like my teaser here is a litte gee-wow for you. Please unzip and run the attached file. And please do give me some feedback.

alpine

  • Hero Member
  • *****
  • Posts: 1297
Re: Unable to move form out of visible screen area
« Reply #11 on: August 04, 2024, 08:39:04 pm »
I know it's no consolation but on Win10 there is no such problem with the negative left. I've just tried it.

I just love that logo. Is there a vector format? What's the license?
"I'm sorry Dave, I'm afraid I can't do that."
—HAL 9000

Aruna

  • Hero Member
  • *****
  • Posts: 513
Re: Unable to move form out of visible screen area
« Reply #12 on: August 05, 2024, 01:47:59 am »
I know it's no consolation but on Win10 there is no such problem with the negative left. I've just tried it.
So this is good, thank you for your time and for testing on Win10. Now we have to try and identify why the same code does different things on Windows and Linux? Strange behaviour huh? The code should work the exact same way in both OS's? But seems not to. How does one go about trouble shooting such an issue?  :-\

I just love that logo. Is there a vector format?
I love it too. Is there a vector format ? Open the image file using Inkscape, and save as plain SVG. Done! 

What's the license?
Now that is tricky. I stumbled on to that logo on design.com or brandcrowd.com and both were pricey. If I remember right both wanted $108 or so for the logo.

I am an old man on a fixed monthly income and cannot afford to fork out that kind of money which I can use to put food on the table.

So I captured the image by taking a screenshot of it. Plugged it into Gimp. I used the clone tool and recreated my image on a new layer. Then gradient shaded it until I had it the way I wanted it. Then I deleted the original captured screenshot image layer.

So as far as 'I' am concerned you are free to do as you please with that logo. If any lawyer comes after you we do not know each other. I believe honesty is the best policy but sometimes it has come back to bite me. Attribution is always nice but please do not go say Aruna went and took something without permission  :-X

So if you create an exact copy of an image and delete the original what are the legal aspects involved? I have no idea and if it renders on your browser pray tell me how are you going to stop anyone determined from grabbing a copy? So I did what I had to do. I am not encouraging anyone to follow suit.

I have attached a vector image for you.
« Last Edit: August 05, 2024, 02:32:39 am by Aruna »

alpine

  • Hero Member
  • *****
  • Posts: 1297
Re: Unable to move form out of visible screen area
« Reply #13 on: August 05, 2024, 08:45:12 am »
Quote
I love it too. Is there a vector format ? Open the image file using Inkscape, and save as plain SVG. Done!
Thanks for the attached image, but actually it isn't a true vector but a png embedded into. It can be traced, of course, but it must be non-"gradiented" for that.

About the negative Left - I've made some tests on Ubuntu 20.04.6 LTS, Xfce, Gtk2, Lazarus 2.2.4 (rev lazarus_2_2_4) FPC 3.2.2 x86_64-linux-gtk2. There is no problem, you can have Form.Left negative, but with a catch - for whatever reason the Left is preset to 0 at showing, no matter the value in designer, or the value programmatically set in OnCreate or OnShow. An extra LM_MOVE comes after (left=0) and I can't understand where it comes from. Probably from xfwm itself.
 
« Last Edit: August 05, 2024, 08:51:46 am by alpine »
"I'm sorry Dave, I'm afraid I can't do that."
—HAL 9000

Aruna

  • Hero Member
  • *****
  • Posts: 513
Re: Unable to move form out of visible screen area
« Reply #14 on: August 05, 2024, 02:04:10 pm »
Thanks for the attached image, but actually it isn't a true vector but a png embedded into. It can be traced, of course, but it must be non-"gradiented" for that.
I have attached the original screenshot I used. Hope it helps.

About the negative Left - I've made some tests on Ubuntu 20.04.6 LTS, Xfce, Gtk2, Lazarus 2.2.4 (rev lazarus_2_2_4) FPC 3.2.2 x86_64-linux-gtk2. There is no problem, you can have Form.Left negative, but with a catch - for whatever reason the Left is preset to 0 at showing, no matter the value in designer, or the value programmatically set in OnCreate or OnShow. An extra LM_MOVE comes after (left=0) and I can't understand where it comes from. Probably from xfwm itself.
What if we set a breakpoint on the Form.Left then walk through the code? I tried doing this and found SetBounds(). I am trying to understand the code but right now it is way over my head  :)

 

TinyPortal © 2005-2018