AdvancedGadgetEvents() does not exist ?
> 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?
> 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.
"PureBasic won't be object oriented, period" - Fred.
@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?
edit:
jipee it wont work, as i thought.
c ya,
nco2k
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?

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
c ya,
nco2k
If OSVersion() = #PB_OS_Windows_ME : End : EndIf
> 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:
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?
> 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)
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.
"PureBasic won't be object oriented, period" - Fred.
@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.
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
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.

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
> 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 agree totally with you!

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.
"PureBasic won't be object oriented, period" - Fred.
Fred wrote:We will probably introduce a new constant as -1 cause some problem.
Code: Select all
ResizeWindow(0, #NoChange, #NoChange, NewWidth, NewHeight)

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... )
( The path to enlightenment and the PureBasic Survival Guide right here... )
Or like this:
Constant declared
Code: Select all
ResizeWindow(0, #CW_USEDEFAULT, #CW_USEDEFAULT, NewWidth, NewHeight)
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.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

It wil take some time before displays get that big resolutionts-soft wrote:Or like this:Constant declaredCode: Select all
ResizeWindow(0, #CW_USEDEFAULT, #CW_USEDEFAULT, NewWidth, NewHeight)

But i prefer something more a PB constant

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... )
( The path to enlightenment and the PureBasic Survival Guide right here... )