Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Menu dropdowns right aligned on touchscreen pcs. #46

Open
MShark67 opened this issue Apr 1, 2019 · 3 comments
Open

Menu dropdowns right aligned on touchscreen pcs. #46

MShark67 opened this issue Apr 1, 2019 · 3 comments

Comments

@MShark67
Copy link

MShark67 commented Apr 1, 2019

Currently applications made with the SpTBX will show menus as right aligned to their parent button on touchscreen pcs. This is due to the GetSystemMetrics(SM_MENUDROPALIGNMENT) call in TB2Items.pas. Touchscreen PCs return a non-zero value for this to indicate right alignment (supposedly this default is because most using a touch screen are right handed.) On the surface this would appear to be the correct thing to do, but no other applications seem to adhere to this which makes SpTBX (or TB2 really) applications stand out. It seems this metric should only be used for popup menus and not drop down ones (or at least that appears to be the convention.) This is specifically an issue in TB2Items.pas and not in SpTBX code. This change would have to be part of the TBX patch.

@pyscripter
Copy link

Do you know exactly what needs to be changed?

@MShark67
Copy link
Author

MShark67 commented Sep 22, 2020

[Update: For some reason the insert code option isn't formatting correctly for me (I must be doing it wrong.) Basically remove the "if GetSystemMetrics(SM_MENUDROPALIGNMENT) = 0 then " condition and replace it with "X := ParentItemRect.Left" This is at line 1844 in my version of TB2Item.pas.]

In TB2Item.pas change the following:

if GetSystemMetrics(SM_MENUDROPALIGNMENT) = 0 then X := ParentItemRect.Left else X := ParentItemRect.Right - W;
to:
X := ParentItemRect.Left;

Thanks for your work on sptbx!

@pyscripter
Copy link

By the way there are Windows options controlling this behavior. See https://www.tenforums.com/tutorials/68038-set-menus-open-aligned-left-right-windows-10-a.html

I think it is best left as is and let the users change the Windows option. This option affects other applications as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants