Window w1 aus Modul A wird an Modul C vererbt und dort vervollständigt. Auch wenn man das Original-Window benutzen will, muss vom Basis-Modul ein weiterer Modul abgeleitet werden!
Window(w0, LOAD, 10, 10, 388, 45) [ INITIALIZE: 1 SetLayer ] { Button(23, 17, 123, "base window") [ Msg(OPEN_BASE_WIN, OPEN_DERIVED_WIN) SELECT: SendMsg(OPEN_BASE_WIN) ] Button(173, 17, 147, "derived window") [ SELECT: SendMsg(OPEN_DERIVED_WIN) ] } Module(A) [ Define(AlertPers) Alert(, name) Alert(, firstName) Alert(, title) Alert(, sexEnum) Lock(, b1) ; Define(ShowPers) Dup if FillWindow else Alarm ; Define(SexSym) Copy(sexEnum) if "" else "" ; ] Window(w1, 20, 20, 770, 90, T("Basis-Window", "base window")) [ INITIALIZE: AlertPers ] { Prompt(10, 10, T("Name:", "Name:", "Nom:")) String(CX_PERSON::name, 90, 10, 240) [ F7: GetValue "name == %s" FindFirst(CX_PERSON) ShowPers F12: EditRequests ALTERED: Unlock(, b1) ] Prompt(370, 10, T("Vorname:", "first name:", "Prénom:")) String(CX_PERSON::firstName, 480, 10, 230) [ F7: GetValue "firstName == %s" FindFirst(CX_PERSON) ShowPers F12: EditRequests ALTERED: Unlock(, b1) ] Prompt(10, 20, T("Titel:", "title:", "titre:")) String(CX_PERSON::title, 90, 20, 240) [ F12: EditRequests ] Enum(CX_PERSON::sexEnum, 570, 20, 140, 30) [ F12: EditRequests ] Button(b1, 415, 27, 120, T("speichern", "store", "garder")) [ SELECT: CreatePersObject(CX_PERSON) DrainWindow AlertPers F12: EditRequests ] Button(b2, 415, 41, 120, T("neu", "new", "neuf")) [ SELECT: CreatePersObject(CX_PERSON) DrainWindow AlertPers F12: EditRequests ] } Module(B) : A [ OPEN_BASE_WIN: OpenWindow(w1) ] Module(C) : A [ Define(ShowPers) Dup if { Dup A::ShowPers FillObox(, pBox) } ; OPEN_DERIVED_WIN: OpenWindow(w1) ] Window(w1, 20, 20, 770, 110, T("vererbtes Window", "inherited window")) { String(CX_PERSON::title, 90, 20, 240) [ F7: GetValue "title == %s" Find(CX_PERSON) ClearObox(, pBox) FillObox(, pBox) ] OList(pBox, HZ_SCROLL_BAR, FONT(2), ITEM(800, 14), 13, 44, 389, 41) [ INITIALIZE: [ "CX_PERSON::title", 0, COLOR BLUE ] SetFormat [ "CX_PERSON::name", 85, COLOR LIGHTBLUE ] SetFormat [ "CX_PERSON::firstName", 209, COLOR BLUE ] SetFormat [ "CX_PERSON::sexEnum", 299, COLOR GREEN, FONT 0 ] SetFormat [ "CX_PERSON::" Push(SexSym), 299, 7, COLOR LIGHTRED ] SetFormat ] }
Das abgeleitete Window besteht aus
Prompts | vererbt |
String 'name' | vererbt |
String 'firstName' | vererbt |
String 'title' | überdefiniert |
Objektbox | neu hinzugefügt |
Wenn im Eingabefeld 'name' bzw. 'firstName' mit F7 die entsprechenden Anweisungen der Aktionsliste aktiviert werden, wird im abgeleiteten Window C::ShowPers aufgerufen.