Search code examples
pythonuser-interfacefiremonkey

How to make a ReadOnly Edit in a Python FMX GUI App


I made an Edit on a Form using the DelphiFMX Python Library, but how do I make an Edit that is read-only?

The user should be able to read text in the Edit, but not be able to enter their own text.

Here's my current code to make an Edit:

self.edt = Edit(self)
self.edt.Parent = self
self.edt.Align = "Center"
self.edt.Width = 500
self.edt.Height = 100
self.edt.Text = "Hello World"
self.edt.StyledSettings = ""
self.edt.TextSettings.Font.Size = 50

Solution

  • It has a ReadOnly boolean property that you can set to True:

    self.edt.ReadOnly = True
    

    But there's also an Enabled property that you can set to False:

    self.edt.Enabled = False