I would hate to paste function in each screen
I want placement of buttons and labels and textboxes different for different screens but most of functionality when buttons are clicked is exactly same
I would hate to paste function in each screen
I want placement of buttons and labels and textboxes different for different screens but most of functionality when buttons are clicked is exactly same
No you cannot make calls across screens. If the screens do nearly identical tasks, consider using 1 screen but change the visible property of controls or groups of controls
No. This is a big limitation of Thunkable. It has been requested at Project-Wide (ie Global) Function Defnintions · Issue #703 · thunkable/thunkable-issues · GitHub and it’s up for consideration.
The only way to do this effectively right now is to create a function while making sure that you initialize variables in a separate screen (to avoid duplicating variable definitions in the next step…) and then save the screen* and finally create a new screen using the saved screen as the source. That will copy the function to the second screen.
*I’m not sure you can do this with the new drag-and-drop interface but you definitely can in the legacy interface.
Thanks both of you
We are violating big principle of coding - Do not repeat code
@eko.devs.apploroceo please try to provide more detailed answers when you reply to anything. I see that a lot of your replies are simply ‘use apis’ without suggesting APIs to use, or how to use them. Such answers will not help anybody. While it’s great to see that you are an active member of the community, your answers will not help anybody when help is the thing they are looking for. I don’t see how you could put blocks of code in a variable. Up to my understanding, a variable contains a value, and can be used between screens, but cannot hold functions and code.
Agreed - it’s great to have lots of folks sharing and helping one another with their apps.
Also agreed. Since this question is specifically about using one function on multiple screens (which is currently not possible) I’m not sure why you were mentioning variables?
Tatiang has pointed out the best known work-around for this already, and Leena is right about trying to write “DRY” code.
It’s been great to see your knowledge increase during your time in the community @eko.devs.apploroceo - but please don’t just post for the sake of posting.
Thanks!
wat
i thought they can
if i get time i can explain as a guide
soon
No, this is not possible. @leena.ranexargq I think that you can select all the code within a function and do Ctrl + C(control and the letter c) to copy the code and then paste it in another screen(Ctrl + V). It works for me even with large pieces of code. Use Command + C and Command + V if you are on a Mac.
Thanks @codeswept