Page 2 of 3
Posted: Sat Feb 04, 2006 2:41 pm
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?
Posted: Sat Feb 04, 2006 2:46 pm
by freak
yes.
Posted: Sat Feb 04, 2006 2:47 pm
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?
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
Posted: Sat Feb 04, 2006 2:56 pm
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?
Posted: Sat Feb 04, 2006 3:09 pm
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.
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
Posted: Sat Feb 04, 2006 3:16 pm
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.
Posted: Sat Feb 04, 2006 3:20 pm
by nco2k
@PB
> what else can we do?
using the winapi.
but i still hope MoveWindow() and ResizeWindow() will be like in pb3.94.
c ya,
nco2k
Posted: Sat Feb 04, 2006 3:38 pm
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.

Posted: Sat Feb 04, 2006 3:46 pm
by Fred
We will probably introduce a new constant as -1 cause some problem.
Posted: Sat Feb 04, 2006 4:02 pm
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

Posted: Sat Feb 04, 2006 4:06 pm
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

Posted: Sat Feb 04, 2006 4:07 pm
by ts-soft
Or like this:
Code: Select all
ResizeWindow(0, #CW_USEDEFAULT, #CW_USEDEFAULT, NewWidth, NewHeight)
Constant declared
Posted: Sat Feb 04, 2006 4:32 pm
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

But i prefer something more a PB constant

Posted: Sat Feb 04, 2006 5:01 pm
by blueznl
pb constant = cross platform
Posted: Sat Feb 04, 2006 5:28 pm
by nco2k
i think #PB_NoChange = -999 or -9999 (like PB said) should be good enough.
c ya,
nco2k