![]() One reason is that when testing, the Debugger is displayed for any event that is raised if you have "Break On Exceptions" enabled in the Project menu. Since exceptions are for unexpected behavior, if you are able to avoid an error by preventing the exception from occurring then it is more efficient to do so. To do this, select Project > Break On Exceptions in the menu so that it has a checkmark next to it. When an exception is encountered in your code, you can choose to have the Debugger displayed at the line causing the exception. The act of causing an exception to occur is called raising an exception.Īll exception are subclasses of the RuntimeException class. These errors will crash your application if you do not handle them in some way. Once you've found the source of errors, you want to make sure you handle them properly.Įxceptions are a type of error that occur when something unexpected happens. The debugger can help you verify that your code is working as you expect and it can help you find errors. ![]() Reporting bugs and making feature requests.My coding experience has been as follows -ġ993 Sold a Debtors system programmed in TB, including a host of featuresġ994 Sold a stock control system done with TBĢ018 Depreciated my design studio and changed main focus to codingĢ018 - 2020 Created Development Tools using VB6 including a code analyser which is so usefulĢ021 Now solely focused on app development - VB6 and now XojoĢ021 June Version 0.1 private release for a new and very exciting app (A)Ģ021 Aug / Sept Projected Early Access Release for a Book browser with multiple featuresĢ022 Jan Version 0. You will have to excuse my noob questions. I read them very carefully and they are most helpful. Thanks Scott and Jeremie for your detailed answers. A Module acts like a global space to put values, data or even Methods that need to be accessed globally in your project. The Xojo IDE simplifies this by calling them both Methods and you decide whether to specify a return type (in the Inspector panel).Īnswer 6.) - To manage global variables of almost any type, attach them as Properties to either the default App Module/Class that comes with a starting project, or add a Module to your project. The only difference is that a Function returns a value, whereas a Sub does not. Property values will also be potentially different in each instance of the control or object, which is different behaviour than a Static variable.Īnswer 5.) - Xojo Methods are the same as a Sub or a Function. A properties value is retained across Events or Method calls (of the given control or object you attach the property too). For example, when using sub-classed controls, because the Static variable value could be the same in all instances of your sub-classed control (depending on how you use them).Īnother choice is to add a Property to the control or object. But be careful using Static variables, their use can get confusing. Your code example does not increment the value of vMode higher than 1.Īnswer 4.) - Yes, when using the Dim or Var keywords for declaring variables in an Event Handler (or Method for that matter), the variable is re-initialized on each call of the Event.Īlternatively, you can prevent “resetting” of a variable value by using the Static keyword. So: vMode = vMode + 1 gives you 0 + 1 = 1. Also please see the answer to question 2.Īnswer 2.) - Variables declared in an Event Handler are strictly local and will go out-of-scope at the end of execution of the given Event.Īnswer 3.) - Keep in mind that a variable of type Integer (that has no explicit assignment yet) has a default value of 0. Question/Answer 1.) - Where you declare a variable in Xojo, it is relevant only to the logic required of the given event. 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. In Visual Basic I used a lot of sub routines to handle specific processes. ![]() 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? However the variable seems to be stuck on a value of 1 I added a pushbutton control to a window to toggle a dual panel mode and added the following code. 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? I’ve been experimenting and declared a variable in a control’s ‘open’ event handler. When declaring a variable - is ‘action’ or ‘open’ the preferred place to declare them? I’m a Visual Basic 6 developer and just discovered and signed up to become a Xojo developer this week.
0 Comments
Leave a Reply. |