Error when changing VCL styles. DelphiVCL 1.0.3
IanC216 opened this issue · 11 comments
This issue has already been raised (issue #50, on March 18th by @fansxs). I started a discussion on the same topic, and @lmbelo asked me to raise it as an issue again.
The ActivityIndicator.py demo crashes when I try to change style. The "__on_load_style_click" function crashes at line:
"valid_style, style_info = self.__sm.IsValidStyle(style_file_path)".
Python (v3.10) returns the error message "TypeError: cannot unpack non-iterable bool object".
Removing the "style_info" variable allows the line to run, but then a different error is raised at the line "self.__sm.LoadFromFile(style_file_path)" :
TypeError: Call "LoadFromFile" returned a value that could not be converted to Python
Error: Unsupported conversion from TValue to Python value
@lmbelo Some more information that might be useful to you. When I run activityindicator.py from the console rather than in PyCharm, I get a different error. This appears immediately after choosing a valid folder from the 'Select the VCL Styles directory' dialog.

Using a freshly compiled pyd from the current version found in Github gives no error any more. And browsing the history of WrapVclThemes.pas gives no clue why it does not work in delphivcl.pyd 1.03.
@lmbelo Some more information that might be useful to you. When I run activityindicator.py from the console rather than in PyCharm, I get a different error. This appears immediately after choosing a valid folder from the 'Select the VCL Styles directory' dialog.
I believe you were seeing this issue because the console was being freed. Look for the FreeConsole method in your code.
I must rectify my comment from 07 AUG 2023: a fresh compile of version 1.03 does not work, and also not for the new release version 1.04 (and also not directly from PIP install delphivcl)!
The source code for D4P is found in P4D, and we must note that there are three "official" repositories of P4D:
- GetIt repository: old version 1.0, VCL styles works fine.
- PyScripter GitHub repository: also works (last commit 02 AUG 2023).
- Embarcaderor GitHub repository: fails (last commit 03 SEP 2023).
The source code for WrapVclThemes.pas is the same in PyScripter and Embarcadero, so I am not sure where the problem is.
@MGBergweiler I'm able to reproduce the issue. I'm working on fixing it.
@lmbelo I just found out that by disabling $DEFINE EXPOSE_MEMBERS, the method IsValidStyle_Wrapper now does get called, and the problem is gone.
Right! The statically wrapped method is being overridden by the dynamically exposed method.
I got this fixed. It will be available in next release.
@MGBergweiler and @IanC216, there's a new version available on pypi. Can you confirm it works on this latest version, please?
Thanks, is working fine here!

