[quote=19096:@Alexander van der Linden]In a Module I define a Class (CDDClass) with some properties, its scope = Global
In the Action event of a Button I create an instance with
dim newCDD as new CDDClass
[/quote]
The problem is with the “Dim” statement. That creates a variable that is local to the Action event of the Button and not available anywhere else. You need to add a Property to the Window or the Module or the App and instantiate a New CDDClass into that property. Then it will be available in the next panel.
Still some problems. I have defined a Property to the window and instantiated a new CDDClass into it, just like Tim said.
The IDE gives me in the autocomplete all the properties. When I use one of the properties I get a ‘NilObjectException’…
I am sure I’m lacking some deeper understanding of Xojo classes, but I can’t get it to work right now…
if kauferButton.Value = True then
newCDD.Type ="Kaufer"
elseif verkauferButton.value = True then
newCDD.Type = "Verkaufer"
elseif dienstleistungButton.value = True then
newCDD.Type = "Dienstleistung"
end if
Yes[quote=19112:@Beatrix Willius]ago Beta Testers
And the NOE occurs at newCDD.Type = “Kaufer”??? What does the debugger tell you about newCDD? Did you set it to Nil somewhere?[/quote]
Yes. No… I double checked…
That is the important piece. newCDD will be in the scope of the location where it is created.
If it is created in a button action event… it vanishes when that event completes
If it isi created in a Window… it is available to that window only (or via window1.newcdd) only while that window is in scope.
If it is created a global in a Module than it is avaliable across the application (once it has been instantiated of course)
Is everything working now or do you still need help? Do you want me to have a short look at your computer via Skype either today or tomorrow afternoon?
[quote=19136:@Dave S]and where in your code is your “NEW” statement…
newCDD= = new CDDClass
That is the important piece. newCDD will be in the scope of the location where it is created.
If it is created in a button action event… it vanishes when that event completes
If it isi created in a Window… it is available to that window only (or via window1.newcdd) only while that window is in scope.
If it is created a global in a Module than it is avaliable across the application (once it has been instantiated of course)[/quote]
OK, I have this class and its properties defined in a module called ‘Globals’. If I understand the function of a module correctly, then classes/properties/methods etc are available in every part of the application.
In the Open event of the window I instantiate this class with: dim newCDD as new CDDclass. So far, so good? Do I have to bind the class to a Window property also? Don’t see the point in this…[quote=19166:@Beatrix Willius]Is everything working now or do you still need help? Do you want me to have a short look at your computer via Skype either today or tomorrow afternoon?[/quote]