AdvancedGadgetEvents() does not exist ?

Just starting out? Need help? Post your questions and find answers here.
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

> ResizeGadget() also uses -1 to keep the old position, and nobody ever had
> a problem with that, why should it be a problem with ResizeWindow() ?

Because I never thought that I might want to position something at -1,-1
before... it's probably not a common thing to do, I guess. I suppose it's
fine the way it is -- I could always just do -2,-2 instead of -1,-1 -- right?
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

yes.
quidquid Latine dictum sit altum videtur
User avatar
nco2k
Addict
Addict
Posts: 1344
Joined: Mon Sep 15, 2003 5:55 am

Post by nco2k »

@freak
what if my app saves the size and position of the window, on exit.

the user has moved the window to -1 on x/y.

now i load the saved settings and set the window position to x/y -1, but it wont work, right? :wink:

edit:

Code: Select all

If OpenWindow(0, 0, 0, 640, 480, #PB_Window_SystemMenu | #PB_Window_ScreenCentered, "")
  ResizeWindow(0, -1, -1, WindowWidth(0), WindowHeight(0))
  While WaitWindowEvent() <> #PB_Event_CloseWindow : Wend
EndIf
End
jipee it wont work, as i thought.

c ya,
nco2k
If OSVersion() = #PB_OS_Windows_ME : End : EndIf
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

> the user has moved the window to -1 on x/y
> now i load the saved settings and set the window position to x/y -1, but
> it wont work, right?

Exactly. But as I said above, we'll just have to amend it so that if the loaded
X or Y position is -1, to change it to -2 instead, and hope the user doesn't
notice the 1-pixel difference. ;)

@Fred/Freak: A serious suggestion: Instead of -1 meaning "don't move", why
not make it something a user would never use, like -99999, and then have a
custom PureBasic constant for it, like #STAY? Then the user could code it like:

Code: Select all

ResizeWindow(0, #STAY, #STAY, NewWidth, NewHeight)
That should be a simple thing to implement, as it's just changing the value
used for "don't move" and throwing in a constant definition for it... yes?
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
User avatar
nco2k
Addict
Addict
Posts: 1344
Joined: Mon Sep 15, 2003 5:55 am

Post by nco2k »

@PB
he probably wont notice the difference, but where is the meaining of this? if the user wants the position of -1 for some reason, then he should get -1. we are not allowed to mess with the users choice, otherwise he will blame the coder and not the programming language.

my grandma always told me, if you do something, then do it right, otherwise dont do it. :wink:

as i told, imo ResizeWindow() and MoveWindow() is a much better choice.

and @freak ResizeGadget() is completely different thing, there is no real need to set a gadget to negative values. but for a window, negative values are common. even if you just minimize the app, the x/y values become -32000.

c ya,
nco2k
If OSVersion() = #PB_OS_Windows_ME : End : EndIf
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

> if the user wants the position of -1 for some reason, then he should get -1

I agree totally with you! :) My example of moving it to -2,-2 was if PureBasic
doesn't allow ResizeWindow to move a window to -1,-1... what else can we do?

My second example of using something like -99999 is better because a user
would never be able to physically move a window to that position, whereas
they could move it to -1,-1 quite easily (and also even perhaps automatically,
when docked windows come into consideration?). Food for thought, anyway.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
User avatar
nco2k
Addict
Addict
Posts: 1344
Joined: Mon Sep 15, 2003 5:55 am

Post by nco2k »

@PB
> what else can we do?
using the winapi. :lol:

but i still hope MoveWindow() and ResizeWindow() will be like in pb3.94. :cry:

c ya,
nco2k
If OSVersion() = #PB_OS_Windows_ME : End : EndIf
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Post by Dare2 »

Just to put another view (or vote) to this, and FWIW, I prefer the new approach. I would hate to see it revert.

:)
@}--`--,-- A rose by any other name ..
Fred
Administrator
Administrator
Posts: 18210
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

We will probably introduce a new constant as -1 cause some problem.
Berikco
Administrator
Administrator
Posts: 1326
Joined: Wed Apr 23, 2003 7:57 pm
Location: Belgium
Contact:

Post by Berikco »

Fred wrote:We will probably introduce a new constant as -1 cause some problem.

Code: Select all

ResizeWindow(0, #NoChange, #NoChange, NewWidth, NewHeight)
Something like this sounds ok to me :)
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

yes please, as on multi monitor setups -1,-1 is a very legitimate coordinate! in fact, when dealing with virtual display devices, you may run into any sort of coordinates, i just ran into the -1,-1 issue with windows myself :-(
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

Or like this:

Code: Select all

ResizeWindow(0, #CW_USEDEFAULT, #CW_USEDEFAULT, NewWidth, NewHeight)
Constant declared
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
Berikco
Administrator
Administrator
Posts: 1326
Joined: Wed Apr 23, 2003 7:57 pm
Location: Belgium
Contact:

Post by Berikco »

ts-soft wrote:Or like this:

Code: Select all

ResizeWindow(0, #CW_USEDEFAULT, #CW_USEDEFAULT, NewWidth, NewHeight)
Constant declared
It wil take some time before displays get that big resolution :D
But i prefer something more a PB constant ;)
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

pb constant = cross platform
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
User avatar
nco2k
Addict
Addict
Posts: 1344
Joined: Mon Sep 15, 2003 5:55 am

Post by nco2k »

i think #PB_NoChange = -999 or -9999 (like PB said) should be good enough.

c ya,
nco2k
If OSVersion() = #PB_OS_Windows_ME : End : EndIf
Post Reply