-
-
Notifications
You must be signed in to change notification settings - Fork 799
Winforms detailed list revamp #4319
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
Merged
freakboy3742
merged 38 commits into
beeware:main
from
Oliver-Leigh:winforms-detailed-list-revamp
Apr 28, 2026
Merged
Changes from 24 commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
d8d83cf
Windows DetailedList widget revamp
Oliver-Leigh 4dfc544
Move some constants from user32 to windowconstants
Oliver-Leigh c78a935
Removed DetailedList references from Table
Oliver-Leigh 9449409
Add probe methods for existing tests
Oliver-Leigh 6288581
Added deselect test for code coverage
Oliver-Leigh 5488dea
Updated the documentation
Oliver-Leigh 1c8dd38
Added change notes
Oliver-Leigh cb8516d
Fixed TextInput test placeholder type
Oliver-Leigh 00faba2
Updated iOS test probe
Oliver-Leigh 2eb4beb
Updated iOS test probe, II
Oliver-Leigh a0cc900
Updated iOS test probe, III
Oliver-Leigh ab9374d
Changed/simplified WinForms test probe "click"
Oliver-Leigh c363887
Bug fix - Context menu over no item
Oliver-Leigh 4ad5af3
Changes to WinForms test probe "click"
Oliver-Leigh de0df59
Add SetForegroundWindow to WinForms probe "click"
Oliver-Leigh 7eb8d19
Add deselect test to Android probe
Oliver-Leigh 29915c9
Added refresh to the context menu
Oliver-Leigh a02059f
Added WinForms probe refresh functionality
Oliver-Leigh 6ae2d51
More robust click handling
Oliver-Leigh 7514d3b
Updated WinForms probe
Oliver-Leigh 1b7b203
Add common control v6 using activation context
Oliver-Leigh b94ed30
Minor changes to docs, probe and comments
Oliver-Leigh 50add47
Minor changes to change log, probe and comments
Oliver-Leigh 245ba48
Removed extra dpi activation from manifest
Oliver-Leigh 354a74e
Minor changes and fixes to lib files
Oliver-Leigh baa4225
Updated manifest file
Oliver-Leigh eb81e7a
Minor fixes and changes to libs and probe
Oliver-Leigh 556269d
Minor changes to probe
Oliver-Leigh 0f772fc
Use a context manager for the activation context
Oliver-Leigh 0bcc506
Restructure win32 lib files
Oliver-Leigh d4c45c6
Merge branch 'main' into winforms-detailed-list-revamp
freakboy3742 903322a
Fix coverage line that can't be hit in CI.
freakboy3742 332cd7c
Reduce number of rows in Tree widget test
Oliver-Leigh 3e405bb
Minor change to get test coverage
Oliver-Leigh 5433566
Font change support
Oliver-Leigh b889337
Merge branch 'main' into winforms-detailed-list-revamp
freakboy3742 ecf170f
Revert test data size change as an experiment.
freakboy3742 da2f1a6
Revert to size 10 list for cell tests.
freakboy3742 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| The DetailedList widget on Windows now supports primary and secondary actions via a context menu. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| The DetailedList widget on Windows now supports the refresh action via a context menu. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| The style of the DetailedList widget on Windows now matches the other platforms. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| import functools | ||
| from collections.abc import Callable | ||
| from ctypes import WinDLL, WinError, byref, get_last_error, sizeof | ||
| from pathlib import Path | ||
|
|
||
| from . import windowconstants as wc | ||
| from .kernel32 import ActivateActCtx, CreateActCtxW, DeactivateActCtx, ReleaseActCtx | ||
| from .kernel32classes import ACTCTXW | ||
| from .win32 import ULONG_PTR | ||
|
|
||
|
|
||
| def activation_context(input_function: Callable): | ||
| """A wrapper to call functions within the Toga activation context. | ||
|
|
||
| This is primarily used for Common Control version 6, and is based on the built-in | ||
| wrapper that is used when the ISOLATION_AWARE_ENABLED macro is employed. This is | ||
| described by Raymond Chen here: | ||
| https://devblogs.microsoft.com/oldnewthing/20140508-00/?p=1043 | ||
| """ | ||
|
|
||
| @functools.wraps(input_function) | ||
| def call_with_activation_context(*args, **kwargs): | ||
| manifest_path = str( | ||
| Path(__file__).parent.parent / "resources" / "win32.manifest" | ||
| ) | ||
|
|
||
| cookie = ULONG_PTR() | ||
| actctx = ACTCTXW() | ||
| actctx.cbSize = sizeof(ACTCTXW) | ||
|
|
||
| # It is implicit in the ACTCTXW documentation that when using a manifest only | ||
| # lpSource and cbSize need to be set. | ||
| actctx.lpSource = manifest_path | ||
|
|
||
| # According to the ACTCTXW documentation, the manifest will be assumed to be | ||
| # written in the current user's current UI language. So, specify that the | ||
| # manifest is written in US English. | ||
| actctx.wLangId = 1033 | ||
|
|
||
| # Create a handle and activation context from ../resources/win32.manifest. | ||
| handle_actctx = CreateActCtxW(byref(actctx)) | ||
| if handle_actctx == wc.INVALID_HANDLE_VALUE: # pragma: no cover | ||
| # This is not expected to fail. | ||
| raise WinError( | ||
| descr="CreateActCtxW failed to create a handle from win32.manifest.", | ||
| code=get_last_error(), | ||
| ) | ||
|
|
||
| # Activate the activation context. | ||
| if not ActivateActCtx(handle_actctx, byref(cookie)): # pragma: no cover | ||
| # This is not expected to fail. | ||
| raise WinError(descr="ActivateActCtx failed for win32.manifest.") | ||
|
|
||
| # Call the input function. | ||
| function_output = input_function(*args, **kwargs) | ||
|
|
||
| if not DeactivateActCtx(0, cookie): # pragma: no cover | ||
| # This is not expected to fail. | ||
| raise WinError( | ||
| descr="DeactivateActCtx failed for win32.manifest.", | ||
| code=get_last_error(), | ||
| ) | ||
|
|
||
| ReleaseActCtx(handle_actctx) | ||
|
|
||
| return function_output | ||
|
|
||
| return call_with_activation_context | ||
|
|
||
|
|
||
| @activation_context | ||
| def WinDLL_activation_context(library: str): | ||
| return WinDLL(library) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| from ctypes import windll | ||
| from ctypes.wintypes import COLORREF, HDC | ||
|
|
||
| gdi32 = windll.GDI32 | ||
|
|
||
|
|
||
| # https://learn.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-settextcolor | ||
| SetTextColor = gdi32.SetTextColor | ||
| SetTextColor.restype = COLORREF | ||
| SetTextColor.argtypes = [HDC, COLORREF] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.