发表于:2006-04-14 09:40:00
楼主
版主及各位“高人”小弟最近用Zinc做一个界面,其中主界面能在目标机上正常显示,而当按主界面的一个按钮按理应该弹出一个对话框,结果出现一个全空无颜色的界面(没有任何控件,这也比应该出现的对话框和主界面大得多,而应该出现的对话框是有颜色的,有控件的)。为此我又简化主界面和当按主界面的一个按钮按理应该弹出一个对话框的控件,主界面只有一个按钮,设为浅绿色,和当按主界面的一个按钮按理应该弹出一个对话框的控件是几个字。属性不应该有问题,因为主界面的控件及颜色都能正常显示,为什么当按主界面的一个按钮出现一个全空无颜色的大界面(而编译下载都正确没有提示错误)????原因可能是代码添加的有问题请各位指点,小弟非常感激 !!!
以下是简化界面控件生成的代码及添加的代码(添加的代码在2个add之间 只在MainWind..CPP,MainWind..HPP两个文件加代码,其它文件保持原样)
我的email: fewwang@126.com,
文件1. can.cpp
// Main program file generated by Zinc Designer.
#include "MainWind.hpp"
#include "gps.hpp"
#include "can.inc"
int ZafApplication::Main(void)
{
// Ensure main() is linked properly.
LinkMain();
// Establish access to external objects and data.
ZafStorage *storage = new ZafStorage(ZAF_ITEXT("C:/homedir/can7.znc"), ZAF_FILE_READ);
if (storage->Error())
{
errorSystem->ReportError(ZAF_NULLP(ZafWindowObject),
ZAF_ITEXT("Error"), ZAF_DIALOG_OK,
ZAF_ITEXT("can7.znc could not be found."));
delete storage;
return (-1);
}
objectPersistence = new UserPersist(storage);
// Display initial windows.
windowManager->Add(new MainWind(ZAF_ITEXT("MainWind"), *objectPersistence));
// Get the user input.
Control();
delete objectPersistence;
objectPersistence = ZAF_NULLP(ZafObjectPersistence);
delete storage;
// Return success.
return (0);
}
文件2. can.hpp
#if !defined(INC_can_HPP)
#define INC_can_HPP
#include <zinc/z_win.hpp>
class UserPersist : public ZafObjectPersistence
{
public:
UserPersist(ZafFileSystem *fileSystem) :
ZafObjectPersistence(fileSystem, dataTable, objectTable, userFunctionTable, compareFunctionTable, userObjectTable, drawHookTable, listenerCtorTable) { }
static DataConstructor ZAF_FARDATA dataTable[];
static ObjectConstructor ZAF_FARDATA objectTable[];
static UserFunction ZAF_FARDATA drawHookTable[];
static CListener ZAF_FARDATA listenerCtorTable[];
static UserFunction ZAF_FARDATA userFunctionTable[];
static CompareFunction ZAF_FARDATA compareFunctionTable[];
static UserObject ZAF_FARDATA userObjectTable[];
};
#endif // INC_can_HPP
文件3. MainWind.cpp
// CPP file for class MainWind
#include "MainWind.hpp"
//**************************add**********************************//
MainWind *pMainWind;
const ZafEventType B_1 = 10001;
//**************************add**********************************//
ZafClassNameChar ZAF_FARDATA MainWind::className[] = ZAF_ITEXT("MainWind");
MainWind::MainWind(const ZafIChar *name, ZafObjectPersistence &persist) :
&