Embarcadero / DelphiFMX4Python

Python GUI module powered by Delphi's FireMonkey framework. Supporting Windows, MacOS, Linux, and Android GUI development.
Other
298 stars 55 forks source link

Memo.VScrollBar doesn't exist #58

Open shaunroselt opened 1 year ago

shaunroselt commented 1 year ago

Normally in Delphi I would do Memo1.VScrollBar.Value := self.Memo1.VScrollBar.Max; to scroll to the bottom of a Memo. I tried doing this in Python, but it doesn't work.

Here's a code example in Python:

self.Memo1 = Memo(self)
self.Memo1.Parent = self
self.Memo1.Align = "Client"

for i in range(1000):
    self.Memo1.Lines.Add("This is a test: " + str(i))

self.Memo1.VScrollBar.Value = self.Memo1.VScrollBar.Max

The error is: AttributeError: 'NoneType' object has no attribute 'Max'

Or am I maybe using it wrong in Python?

lmbelo commented 1 year ago

VScrollBar returns nil for native presentation. Check it out: https://docwiki.embarcadero.com/Libraries/Alexandria/en/FMX.ScrollBox.TCustomPresentedScrollBox.VScrollBar

AttributeError: 'NoneType' object has no attribute 'Max'

When it says 'NoneType', it means you are accessing a nil reference from Delphi.

shaunroselt commented 1 year ago

Ah, I see. That makes sense.

Do you maybe know how I can scroll to the bottom of the memo if there aren't any styles that are used?