GUI on diffrent tabs
Posted: Sun Aug 23, 2020 7:08 pm
I have created my first LiveCode project, and I based it on an idea of separating the GUI in different tabs, inspired by this tutorial: lessons[dot]livecode[dot com]/m/4071/l/7574-using-tab-buttons
I have now completed the contents of tab 1, there I have a number of user controls in the form of buttons, switches, label fields etc. The function is basicly setting up a timer, and the main timer code is placed in the stack, where it fire a call to itself every 1 seconds. It all works fine.
Now I moved on to create contents in tab 2. There I basicly only need the present timer value, which I have in a global variable. Based on the present timer value I now want different things to happens when I click different buttons in tab 2.
But as soon as, while running, I switch to tab 2 two things happens:
- The functions I have placed in the scripts of buttons placed on tab 2 can not read the global variable.
- The functions running in the stack, which where working fine as long as I had tab 1 selected, can no longer read the status of any buttons etc.
It's as if nothing of the buttons etc in tab 1 are defined at all, and as the stack script calls itself every 1 seconds and are dependent on these, it all comes crashing down as soon as I click tab 2!
I assume I have totally misunderstood the functionality of how the different objects communicate and I now have the wrong structure of my code. But what should I have done to get this to work, is it possible to fix it?
I have now completed the contents of tab 1, there I have a number of user controls in the form of buttons, switches, label fields etc. The function is basicly setting up a timer, and the main timer code is placed in the stack, where it fire a call to itself every 1 seconds. It all works fine.
Now I moved on to create contents in tab 2. There I basicly only need the present timer value, which I have in a global variable. Based on the present timer value I now want different things to happens when I click different buttons in tab 2.
But as soon as, while running, I switch to tab 2 two things happens:
- The functions I have placed in the scripts of buttons placed on tab 2 can not read the global variable.
- The functions running in the stack, which where working fine as long as I had tab 1 selected, can no longer read the status of any buttons etc.
It's as if nothing of the buttons etc in tab 1 are defined at all, and as the stack script calls itself every 1 seconds and are dependent on these, it all comes crashing down as soon as I click tab 2!
I assume I have totally misunderstood the functionality of how the different objects communicate and I now have the wrong structure of my code. But what should I have done to get this to work, is it possible to fix it?