Hi Simon,

you can easily define a new class during runtime. Instead of writing the class 
code into an own file you can also define the class in your code.

--snip--
// some code

var className = someFunctionToGetTheClassname();

var clazz = qx.Class.define(className, {
  // constructor
  // properties
  // events
  // members
  // destructor
});

var newClass = new clazz();
--snip--

Just define your new class using the well-known "qx.Class.define" method and 
instantiate afterwards. 

Regards,
  Alex

-----Original Message-----
From: Simon White [mailto:[email protected]] 
Sent: Friday, December 23, 2011 7:59 PM
To: [email protected]
Subject: [qooxdoo-devel] How to create a new class without hardcoding the name 
in code?

Hi

I would like to be able to create a new class by building the class name 
at runtime as opposed to hard coding the class in code.  Can this be done?

For example instead of

var lo = new dcbase.myCustomerButton();

I would like to do the following:

var lcClass = myWindow.Classname.substr(1,8)+"_con"+myButton.getLabel()

var = new lcClass;

Thanks,
Simon


------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create 
new or port existing apps to sell to consumers worldwide. Explore the 
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create 
new or port existing apps to sell to consumers worldwide. Explore the 
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to