ResourceFile 类 |
命名空间: XSharp.VO.SDK
ResourceFile 类型公开以下成员。
名称 | 说明 | |
---|---|---|
ResourceFile |
构造一个资源文件对象。
|
1CLASS MyMenu INHERIT Menu 2CLASS MyResFile INHERIT ResourceFile 3CLASS MyTopAppWin INHERIT TopAppWindow 4 DEFINE IDM_MYMENU := "MyMenu" 5 DEFINE IDM_MYMENU_GETSTR1_ID := 1001 6 DEFINE IDM_MYMENU_GETSTR2_ID := 1002 7 DEFINE IDM_MYMENU_QUIT_ID := 1003 8 DEFINE IDT_STR1 := 2001 9 DEFINE IDT_STR2 := 2002 10 11 RESOURCE IDM_MYMENU MENU 12 13 BEGIN 14 POPUP "&Menu1" 15 16 BEGIN 17 MENUITEM "Get String &1", IDM_MYMENU_GETSTR1_ID 18 MENUITEM "Get String &2", IDM_MYMENU_GETSTR2_ID 19 MENUITEM SEPARATOR 20 MENUITEM "&QUIT", IDM_MYMENU_QUIT_ID 21 END 22 END 23 24 RESOURCE STRINGTABLE 25 26 BEGIN 27 IDT_STR1 "The 1st String" 28 IDT_STR2 "The second string is 35 chars long." 29 END 30 31METHOD Start() CLASS App 32 LOCAL oWin AS Window 33 oWin := MyTopAppWin{SELF} 34 oWin:Show() 35 SELF:Exec() 36 37METHOD Init(oOwnerApp) CLASS MyTopAppWin 38 LOCAL lRetVal AS LONG 39 SUPER:Init(oOwnerApp) 40 SELF:Menu := MyMenu{SELF} 41 SELF:Caption := "Resource File Demo Application" 42 43METHOD Init(oOwner) CLASS MyMenu 44 SUPER:Init(ResourceID{IDM_MYMENU}) 45 SELF:RegisterItem(IDM_MYMENU_GETSTR1_ID, HyperLabel{#GetStr1,,,}) 46 SELF:RegisterItem(IDM_MYMENU_GETSTR2_ID, HyperLabel{#GetStr2,,,}) 47 SELF:RegisterItem(IDM_MYMENU_QUIT_ID, HyperLabel{#GoQuit,,,}) 48 49METHOD Init(fName) CLASS MyResFile 50 IF fName == NIL 51 SUPER:Init() 52 ELSE 53 SUPER:Init(fName) 54 ENDIF 55 56METHOD GetStr1() CLASS MyTopAppWin 57 SELF:GetStrX(IDT_STR1, 0) 58 59METHOD GetStr2() CLASS MyTopAppWin 60 SELF:GetStrX(IDT_STR2, 100) 61 62METHOD GetStrX(nStrX,dy) CLASS MyTopAppWin 63 LOCAL oResFile, oResID, oResString AS OBJECT 64 65 oResFile := MyResFile{"c:\cavo\mytstprg.exe"} 66 oResID := ResourceID{nStrX ,oResFile} 67 oResString := ResourceString{oResID} 68 69 SELF:TextPrint(AsString(nStrX), Point{10, 10 + dy}) 70 SELF:TextPrint(AsString(oResString:Length), Point{10, 30 + dy}) 71 SELF:TextPrint(AsString(oResString:Value), Point{10, 50 + dy}) 72 SELF:TextPrint(AsString(oResString:AsString()), Point{10, 70 + dy}) 73 74METHOD GoQuit() CLASS MyTopAppWin 75 SELF:Owner:Quit()