Jump to content

Popup window when adding torrent in wrong position


iycgtptyarvg

Recommended Posts

I switch a lot between my projector (1280x720) and my monitor (1600x1200). When I go to my monitor after having been on my projector, the window placement of the 'Add new torrent' popup window is incorrect (this is the window where you can select which files to download where). The window is too high up, which causes the titlebar to be off-screen. Therefore, I can't move the window.

Please make sure that when creating this window you check whether the RECT has valid coordinates:

int iLeft, iTop, iRight, iBottom;
RECT rc;

// Set the intended positions
// iLeft = ...;
// iTop = ...;
// iRight = ...;
// iBottom = ...;

// Set the positions
rc.left = Max(0, Min(iLeft, GetSystemMetrics(SM_CXSCREEN)));
rc.top = Max(0, Min(iTop, GetSystemMetrics(SM_CYSCREEN)));
rc.right = Max(0, Min(iRight, GetSystemMetrics(SM_CXSCREEN)));
rc.bottom = Max(0, Min(iBottom, GetSystemMetrics(SM_CYSCREEN)));

It is even better to use relative positions so the windows look the same on all resolutions:

double dLeftRel, dTopRel, dRightRel, dBottomRel;
RECT rc;

// Set the intended positions
// dLeftRel = ...;
// dTopRel = ...;
// dRightRel = ...;
// dBottomRel = ...;

// Set the positions
rc.left = (long)(Max(0.0, Min(dLeftRel, 1.0)) * GetSystemMetrics(SM_CXSCREEN))));
rc.top = (long)(Max(0.0, Min(dTopRel, 1.0)) * GetSystemMetrics(SM_CYSCREEN))));
rc.right = (long)(Max(0.0, Min(dRightRel, 1.0)) * GetSystemMetrics(SM_CXSCREEN))));
rc.bottom = (long)(Max(0.0, Min(dBottomRel, 1.0)) * GetSystemMetrics(SM_CYSCREEN))));

Link to comment
Share on other sites

  • 2 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...