Memo generates access violation error
Ariel-MN opened this issue ยท 26 comments
The Memo component generates an access violation error after changing the style of the application.
Example code:
import os
from delphivcl import *
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
class MainForm(Form):
def __init__(self, owner):
self.Caption = "Test Memo"
self.SetBounds(10, 10, 500, 400)
self.Position = "poScreenCenter"
# Memo component
self.txtMemo = Memo(self)
self.txtMemo.SetProps(Parent=self)
self.txtMemo.SetBounds(10, 40, 300, 100)
# Auto-load new style
self.__sm = StyleManager()
self.__load_style()
def __load_style(self):
self.__sm.LoadFromFile(os.path.join(BASE_DIR, "Windows11_Modern_Dark.vsf"))
self.__sm.SetStyle(self.__sm.StyleNames[1])
def main():
Application.Initialize()
Application.Title = "Checking DelphiVCL4Python"
Main = MainForm(Application)
Main.Show()
Application.Run()
Main.Destroy()
if __name__ == '__main__':
main()I tested with the same code you sent and found no such error. I even added one more style and printed them to the Memo. Please find the code and the GUI output result image.
import os
from delphivcl import *
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
class MainForm(Form):
def __init__(self, owner):
self.Caption = "Test Memo"
self.SetBounds(10, 10, 500, 400)
self.Position = "poScreenCenter"
# Memo component
self.txtMemo = Memo(self)
self.txtMemo.SetProps(Parent=self)
self.txtMemo.SetBounds(10, 40, 300, 100)
# Auto-load new style
self.__sm = StyleManager()
self.__load_style()
self.txtMemo.Lines.Add(f"Number of loaded styles: {len(self.__sm.StyleNames)}")
self.txtMemo.Lines.Add("The loaded Styles are:")
self.txtMemo.Lines.Add(self.__sm.StyleNames[0])
self.txtMemo.Lines.Add(self.__sm.StyleNames[1])
self.txtMemo.Lines.Add(self.__sm.StyleNames[2])
def __load_style(self):
self.__sm.LoadFromFile(os.path.join(BASE_DIR, "Windows10SlateGray.vsf"))
self.__sm.LoadFromFile(os.path.join(BASE_DIR, "SapphireKamri.vsf"))
self.__sm.SetStyle(self.__sm.StyleNames[2])
def main():
Application.Initialize()
Application.Title = "Checking DelphiVCL4Python"
Main = MainForm(Application)
Main.Show()
Application.Run()
Main.Destroy()
if __name__ == '__main__':
main()The error is because you might not have permission to access the Windows11_Modern_Dark.vsf style file.
I have all users full permission on the style file properties and have no problem using the same style file in an app with other components.
The application runs but it is impossible to interact with it as it generates this error that keeps reappearing in a loop.

Im using:
- Windows 11
- Python 3.10.2
- delphivcl 0.1.34
In my environment the error is consistent even using other styles.
Okay, fine. Thanks for more details. @Ariel-MN you meant that this error is getting generated when using the Memo component only and runs fine with other components? And did you try any other styles with the Memo component to test their working status with the Memo?
Absolutely. The error only happens with the Memo component and not with others and I have tried with several styles obtaining the same result.
Weird! You can see it running without any issue in the reply I posted above right? Maybe, we'll need to simulate your exact environment (OS and python version) and try it once. Will get back with more news as we figure out anything new on this.
Thank you so much and we appreciate you keep trying and testing more.
Most likely something regarding the Win 11. Are you using Python x86 or x64?
@Priyatham10 You are very welcome. Unfortunately your script produced the same result as mine in both of my environments.
@lmbelo I am using Python x86. I can confirm that it is not related to the version of Windows, I have tried it on another PC and am running into the same issue in this environment:
- Windows 10
- Python 3.9.7
- delphivcl 0.1.34
@Ariel-MN I really can't reproduce this issue. I have tried in Win 11 and even in Win 10, it's working in both.
@lmbelo If it can be useful I can offer you access through teamviewer to one of my environments.
@Ariel-MN It would be great.
Please, send an e-mail to lucas.belo@live.com to schedule a date.
Thank you for your interest and support.
I was finally able to reproduce this issue under Python x64 architecture. It does run well under Python x86.
I realized this is something regarding the new ComCtrls library. It occurs when the SystemStyle is enable, which may happen when using a comctrls32.dll >= 393216.
We have a ticket at https://quality.embarcadero.com/browse/RSP-37835.
I will provide a workaround soon.
I have the workaround done. I hope to get it available in our next release.
That's very good news. I'll be waiting for the new version. Thank you.
A new release is available ๐
Can you try again, please?
@lmbelo, fixed in version 1.0.39, although this new version seems to have broken compatibility with the new Class TNumberBox added in v. 1.0.38.
@lmbelo, now everything works perfectly. Even other High DPI related issues have been fixed with Delphi 11.
@lmbelo, now everything works perfectly. Even other High DPI related issues have been fixed with Delphi 11.
Fabulous ๐
Can we close this issue?
Sure, go ahead.
