Quote from Gowtham on April 14, 2022, 9:29 am
Charlie,
Thanks for your invaluable help. I'm not a professional developer: I left programming behind (except for Oracle database coding, and dabbling in Visual Basic when I was a Uni Lecturer, when I became a Business/Systems Analyst decades ago). SelectArea app now works fine. Now moving onto SelectWindow app which I suspect will have its own difficulties: is it possible to identify Windows in the desktop screenshot?
This is and has been an issue. When you understand something you can create an account and then edit the help pages yourself.
I don't know how to create an account: how do I do it? I'm also a little worried that I might get an explanation wrong! How did you find out about Opacity=35?
You need to be careful here as I use the Cinnamon Desktop and my toolbar and System Tray is on the bottom of the screen.
I had vaguely thought about that before. I use standard Ubuntu Xenial, with systray panel & launcher panel left in standard positions. Your methods obviously cope with any Ubuntu flavour & I guess even standard Debian etc. ( I might check that out on my Raspberry Pi 3 using Raspbian, which I use for controlling cameras using Motion (much better for me than ZoneMinder), File Server (for all computers on home network), VPN (when I get it working!)).
This is a nasty one and I don't pretend to fully understand it but if you change the DrawingArea Cached property to True I think you will find that it is OK.
I changed the DrawingArea Cached property to True on my app (before incorporating your ideas) and it was OK (i.e. the popup stating 'Cannot Paint outside of Draw event handler' didn't happen).
For the Form that the user is going to 'draw' the rectangle, set the Form properties:-
Arrangement = Vertical
Border = False
Maximized = True
Opacity = 35
Put your DrawingArea on the Form and set the Expand property to True
With these settings the form and DrawingArea will expand to fill the whole screen (whatever the size). The opacity at 35 allows you to see the Desktop behind.
Have a look at the FMain form settings and layout in the attached then resize the form and you will see that you don't need to write any code to get these results.
Why is the 'Arrangement = Vertical' property setting necessary? It's interesting that the Expand property set to True results in filling the (available) desktop rather than the whole screen (i.e. excluding the Systray panel & the Launcher panel): the help is ambiguous about this.
I have previously looked at the book Introduction to Gambas. But it's rather out of date and the examples are so so IMO. In fact I bought the book a few years ago but recycled it as I find found it of little use to me. Gambas really needs a reference manual i.e. incorporating all the online & internet help but with more detail.