Page History
祖先のフォームに設定された外観と動作は、継承するフォームの基本的なロジックと動作を提供します。
[ |../../index.htm#lansa/l4wdev06_0965.htm]
現在地:
...
継承するフォームに他のコンポーネント(この例ではフィールドとボタン)を追加し、この基本構造を構築できます。以下のように、祖先のフォームのソースをコピーできます。
...
フォームをコンパイルし、実行すると、
今度は、フォームに継承された特性(メニューとステータス・バー)とそのコンポーネントとコードの両方が含まれます。
...
継承するフォームのソースを見ると、祖先で定義されているコンポーネントのDEFINE_COMステートメントが、(
...
[アウトライン
...
]タブに表示されているにもかかわらず)含まれていないことがわかります。また、その中で指定されているルーチンも含まれていません。継承するフォームには、コンポーネント定義と固有のコードだけが含まれます。
...
継承するフォームのソース
**************************************************** * COMPONENT:STD_FORM * ***************************************************FUNCTION OPTIONS(*DIRECT)BEGIN_
...
COM ROLE(*
...
EXTENDS #EOEXAM01)
...
LEFT(367)
...
TOP(169)
...
* This form has ancestor EOEXAM01* * from which it inherits these visual characteristics:** -> A menu bar with items Open, Close and Exit on it. * -> A status bar showing the current user, date and time.** and from which it inherits these behavioural characterstics: ** -> The user, date and time on the status bar are initialized* -> The time on the status bar is updated every 5 seconds * -> The menu bar "Exit" option is handled* -> Closing of the form is handled* -> Closing the form causes a confirmation to be displayed * allowing the close to be cancelled. * -> The "Open" option is handled (unless redefined, see following) * -
...
> The "Close"
...
option is handled (unless redefined)DEFINE_COM CLASS(#EMPNO.Visual) NAME(#EMPNO) DISPLAYPOSITION(2) HEIGHT(19) LEFT(20) PARENT(#COM_OWNER) TABPOSITION(2) TOP(16) WIDTH(209)DEFINE_COM CLASS(#SURNAME.Visual) NAME(#SURNAME) DISPLAYPOSITION(3) HEIGHT(19) LEFT(20) PARENT(#COM_OWNER) TABPOSITION(3) TOP(44) WIDTH(324)DEFINE_COM CLASS(#GIVENAME.Visual) NAME(#GIVENAME) DISPLAYPOSITION(4) HEIGHT(19) LEFT(20) PARENT(#COM_OWNER) TABPOSITION(4) TOP(72) WIDTH(324)DEFINE_COM CLASS(#ADDRESS1.Visual) NAME(#ADDRESS1) DISPLAYPOSITION(5) HEIGHT(19) LEFT(20) PARENT(#COM_OWNER) TABPOSITION(5) TOP(100) WIDTH(363)DEFINE_COM CLASS(#ADDRESS2.Visual) NAME(#ADDRESS2) DISPLAYPOSITION(6) HEIGHT(19) LEFT(20) PARENT(#COM_OWNER) TABPOSITION(6) TOP(129) WIDTH(363)DEFINE_
...
COM CLASS(#PRIM_PHBN)
...
NAME(#SAVE_BUTTON)
...
CAPTION('Save')
...
DISPLAYPOSITION(7)
...
LEFT(392)
...
PARENT(#COM_OWNER)
...
TABPOSITION(7)
...
TOP(8)
...
* Handle the save button ...EVTROUTINE HANDLING(#Save_Button.Click) Change (#Empno #Surname #GiveName #Address1 #Address2) *DefaultMessage 'Employee details have been saved'ENDROUTINE
...
* Redefine the "HandleFileOpen" method so that this method is*
...
used instead of the ancestor's version of it ....
...
MTHROUTINE NAME(HandleFileOpen) OPTIONS(*REDEFINE)Use Message_Box_Show (ok Ok Info #Com_Self.Name 'Descendant HandleFileOpen method invoked') (#Std_Obj)Endroutine
...
END_COM
...

