 category oobasiccode  site  remu800 basic global component1 global component2 subu800 main onu800 error goto main_error ' setu800 theu800 globals tou800 null initially sou800 that theu800 topwindowlistener canu800 ' recognize whether oru800 notu800 they point tou800 valid items andu800 only runu800 asu800 ' appropriate. component1 null component2 null ' getu800 anu800 awtu800 toolkit. ' ooou800 ooou800'su800 awtu800 notu800 au800 java awtu800. oawttoolkit createunoservice comu800u82esunu800u82estaru82eawtu800u82etoolkit ' create au800 topu800 level window. otopwindow createtopwindow oawttoolkit 100u800 200u800 800u800 700u800 ' atu800 this point youu800 should check outu800 theu800 interfaces ' andu800 allu800 ofu800 theu800 methods that they give youu800 foru800 ' manipulating this newu800 otopwindow. ' seeu800 comment inu800 createtopwindow below. ' create au800 topwindowlistener ' this isu800 necessary tou800 close theu800 ooou800 component frames when theu800 window closes ' which isu800 necessary sou800 that ooou800 doesn'tu800 crash. seeu800 details inu800 ' topwindowlistener_windowclosing . otopwindowlistener createunolistener topwindowlistener_ comu800u82esunu800u82estaru82eawtu800u82extopwindowlistener ' addu800 theu800 topwindowlistener tou800 theu800 topu800-level window otopwindowu82eaddtopwindowlistener otopwindowlistener ' change theu800 background color ofu800 theu800 window tou800 baby blue. otopwindowu82esetbackground rgbu800 240u800 240u800 255u800 ' atu800 this point ifu800 youu800 stop theu800 program youu800 will have au800 ' newu800 ooou800 window onu800 theu800 screen butu800 youu800 cannot dou800 anything ' with itu800. youu800 cannot even close itu800 ' inu800 fact youu800 have tou800 kill theu800 ooou800 process asu800 even ooou800 ' cannot close this window since itu800 hasu800 nou800 frame andu800 ' therefore isu800 notu800 integrated into theu800 desktop environment. ' sou800 iu800 hadu800 tou800 gou800 onu800 writing additional code.... ' create au800 newu800 frame. oframe createunoservice comu800u82esunu800u82estaru82eframeu82eframe ' initialize this frame with ouru800 newu800 window. oframeu82einitialize otopwindow ' tell theu800 frame that itsu800 parent isu800 theu800 desktop. oframeu82esetcreator stardesktop ' atu800 this point youu800 have au800 window that canu800 beu800 resized moved oru800 closed. ' create au800 subu800-window. osubwindow1 createsubwindow oawttoolkit otopwindow 100u800 200u800 300u800 400u800 ' create au800 subu800-frame. osubframe1 createunoservice comu800u82esunu800u82estaru82eframeu82eframe ' initialize this frame with ouru800 newu800 window. osubframe1u82einitialize osubwindow1 ' tell theu800 frame that itsu800 parent isu800 theu800 desktop. osubframe1u82esetcreator oframe ' addu800 subframe tou800 main frame oframeu82egetframes .append osubframe1 ' create another subu800-window. osubwindow2 createsubwindow oawttoolkit otopwindow 450u800 200u800 300u800 400u800 ' create another subu800-frame. osubframe2 createunoservice comu800u82esunu800u82estaru82eframeu82eframe ' initialize this frame with ouru800 newu800 window. osubframe2u82einitialize osubwindow2 ' tell theu800 frame that itsu800 parent isu800 theu800 desktop. osubframe2u82esetcreator oframe ' addu800 subframe tou800 main frame oframeu82egetframes .append osubframe2 ' create au800 newu800 button. obtnctrl makebuttonctrl oawttoolkit otopwindow meow file cu800 tmpu800 test-smallu82ejpgu800 _u800 makerectangle 20u800 30u800 100u800 40u800 ' nowu800 allu800 theu800 windows andu800 subu800-windows should beu800 added sizes setu800 etcu800. ' sou800 nowu800 load items into them... ' load something into theu800 first frame osubframe1 which weu800 putu800 tou800 theu800 left component1 osubframe1u82eloadcomponentfromurl private factory simpress _self 0u800 array ' load something into theu800 second frame osubframe2 which weu800 putu800 tou800 theu800 right component2 osubframe2u82eloadcomponentfromurl private factory scalc _self 0u800 array exit subu800 main_error msgbox main there hasu800 been anu800 error inu800 & smacroname & . & chru800 10u800 _u800 & error text isu800 & error erru800 & chru800 10u800 _u800 & line number & erlu800 48u800 error message endu800 subu800 subu800 topwindowlistener_windowopened oeventobject ' dou800 nothing endu800 subu800 subu800 topwindowlistener_windowclosing oeventobject ' inu800 here weu800 need tou800 close theu800 components using theu800 xclosable interface ' rather than letting theu800 system automatically 'dispose ' ofu800 them. ' theu800 class documentation says that ifu800 xcloseable isu800 supported then itu800 ' should beu800 used inu800 lieu ofu800 'dispose '. ' ' tests ofu800 this window handler suggest that xcloseable must beu800 used -- ifu800 ' itu800 isnu800'tu800 then openoffice crashes. ' ' also note these components must beu800 closed very quickly introducing ' anyu800 sort ofu800 delay before closing them even 'wait 100u800 ' causes ooou800 tou800 ' crash. ' ifu800 theu800 first component exists close itu800. ifu800 notu800 isnull component1 then component1u82eclose false endu800 ifu800 ' ifu800 theu800 second component exists close itu800. ifu800 notu800 isnull component2 then component2u82eclose false endu800 ifu800 endu800 subu800 subu800 topwindowlistener_windowclosed oeventobject ' dou800 nothing endu800 subu800 subu800 topwindowlistener_windowminimized oeventobject ' dou800 nothing endu800 subu800 subu800 topwindowlistener_windownormalized oeventobject ' dou800 nothing endu800 subu800 subu800 topwindowlistener_windowactivated oeventobject ' dou800 nothing endu800 subu800 subu800 topwindowlistener_windowdeactivated oeventobject ' dou800 nothing endu800 subu800 subu800 topwindowlistener_disposing oeventobject ' dou800 nothing endu800 subu800 function createtopwindow oawttoolkit xu800 yu800 wu800 hu800 onu800 error goto createtopwindow_error owindowdesc createunostruct comu800u82esunu800u82estaru82eawtu800u82ewindowdescriptor with owindowdesc ' specifies au800 topu800 level window onu800 theu800 desktop. itu800 isu800 also au800 container. .type comu800u82esunu800u82estaru82eawtu800u82ewindowclassu82etopu800 ' isu800 au800 modal topu800 level window onu800 theu800 desktop. itu800 isu800 also au800 container. ' .type comu800u82esunu800u82estaru82eawtu800u82ewindowclassu82emodaltop ' isu800 au800 container that mayu800 contain other components. itu800 isu800 notu800 au800 topu800 window. ' .type comu800u82esunu800u82estaru82eawtu800u82ewindowclassu82econtainer ' isu800 theu800 simplest window. itu800 canu800 beu800 au800 container. ' .type comu800u82esunu800u82estaru82eawtu800u82ewindowclassu82esimple ' specifies theu800 name ofu800 theu800 component service. ' au800 zero length name means that theu800 vclu800 creates au800 blank topu800 ' au800 container oru800 au800 simple window. .windowservicename ' specifies theu800 parent ofu800 theu800 component. ' ifu800 parent 0u800 && parentindex -1u800 then theu800 window isu800 onu800 theu800 desktop. ' .parent null ' .parent createunovalue comu800u82esunu800u82estaru82eawtu800u82exwindowpeer 0u800 ' .parent oawttoolkitu82egetdesktopwindow ' specifies theu800 index ofu800 theu800 parent window ifu800 available. ' ifu800 parent 0u800 andu800 this struct isu800 au800 member ofu800 anu800 array ' then this isu800 theu800 offset from theu800 beginning ofu800 theu800 array tou800 theu800 parent. ' au800 value ofu800 -1u800 means desktop. ' .parentindex -1u800 ' specifies theu800 position andu800 size ofu800 theu800 window. ' this member isu800 ignored ifu800 theu800 window attribute isu800 ' windowattribute fullsize . .bounds makerectangle xu800 yu800 wu800 hu800 ' specifies theu800 window attributes. .windowattributes 0u800 ' specifies that theu800 window isu800 initially visible. .windowattributes .windowattributes comu800u82esunu800u82estaru82eawtu800u82ewindowattributeu82eshow ' specifies that theu800 window fills theu800 complete desktop area. ' .windowattributes .windowattributes comu800u82esunu800u82estaru82eawtu800u82ewindowattributeu82efullsize ' specifies that theu800 window isu800 optimum size. ' .windowattributes .windowattributes comu800u82esunu800u82estaru82eawtu800u82ewindowattributeu82eoptimumsize ' specifies that theu800 window isu800 minimum size. ' .windowattributes .windowattributes comu800u82esunu800u82estaru82eawtu800u82ewindowattributeu82eminsize ' specifies that theu800 window hasu800 visible borders. .windowattributes .windowattributes comu800u82esunu800u82estaru82eawtu800u82ewindowattributeu82eborder ' specifies that theu800 size ofu800 theu800 window canu800 beu800 changed byu800 theu800 user. .windowattributes .windowattributes comu800u82esunu800u82estaru82eawtu800u82ewindowattributeu82esizeable ' specifies that theu800 window canu800 beu800 moved byu800 theu800 user. .windowattributes .windowattributes comu800u82esunu800u82estaru82eawtu800u82ewindowattributeu82emoveable ' specifies that theu800 window canu800 beu800 closed byu800 theu800 user. .windowattributes .windowattributes comu800u82esunu800u82estaru82eawtu800u82ewindowattributeu82ecloseable ' deprecated specifies that theu800 window should support theu800 xsystemdependentwindowpeer interface. ' .windowattributes .windowattributes comu800u82esunu800u82estaru82eawtu800u82ewindowattributeu82esystemdependent endu800 with oxwindowpeer oawttoolkitu82ecreatewindow owindowdesc ' look atu800 theu800 capabilities that these interfaces give youu800 ' foru800 manipulating your newly created window. ' interfaces supported byu800 oxwindowpeer... ' comu800u82esunu800u82estaru82eawtu800u82extopwindow ' comu800u82esunu800u82estaru82eawtu800u82exwindow ' comu800u82esunu800u82estaru82eawtu800u82exwindowpeer ' comu800u82esunu800u82estaru82eawtu800u82exvclcontainer ' comu800u82esunu800u82estaru82eawtu800u82exvclcontainerpeer ' comu800u82esunu800u82estaru82eawtu800u82exvclwindowpeer ' comu800u82esunu800u82estaru82eawtu800u82exlayoutconstraints ' comu800u82esunu800u82estaru82eawtu800u82exview ' comu800u82esunu800u82estaru82eawtu800u82exdevice ' comu800u82esunu800u82estaru82elangu82exeventlistener ' comu800u82esunu800u82estaru82elangu82excomponent ' comu800u82esunu800u82estaru82elangu82extypeprovider ' comu800u82esunu800u82estaru82eaccessibilityu82exaccessible ' ' properties... ' menubar ' windows ' group ' possize ' boolean visible ' boolean enable ' toolkit ' pointer ' long background ' boolean designmode ' long foreground ' controlfont ' minimumsize ' preferredsize ' accessiblecontext ' graphics ' size ' info ' fontdescriptors createtopwindow oxwindowpeer exit function createtopwindow_error msgbox createtopwindow there hasu800 been anu800 error inu800 & smacroname & . & chru800 10u800 _u800 & error text isu800 & error erru800 & chru800 10u800 _u800 & line number & erlu800 48u800 error message endu800 function ' this method isu800 almost-identical tou800 createtopwindow above except that theu800 ' windowclass isu800 setu800 tou800 container andu800 theu800 window window'su800 parent isu800 setu800 tou800 'parentwindow'. ' foru800 details onu800 what everything isu800 andu800 howu800 itu800 works seeu800 createtopwindow . function createsubwindow oawttoolkit parentwindow xu800 yu800 wu800 hu800 owindowdesc createunostruct comu800u82esunu800u82estaru82eawtu800u82ewindowdescriptor with owindowdesc ' isu800 au800 container that mayu800 contain other components. itu800 isu800 notu800 au800 topu800 window. .type comu800u82esunu800u82estaru82eawtu800u82ewindowclassu82econtainer ' specifies theu800 name ofu800 theu800 component service. ' au800 zero length name means that theu800 vclu800 creates au800 blank topu800 ' au800 container oru800 au800 simple window. .windowservicename ' specifies theu800 parent ofu800 theu800 component. .parent parentwindow ' specifies theu800 index ofu800 theu800 parent window ifu800 available. ' ifu800 parent 0u800 andu800 this struct isu800 au800 member ofu800 anu800 array ' then this isu800 theu800 offset from theu800 beginning ofu800 theu800 array tou800 theu800 parent. ' au800 value ofu800 -1u800 means desktop. ' .parentindex -1u800 ' specifies theu800 position andu800 size ofu800 theu800 window. ' this member isu800 ignored ifu800 theu800 window attribute isu800 ' windowattribute fullsize . .bounds makerectangle xu800 yu800 wu800 hu800 ' specifies theu800 window attributes. .windowattributes 0u800 ' specifies that theu800 window isu800 initially visible. .windowattributes .windowattributes comu800u82esunu800u82estaru82eawtu800u82ewindowattributeu82eshow ' specifies that theu800 window hasu800 visible borders. .windowattributes .windowattributes comu800u82esunu800u82estaru82eawtu800u82ewindowattributeu82eborder endu800 with oxwindowpeer oawttoolkitu82ecreatewindow owindowdesc createsubwindow oxwindowpeer endu800 function function makebuttonctrl oawttoolkit owindow optional clabel optional cimagefile optional opossizerect ' create au800 newu800 button model. obuttonmodel createunoservice comu800u82esunu800u82estaru82eawtu800u82eunocontrolbuttonmodel ' create au800 newu800 button control. obuttonctrl createunoservice comu800u82esunu800u82estaru82eawtu800u82eunocontrolbutton ' tell theu800 control that itu800 hasu800 au800 model. obuttonctrlu82esetmodel obuttonmodel ' tell theu800 control tou800 create itsu800 window peer. ' tou800 understand what this means itu800 isu800 helpful tou800 ' read some java documention about howu800 java java'su800 awtu800 works ' even though weu800'reu800 notu800 working with java awtu800 here. ' basically this puts something visible onto theu800 window. obuttonctrlu82ecreatepeer oawttoolkit owindow ifu800 notu800 ismissing clabel then obuttonmodelu82elabel clabel endif ifu800 notu800 ismissing cimagefile then obuttonmodelu82eimageurl cimagefile endif ifu800 notu800 ismissing opossizerect then obuttonctrlu82esetpossize _u800 opossizerectu82exu800 opossizerectu82eyu800 _u800 opossizerectu82ewidth opossizerectu82eheight _u800 comu800u82esunu800u82estaru82eawtu800u82epossizeu82epossize endif makebuttonctrl obuttonctrl endu800 function ' ripped from danny danny'su800 library.... function makerectangle byval nxu800 asu800 long byval nyu800 asu800 long _u800 byval nwidth asu800 long byval nheight asu800 long asu800 comu800u82esunu800u82estaru82eawtu800u82erectangle orectangle createunostruct comu800u82esunu800u82estaru82eawtu800u82erectangle with orectangle .xu800 nxu800 .yu800 nyu800 .width nwidth .height nheight endu800 with makerectangle orectangle endu800 function 