Author Topic: FromDIP need in the wxSmith generated code?  (Read 6207 times)

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6036
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
FromDIP need in the wxSmith generated code?
« on: December 05, 2023, 09:09:13 am »
Hi, it looks like there are so many monitors which has DPI scaling such as 150% or 200%.

I found that some wxSmith generated GUI works OK in one PC, but works badly on another PC. My guess is that the code generated by wxSmith is not using the FromDIP function call, so it can't handle the DPI issue.

Any ideas?
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1633
Re: FromDIP need in the wxSmith generated code?
« Reply #1 on: December 05, 2023, 09:44:57 am »
A search for FromDIP() in wxSmith returned nothing.

Fortunately, code generation for wxSize and wxPoint is centralized in wxspositionsizeproperty.cpp and wxsdimensionproperty.cpp. On the other side, wxSmith does not use FromDIP() itself, so it must be heavily edited.

Adding the FromDIP() may break existing wxSmith dialogs, but HiDPI in wxwidgets is so new that IMHO they will not be a lot.

EDIT: FromDIP() was added in wx3.1.0, but we still support wx3.0.x for C::B itself and code generated by wxSmith.
« Last Edit: December 05, 2023, 10:05:53 am by Miguel Gimenez »

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6036
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: FromDIP need in the wxSmith generated code?
« Reply #2 on: December 05, 2023, 11:38:55 am »
OK, I think we can wait until wxSmith drops the wx 3.0 support.  ;)
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.