DesktopContainer signaling to the window it's in

Hi,

Are there any recommendations on best places to look on how to get a Container to signal to the Window it is in that a keystroke or some other event has happened?

Some background:
I have a DesktopContainer that includes a DesktopTextArea (TA) and other controls for formatting TA.
This container can be placed in a window, creating, e.g., myTxtContainer.
At runtime, controls and methods in the window can successfully read the current contents of TA with code like: someText= myTxtContainer.TA.Text.

I’m trying to satisfy several requirements:
The window should know when an event has happened in myTxtContainer so it can read the new contents.
myTxtContainer doesn’t need to know anything in particular about the window it’s been placed in.
The window only needs to know about TA in the container, and some event that signals a change has occurred inside the container.

The container’s FocusLost and FocusReceived events do not fire. Not sure why. The container instance in the window has Allow Focus checked, and so does its Super.
The container’s KeyDown and KeyUp events do not fire, as mentioned the docs.
The container’s MouseMove does fire.
The container has no TextChanged event, which would be the ideal event to see.

If I understand you correctly, you use “Event Definitions” and the RaiseEvent keyword, from your DesktopTextArea control up through the DesktopContainer to the DesktopWindow.

I put together a simple example:
RaiseEvent TextChanged.xojo_binary_project.zip (6.1 KB)

Note: I purposely renamed the Container’s Event Definition to TextChanged2 to help illustrate the path the raising of an event takes (and how you can customize your new event definition by adding a parameter).

Also look at the IDE Messages produced by the method in Window1, as you type something in the container’s TextArea.

Edited: to add better screen-shots

Great illustration. I can now see where RaiseEvent is used and that solves the problem.
Thanks!

1 Like