Re: What is the correct way to response to the wxEVT_DPI_CHANGED event?
Maarten Bent <[email protected]>
| Newsgroups | gmane.comp.lib.wxwindows.general |
|---|---|
| Message-ID | <[email protected]> |
Hi,
Using 0 as the window parameter will indeed cause it to use the DPI of
the main display.
I think I couldn't reproduce because I moved FromDIP(wxSize(250,50));
(without the 0) to a separate line so I could debug the return values.
You are allowed to call FromDIP/ToDIP with a nullptr window, wxWidgets
internally does it too.
So I'm not sure if something like wxLogDebug("Determining DPI without a
valid wxWindow"); can be added.
Maarten
On 1 Apr 2023 15:52, AsmWarrior wrote:
> Hi, Vadim Zeitlin and Maarten Bent. I think I found a mistake.
>
> In my test code, it has such line:
>
> sizer->Add(new wxButton(page, wxID_ANY, _T("Hello World"),
> wxDefaultPosition, wxWindow::FromDIP(wxSize(250,50), 0)));
>
> Which is totally wrong here, because I have used the wrong argument
> for the FromDIP( wxSize(250,50), 0 ), the second argument 0 is totally
> wrong.
>
> Now, I have removed the second argument, and the result is: when I
> click the ResetMode button, I don't have the reduced button size.
> (Which shows in the third screen shot of the forum post here:
> How does the FromDIP function work under different DPI scaling? -
> wxWidgets Discussion Forum —
> https://forums.wxwidgets.org/viewtopic.php?f=1&t=50267)
>
> I'm sorry about that, I think it was a copy and paste error. Also,
> when we pass the second 0 argument, can the function report something,
> because it will call a function below:
>
> static wxSize wxWindow::FromDIP ( const wxSize & sz,
> const wxWindow * w
> )
> Where the w pointer is 0.
> Asmwarrior
>
>
> --
> Please read https://www.wxwidgets.org/support/mlhowto.htm before posting.
> ---
> You received this message because you are subscribed to the Google
> Groups "wx-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/wx-users/70175682-4376-4f62-a22f-7aa57b54d0f7n%40googlegroups.com
> <https://groups.google.com/d/msgid/wx-users/70175682-4376-4f62-a22f-7aa57b54d0f7n%40googlegroups.com?utm_medium=email&utm_source=footer>.
--
Please read https://www.wxwidgets.org/support/mlhowto.htm before posting.
---
You received this message because you are subscribed to the Google Groups "wx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/wx-users/ab755054-141f-5f92-be5b-7d5c94da59f9%40gmail.com.