Look at example2 (module 'myWin2'):
let win = workWindow.new2(..... window.WB_APP))After creation, initialization, and starting of the event loop (application.execute, see below point iii) ) the window is made visible by the method "window.show(...)".
Look at example2 (module 'example2'):
let main(argv :Array(String)) :Int =
begin
let aMainWin = myWin2.new()
.
.
.
window.setText(aMainWin.win "StarView Paint")
window.show(aMainWin.win)
application.execute()
end
Each event, e.g. user input, changes of the application window, appearance of an error, causes StarView to call an event handler and give the user a chance to react to the event. He can start certain actions, according to the demands of his program. This can be accomplished by installing handlers, which are called after starting the event dispatcher. There are two possibilities:
Look at example2 (module 'myWin2'):
window.setMouseButtonDown(t.win ...) :Ok
begin ^
. | obj.
.
.
end
The second possibility is made for handlers of such classes, from which the user does not necessary derive a class (e.g. buttons, scrollbars etc).
let colorSelect(win :T pMenu :menu.T) :link.Handler =
fun() :Ok
begin
.
.
.
end
Classes in TL are represented by tuple types.
Look at example2 (module 'myWin2'):
Let T = Tuple
win :workWindow.T
var nColor :Int
var nWidth :Int
var aLastPoint :point.T
end
An extract of the interface MyWin2 :
T <:Tuple
win :workWindow.T
end
StarView method calls :
aMenuBar.InsertItem(MID_FILE, "~File");
aFileMenu.InsertItem(MID_ABOUT, "About...",
MENU_APPEND, MIB_ABOUT);
aColorMenu.InsertItem(MID_PENRED, "Red",
MENU_APPEND, MIB_CHECKABLE);
Equivalent TL function calls :
menu.insertItem(aMenuBar mid3.FILE "~File")
menu.insertItem2(aFileMenu mid3.ABOUT "~About..."
menu.MENU_APPEND menu.MIB_ABOUT)
menu.insertItem2(aColorMenu mid3.PENRED "~Red"
menu.MENU_APPEND menu.MIB_CHECKABLE)
As you see:In StarView the object appears first and then the method with its parameters is declared.
obj.maximize(...)
In TL the class appears first followed by the method with the first parameter object followed by other parameters.
window.maximize(obj ...)
Look at library svenv_examples:
library svenv_examples
import
.
.
.
with
interface
Mid2 MyWin2
module
mid2 :Mid2 myWin2 :MyWin2
example2 :Main
.
.
.
end;
The resource modules for your StarView application can be produced interactively by the StarView-Design-Editor . There are two ways to use the Design-Editor (StarView user manual, chapter 5 p.135):
wabi designed.exe
Shell command :
dos2unix <originalfile> <convertedfile>
Command (TL function):
rsc.makeTLFiles(hrcFileName, moduleName, interfaceName,lib :String sccs :Bool)
Command :
rsc <filename.src>
designed
Command (TL function):
rsc.makeTLFiles(hrcFileName, moduleName, interfaceName,lib :String sccs :Bool)
Command :
rsc <filename.src>
If you do not want to leave the TL main loop append the method systemWindow.close to a special button.
Look at example3 (module 'myWin3'):
let aBox = queryBox.new(win.win
int.bitOr(window.WB_OK_CANCEL
window.WB_DEF_OK)
"Exit Paint")
if messBox.execute(aBox) == messBox.RET_OK then
systemWindow.close(win.win)
else
false
end