Home Gadgetman Forum Book Reviews Links Contact me X-UFO
Gadgets Processors Programming School Old news
To show some Icons you first need an .MBM file containing the icons and their masks...
(I use MBMView to 'steal' icons from other programs. Try looking at the Z: drive :-)

This .MBM file MUST reside at the same place as your .APP file.

I find that this part should be placed in a separate procedure and called in the beginning of your eventloop procedure.
(BEFORE it start the loop...)

PROC BuildToolbar:
LOCAL mbmpath$(255)
LOCAL icon1&,icon2&,icon3&,icon4&
LOCAL mask1&,mask2&,mask3&,mask4&

   mbmpath$=Appdisk$+":\System\Apps\yourapp\yourapp.mbm"

   icon1&=gLoadBit(mbmpath$,0,0)
   mask1&=gLoadBit(mbmpath$,0,1)
   icon2&=gLoadBit(mbmpath$,0,2)
   mask2&=gLoadBit(mbmpath$,0,3)
   icon3&=gLoadBit(mbmpath$,0,4)
   mask3&=gLoadBit(mbmpath$,0,5)
   icon4&=gLoadBit(mbmpath$,0,6)
   mask4&=gLoadBit(mbmpath$,0,7)
That loaded the Icons(and masks) into memory...
(Now you also see why we 'need' the Appdisk$ variable)
   TBarInit:("title",scrWid%,ScrHght%)
This set up the title of the toolbar, and told the toolbar routines the size of the screen...
(You could 'hardcode them to 640 & 240 but then it would look silly on the Geofox One! NEVER assume that all machines have the same characteristics :-)
   TBarButt:("b",1,"Button1text",0,icon1&,mask1&,1)
   TBarButt:("p",2,"Button2text",0,icon2&,mask2&,1)
   TBarButt:("H",3,"Button3text",0,icon3&,mask3&,1)
   TBarButt:("e",4,"Button4text",0,icon4&,mask4&,1)
Here we define the separate buttons. yes the procedure can be made shorter by using an array(and loop)...
(But why complicate matters when you don't need to :-) After this is done you should call
TBarShow:

<<1. Toolbars 101>>
<<User friendliness>>
<<Toolbar and the Eventloop>>