On Mar 6, 2006, at 4:42 AM, Stefan Thurnherr wrote:
Hi all, I am having a hard time trying to get an EditField with StyledText to run. I get NilObjectExceptions when trying to assign text to MyEditField.StyledText.Text. Here are the steps to reproduce what I don't understand: 1. Create a new RB project. 2. Add an EditField (say myEf) to Window1 (the default window). 3. In myEf's Open() event, programmatically set me.styled=true and me.multiline=true. 4. Then programmatically add some text, e.g.: myEf.styledText.text="Firstline"+EndOfLine+"secondline.". 5. Run the app; it will cause a NilObjectException at the line mentioned above (my config is RB2006r1 on WinXP).
The immediate cause of the NilObjectException is probably that myEf.StyledText returns nil. REALbasic almost never guarantees that a function will return a non-nil object (in fact, I can't find any documentation that the New operator never returns nil), so you must check the return value of any function or property, or be prepared to handle a NilObjectException.
-------------- Charles Yeomans _______________________________________________ Unsubscribe or switch delivery mode: <http://www.realsoftware.com/support/listmanager/> Search the archives of this list here: <http://support.realsoftware.com/listarchives/lists.html>
