DataHub scripting offers many of the Windows classes wrapped as Gamma classes. Thus you can create windows, buttons, entry forms, tabs, dialogs, and so on. The DataHub Windows Scripting manual contains more information. This is how you create a basic window.
This is an example of a basic window. Here are the main parts of your MyWindows.g script:
class MyWindows Application { window; }
The window itself is an instance variable of the MyWindows class.
method MyWindows.constructor () { local rect = CreateRect (0, 0, 300, 300), txt; .window = new GWindow(); .window.Create (0, rect, "Hello", WS_OVERLAPPEDWINDOW, 0); .window.CenterWindow(); txt = .window.CreateControl (GStatic, 0, 0, 280, 22, "Hello world", SS_CENTER); txt.CenterWindow(); .window.MessageHandler (WM_DESTROY, `destroy(@self)); .window.ShowWindow (SW_SHOW); } method MyWindows.destructor () { // The WM_DESTROY message could come before or after this destructor depending // on whether the application instance is destroyed or the window is closed // first. We protect against the case where the window is closed first. if (instance_p(.window) && .window.GetHwnd() != 0) .window.PostMessage (WM_CLOSE, 0, 0); MessageBox(0, string ("Application: ", class_name(self), " completed."), "Done", 0); }
More information about Windows scripting and the Windows classes and methods can be found in the DataHub Windows Scripting manual.
Copyright © 1995-2010 by Cogent Real-Time Systems, Inc. All rights reserved.