Create global function

In Thunkable X no global functions, but we can call them indirectly. The following illustrates one of the basic examples of how to call a function that is on the other screen.

Blocks for Screen1 (set timer loops = false)


Blocks for Screen2


An example can be viewed at the link


:heart: :+1:

Nice - I already wondered if this was possible but didn’t try it yet ^^

1 Like

from Alert Timer1 set Message

Should it be Alert1 rather than Timer1 here?

1 Like

Yes, as you need to specify the type of Alert. The fact that the list of props is dependent on the selected component type (not a coponent). We have for the component Alert property Message, while the Timer component is not. Therefore, as the component type, choose Alert.

Simply put, by choosing a suitable type, you can extend the functionality of existing components. Do you remember my example to change the font size in the Text Input? It uses a similar decision. I took the components that had this property Font Size and added it to the Text Input component that this property does not exist.

This method allows you to change the properties of some of the components, for which there are no blocks. Not necessarily to create blocks for all components. Enough to create many useful blocks for multiple components, and then apply them to the other. I wrote about this, but if you like this idea, then I ask you to recall Mark about it. Thunkable X can be a very interesting tool, but it depends entirely on the developer and some of us - members.

1 Like

Please note that my method can also work with the values ​​of properties for the components that are on the other screen. This can be used, for example, to pre-load or execute actions that previously could be done only in the block Open.