Hi
I’m a Visual Basic 6 developer and just discovered and signed up to become a Xojo developer this week. I’m self taught.
Question 1
When declaring a variable - is ‘action’ or ‘open’ the preferred place to declare them?
Question 2
I’ve been experimenting and declared a variable in a control’s ‘open’ event handler. Under the ‘action’ event handler it says that ‘the item does not exist’ Are variable declarations so local that they are not shared by events?
Question 3
I added a pushbutton control to a window to toggle a dual panel mode and added the following code -
var vMode As Integer
vMode = vMode + 1
if vMode=2 then vMode=0
if vMode=1 then
me.caption=“Dual On”
Else
me.caption=“Dual Off”
End If
However the variable seems to be stuck on a value of 1
Question 4
When declaring / initialising a variable in an event handler, does it initialise every time the event handler is called or is the variable just declare once? Ddoes the value reset to it’s declared value every time the event handler is used?
Question 5
In Visual Basic I used a lot of sub routines to handle specific processes. With Xojo do I now use Methods. What’s the best practise for this?
Question 6
I have a lot of arrays and variables that need to be used by many controls, should these be declared in a Method as global variables? I have tried this but I get an ‘Item not found’ error.