Re: wxDefaultCoord

Vadim Zeitlin <[email protected]>
Newsgroups gmane.comp.lib.wxwindows.general
Message-ID <[email protected]>
On Sat, 10 Aug 2024 12:51:24 +0200 Andreas Falkenhahn wrote:

AF> So methods like wxWindow::SetSize() support passing wxDefaultCoord to
AF> the x and y coordinates "to indicate that the existing value should be
AF> used" but then wxDefaultCoord is defined as -1 which is a perfectly
AF> normal position, isn't it? So shouldn't wxDefaultCoord be something
AF> like -1000000 or so instead to make it identifiable as a magic value?
AF> Defining it as -1 looks weird to me. What if I want to move the window
AF> to the position x=-1 and y=-1? Doesn't seem possible with the current
AF> handling of wxDefaultCoord or am I missing something here?

 You can use wxSIZE_ALLOW_MINUS_ONE flag to treat -1 as a valid position.

 And yes, an API designed in 2024 would look very differently from one
designed in 1994 as it would take std::optional<int> or something like
that. But in 1994 we didn't know that, and even multiple displays (without
which the value -1 can't be useful) were either non-existent or, at least,
very uncommon.

 Regards,
VZ

-- 
TT-Solutions: wxWidgets consultancy and technical support
              https://www.tt-solutions.com/
signature.asc (application/pgp-signature, 195 B)
-----BEGIN PGP SIGNATURE-----

iF0EABECAB0WIQQx+vLQdOwioQqkxtoG6kHeT2wehgUCZrdfEgAKCRAG6kHeT2we
hgc/AJ9aTSm/UZK2m8DpdLVx7T3Aqa/aZwCeNZkOOtkCtGwNfX/sDgNv+c2oCfY=
=TIMd
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.