WideStudio/MWT Logo
WideStudio/MWT
Programming Guide
WideStudio/MWT Index
Table of contents


创建/删除对象



创建对象

使用成员函数getNewInstance()创建对象。

  String class_name = "WSCvlabel";
  String obj_name   = "vlabel001";
  // 欲创建新对象的父对象

  //获得新对象
  WSCbase obj = WSCbase.getNewInstance(class_name,parent,obj_name);
  obj.init();                      //创建后执行 init()
  obj.clear();

  obj.setProperty("x",100);
  obj.setProperty("y",100);
  obj.setProperty("width",100);
  obj.setProperty("height",100);
  obj.setVisible((short)Mwt.True);     // 完成配置后,显示对象

通过getNewInstance()获得新创建的对象后,应首先使用init()进行初始化。

删除对象

使用函数WSGFdestroyWindow删除对象。

  //删除
  Mwt.WSGFdestroyWindow(obj); //删除选择的对象

obj 中指定被删除除的对象。重复删除对象或者删除正在使用的对象, 都将导致严重的内存错误。不能访问已经被删除的对象, 同时也不要访问指向被删除对象的指针。

Document Release 3.90 for WideStudio/MWT ver 3.90, Jul 2005


WideStudio/MWT documents index | Table of contents

Copyright(C) WideStudio/MWT Development Team, 1999-2005 Last modified: Jul 31, 2005