1

Why the next program produce the runtime error message "Error (R3) : Calling Function without definition !: init"

load "guilib.ring"
new qApp() {
    new qWidget() { 
        setWindowTitle("First App!") 
        resize(400,400) 
        show() 
    }
    exec()
}
Ibn Nile
  • 47
  • 4

1 Answers1

1

The next code will fix your problem

Load "guilib.ring"
New qApp {
    New qWidget() { 
       setWindowTitle("First App!") 
       resize(400,400) 
       show() 
    }
    exec()
}

Using () after the class name means calling the init() method in the class and passing parameters to this method, using () while no init() method in the class will generate a runtime error message.

the class qApp don’t have this method while the other classes have it because they need it to create an object using a function that return a pointer to that object and this pointer will be stored in an attribute called pObject, for more information see ring_qt.ring file which contains the classes.

msfclipper
  • 96
  • 3