Calling General Window Class-functions via Window Handle

Gupta provides the ability to define general Window Classes which can be used as a base class for real window classes such as dialogs, FormWindows, controls, etc.
In addition there is the possibility to call a function of a window or control via its window handle. To do so you have to equip the handle with with a so-called window handle qualifier:
Call hWnd.Frm1.SomeFunction()
  • hWnd is the window handle of a form Windows.
  • Frm1 is the template name of a window or a window class.
  • The function SomeFunction() is a function that is defined in Frm1.
So far, so good. This is documented in the Gupta books or help.
But if the function SomeFunction() is defined in a General Window Class and Frm1 is a derivation you would have to write the call:
Call hWnd.GenWndCls.SomeFunction()

But unfortunately Gupta then unnecessarily comes up with a compile error „class GenWndCls, is a general window class. Hence it may serve only as a base class, and may not be qualified with a window handle“. This is very annoying because it is often useful to use a general Window Class as the basis for a form and a dialogue. Fortunately there is a simple workaround for this:

Call hWnd.GenWndCls..SomeFunction()

Yes – a simple additional dot and Gupta accepts the expression. Why is this so? The ..-Operator preceding a function call is a so-called late-bound reference that causes Gupta to look up the called function in all derived classes and executes the „deepest“ implementation. If SomeFunction() would have been defined in Frm1 then this implementation would be executed. If there are no additional implementations Gupta calls the first spurned function without complaint.

Happy coding.

Advertisements

Über thomasuttendorfer
Ich bin Entwicklungsleiter bei der Softwarefirma [ frevel & fey ] in München. Wir entwickeln Business-Software für Verlage und verwenden dafür den Gupta Team-Developer sowie Visual Studio.

Kommentar verfassen

Trage deine Daten unten ein oder klicke ein Icon um dich einzuloggen:

WordPress.com-Logo

Du kommentierst mit Deinem WordPress.com-Konto. Abmelden / Ändern )

Twitter-Bild

Du kommentierst mit Deinem Twitter-Konto. Abmelden / Ändern )

Facebook-Foto

Du kommentierst mit Deinem Facebook-Konto. Abmelden / Ändern )

Google+ Foto

Du kommentierst mit Deinem Google+-Konto. Abmelden / Ändern )

Verbinde mit %s

%d Bloggern gefällt das: