 category oobasiccode  site   autor  dannyb itu800 isu800 interesting tou800 look atu800 allu800 theu800 stuff inu800 theu800 apiu800 under.... comu800u82esunu800u82estaru82eawtu800. itu800 isu800 possible tou800 create newu800 windows addu800 menu bars tou800 them andu800 draw anyu800 kind ofu800 graphics within your window. youu800 canu800 putu800 newu800 controls inu800 your window. inu800 fact au800 window created byu800 au800 component using theu800 awtu800 toolkit would look andu800 feel just like theu800 native windows ofu800 calc writer impress draw. here isu800 au800 funu800 test program tou800 exercise what iu800 have learned there. just copy paste andu800 runu800. iu800 apologize that this isu800 wayu800 more comments than actual lines ofu800 code. theu800 code would beu800 quite short ifu800 youu800 removed theu800 comments. subu800 main ' getu800 anu800 awtu800 toolkit. ' ooou800 ooou800'su800 awtu800 notu800 au800 java awtu800. oawttoolkit createunoservice comu800u82esunu800u82estaru82eawtu800u82etoolkit ' create au800 topu800 level window. owindow createtopwindow oawttoolkit ' atu800 this point youu800 should check outu800 theu800 interfaces ' andu800 allu800 ofu800 theu800 methods that they give youu800 foru800 ' manipulating this newu800 owindow. ' seeu800 comment inu800 createtopwindow below. ' change theu800 background color ofu800 theu800 window tou800 baby blue. owindowu82esetbackground 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 owindow ' 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. ' note that ifu800 youu800 wanted tou800 youu800 could nowu800 load au800 component ' into your newly created window ' oframeu82eloadcomponentfromurl private factory scalc _self 0u800 array ' create au800 newu800 button. obtnctrl makebuttonctrl oawttoolkit owindow meow _u800 makerectangle 20u800 30u800 100u800 40u800 ' create au800 menu. ' createmenubar owindow ' menubar tou800 beu800 provided later.... ' okay well maybe notu800 seeu800 below... endu800 subu800 function createtopwindow oawttoolkit 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 0u800 ' .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 100u800 200u800 300u800 400u800 ' 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 endu800 function function makebuttonctrl oawttoolkit owindow optional clabel 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 cname then obuttonmodelu82elabel clabel endif ifu800 notu800 ismissing opossizerect then obuttonctrlu82esetpossize _u800 opossizerectu82exu800 opossizerectu82eyu800 _u800 opossizerectu82ewidth opossizerectu82eheight _u800 comu800u82esunu800u82estaru82eawtu800u82epossizeu82epossize endif makebuttonctrl obuttonctrl endu800 function ' ripped from myu800 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 when iu800 provide theu800 menubar implementation itu800 will beu800 painfully obvious that youu800 need au800 real programming language iu800u82eeu800. notu800 basic . well this isu800 probably true ifu800 youu800 areu800 going tou800 implement au800 full blown office component anyway. here isu800 myu800 proposed menubar implementation. butu800 itu800 doesn'tu800 seem tou800 work properly inu800 basic. iu800 believe theu800 problem isu800 that youu800 cannot setmenubar tou800 anu800 object created byu800 createunolistener. like iu800 said youu800 need au800 language that lets youu800 create real objects. ifu800 youu800 study itu800 iu800 think youu800 canu800 seeu800 theu800 idea behind itu800. '################################################## global oapplemenu global oorangemenu subu800 createmenubar owindow omenubar createunolistener mymenubar_ comu800u82esunu800u82estaru82eawtu800u82exmenu oapplemenu createunolistener applemenu_ comu800u82esunu800u82estaru82eawtu800u82expopupmenu oorangemenu createunolistener orangemenu_ comu800u82esunu800u82estaru82eawtu800u82expopupmenu owindowu82esetmenubar omenubar endu800 subu800 ' ouru800 menu baru800 isu800 hardcoded. ' menu apple ' hasu800 items apple pieu800 apple juice ' menu orange ' hasu800 items orange juice orange jello '################################################## ' myu800 menu baru800 interface ' '################################################## ' comu800u82esunu800u82estaru82eawtu800u82exmenubar ' ' anu800 interface like this just plain needs tou800 ' beu800 written inu800 au800 language other than baisc '################################################## subu800 mymenubar_addmenulistener xlistener endu800 subu800 subu800 mymenubar_removemenulistener xlistener endu800 subu800 ' this trivial implementation ofu800 theu800 interface ' does notu800 support inserting oru800 removing items. subu800 mymenubar_insertitem nitemid ctext nitemstyle npos endu800 subu800 subu800 mymenubar_removeitem npos ncount endu800 subu800 ' this joke implementation ofu800 theu800 interface ' hasu800 hardcoded theu800 contents ofu800 theu800 menu baru800. ' calling insertitem oru800 removeitem does notu800 change ' what theu800 following routines return. function mymenubar_getitemcount ' weu800 have twou800 menus. mymenubar_getitemcount 2u800 endu800 function function mymenubar_getitemid npos mymenubar_getitemid npos endu800 function function mymenubar_getitempos nitemid mymenubar_getitempos nitemid endu800 function subu800 mymenubar_enableitem nitemid benable endu800 subu800 function mymenubar_isitemenabled nitemid mymenubar_isitemenabled true endu800 function subu800 mymenubar_setitemtext nitemid ctext endu800 subu800 function mymenubar_getitemtext nitemid citemname ifu800 nitemid 1u800 then citemname apple elseif nitemid 2u800 then citemname orange endif mymenubar_getitemtext citemname endu800 function subu800 mymenubar_setpopupmenu nitemid oxpopupmenu endu800 subu800 function mymenubar_getpopupmenu nitemid dimu800 opopupmenu asu800 object ifu800 nitemid 1u800 then opopupmenu oapplemenu elseif nitemid 2u800 then opopupmenu oorangemenu endif mymenubar_getpopupmenu opopupmenu endu800 function '################################################## ' comu800u82esunu800u82estaru82eawtu800u82expopupmenu '################################################## subu800 applemenu_addmenulistener xlistener endu800 subu800 subu800 applemenu_removemenulistener xlistener endu800 subu800 ' this trivial implementation ofu800 theu800 interface ' does notu800 support inserting oru800 removing items. subu800 applemenu_insertitem nitemid ctext nitemstyle npos endu800 subu800 subu800 applemenu_removeitem npos ncount endu800 subu800 ' this joke implementation ofu800 theu800 interface ' hasu800 hardcoded theu800 contents ofu800 theu800 menu baru800. ' calling insertitem oru800 removeitem does notu800 change ' what theu800 following routines return. function applemenu_getitemcount ' weu800 have twou800 menus. applemenu_getitemcount 2u800 endu800 function function applemenu_getitemid npos applemenu_getitemid npos endu800 function function applemenu_getitempos nitemid applemenu_getitempos nitemid endu800 function subu800 applemenu_enableitem nitemid benable endu800 subu800 function applemenu_isitemenabled nitemid applemenu_isitemenabled true endu800 function subu800 applemenu_setitemtext nitemid ctext endu800 subu800 function applemenu_getitemtext nitemid citemname ifu800 nitemid 1u800 then citemname apple pieu800 elseif nitemid 2u800 then citemname apple juice endif applemenu_getitemtext citemname endu800 function subu800 applemenu_setpopupmenu nitemid oxpopupmenu endu800 subu800 function applemenu_getpopupmenu nitemid dimu800 opopupmenu asu800 object applemenu_getpopupmenu opopupmenu endu800 function subu800 applemenu_insertseparator npos endu800 subu800 subu800 applemenu_setdefaultitem nitemid endu800 subu800 function applemenu_getdefaultitem applemenu_getdefaultitem 1u800 endu800 function subu800 applemenu_checkitem nitemid bcheckmark endu800 subu800 function applemenu_isitemchecked nitemid applemenu_isitemchecked false endu800 function function applemenu_execute owindowpeerparent oarearect ndirection applemenu_execute 0u800 endu800 function '################################################## ' comu800u82esunu800u82estaru82eawtu800u82expopupmenu '################################################## subu800 orangemenu_addmenulistener xlistener endu800 subu800 subu800 orangemenu_removemenulistener xlistener endu800 subu800 ' this trivial implementation ofu800 theu800 interface ' does notu800 support inserting oru800 removing items. subu800 orangemenu_insertitem nitemid ctext nitemstyle npos endu800 subu800 subu800 orangemenu_removeitem npos ncount endu800 subu800 ' this joke implementation ofu800 theu800 interface ' hasu800 hardcoded theu800 contents ofu800 theu800 menu baru800. ' calling insertitem oru800 removeitem does notu800 change ' what theu800 following routines return. function orangemenu_getitemcount ' weu800 have twou800 menus. orangemenu_getitemcount 2u800 endu800 function function orangemenu_getitemid npos orangemenu_getitemid npos endu800 function function orangemenu_getitempos nitemid orangemenu_getitempos nitemid endu800 function subu800 orangemenu_enableitem nitemid benable endu800 subu800 function orangemenu_isitemenabled nitemid orangemenu_isitemenabled true endu800 function subu800 orangemenu_setitemtext nitemid ctext endu800 subu800 function orangemenu_getitemtext nitemid citemname ifu800 nitemid 1u800 then citemname orange juice elseif nitemid 2u800 then citemname orange jello endif orangemenu_getitemtext citemname endu800 function subu800 orangemenu_setpopupmenu nitemid oxpopupmenu endu800 subu800 function orangemenu_getpopupmenu nitemid dimu800 opopupmenu asu800 object orangemenu_getpopupmenu opopupmenu endu800 function subu800 orangemenu_insertseparator npos endu800 subu800 subu800 orangemenu_setdefaultitem nitemid endu800 subu800 function orangemenu_getdefaultitem orangemenu_getdefaultitem 1u800 endu800 function subu800 orangemenu_checkitem nitemid bcheckmark endu800 subu800 function orangemenu_isitemchecked nitemid orangemenu_isitemchecked false endu800 function function orangemenu_execute owindowpeerparent oarearect ndirection orangemenu_execute 0u800 endu800 function  atenciu8c3b3n probablemente tenga errores  your first macro stops atu800 hisu800 position ' .parent 0u800 '.parent createunovalue comu800u82esunu800u82estaru82eawtu800u82exwindowpeer 0u800 .parent oawttoolkitu82egetdesktopwindow with theu800 error message comu800u82esunu800u82estaru82elangu82eillegalargumentexception message; illegal value given. thenew macro stops atu800 owindowu82esetmenubar omenubar with theu800 message argument isu800 notu800 optional. 