7m…ôcU· \cd­+const Pointer_Used = &408proc Start: LOADM "Z:\SYSTEM\OPL\TOOLBAR.OPO" TBarLink:("Main")endpPROC Main: global gEvent&(16) Init: DO rem --- infinite loop until cmd+e GETEVENT32 gEvent&() Event_PenKey: UNTIL 0ENDPrem *************************************************rem ** initialize routine **rem *************************************************proc Init: gUse 1 rem focus to default window TBarInit:("tTBar", gWidth, gHeight) rem -- it will link "cmda" and first toolbar button TBarButt:("a", 1, "About", 0, &0, &0, 0) rem -- it will link "cmdd" and second toolbar button TBarButt:("d", 2, "Dummy", 0, &0, &0, 0) rem -- it will link "cmde" and third toolbar button TBarButt:("e", 3, "Exit", 0, &0, &0, 0) TBarShow:endpproc Event_PenKey: IF gEvent&(1)=Pointer_Used IF TBarOffer%:(gEvent&(3),gEvent&(4),gEvent&(6),gEvent&(7)) rem -- toolbar event is processed in TBarOffer:(). rem -- procedure cmde cmdd or cmda is automatically called. RETURN ELSEIF gEvent&(4)=1 rem -- pointer(pen) event. Event_Ptr:(gEvent&(3),gEvent&(6),gEvent&(7)) ENDIF ELSEIF gEvent&(1)=4150 OR gEvent&(1)=10000 rem -- menu event. rem -- "control+#" event is processed in Event_Key: . Event_Menu: ELSEIF gEvent&(1)<=300 rem -- key event. Event_Key: ENDIFendpproc Event_Ptr:(winid&, inxpos&, inypos&) local ptrx%, ptry%, i%, flg% if winid& = 1 rem --- default iwndow gUse 1 : gCls gAt 100,100 gPrint "("+gen$(inxpos&,3)+","+gen$(inypos&,3)+") clicked." endifendpproc Event_Menu: local k%, a$(10), cmdstr$(3) cmdstr$ = "dea" mINIT mCARD "File","Dummy",-%d,"Exit",%e mCARD "Info","About..",%a k% = MENU if k% AND (LOC(cmdstr$,chr$(k%))<>0) rem -- it will call "cmd#" (# is d,e or a) a$ = "cmd" + chr$(k%) : @%(a$): endifendpproc Event_Key: local isS%, a$(10), k%, tx%,ty% local cmdstr$(3) cmdstr$ = "dea" if gEvent&(4) AND 4 rem -- Control key is pressed rem -- when ctrl, value of gEvent&(1) is a/A=1, b/B=2,... rem -- then +64 is needed to convert ascii character code. rem -- if you want capital-sensitive code,use gEvent&(4) AND 2 rem -- to find shift is pressed or not. k% = gEvent&(1)+64 if LOC(cmdstr$,chr$(k%)) rem -- it will call "cmd#" (# is d,e or a) a$ = "cmd" + chr$(k%) : @%(a$): return endif endifendprem *************************************************rem ** command routine **rem *************************************************proc cmde%: stop rem -- simply exitendpproc cmda%: rem About dialog dInit "About this program" dText ""," 2000 (c) Tea Duck Studio. ", 2 dText "","All rights reserved.", 2 dText "","This program is freeware.", 2 dialogendpproc cmdd%: giPrint "dummy command. "endpÐР   \c efd\c efdý‚.ÆA…*TextEd.app…! ‰¨