Blitz (39/176)

From:David McMinn
Date:7 Jul 2001 at 14:08:37
Subject:Re: Gadget Borders

Thilo K�hler says the moon is made of cheese, but it's actually made of Gadget Borders

> Question:
> Is it possible create a gtbutton gadget without a border ?
> There is a border-tags only for text- and stringgadgets.

I cannot find anything in the autodocs for removing a border from a
GTButton. And since gadtools.library creates the images for the gadgets, I
don't think there would be a (non-hacky) way to remove the borders after it was
created.

> I need it to do pages like in MUI, maybe there
> is another way to do this.

Perhaps the simplest thing would be to create a shape of the correct size
and render the correct font into it and use a GTShape.

Something like:

; Assuming you already have font loaded as #0 for gadgets
*scr.Screen = Peek.l(Addr Screen(Used Screen))
*di.DrawInfo = GetScreenDrawInfo(*scr)

DEFTYPE.RastPort rp
InitRastPort_ &rp
SetFont_ &rp,Peek.l(Addr IntuitFont(0)+8) ; Get TextFont structure
SetAPen_ &rp,Peek.w(*di\dri_Pens + #TEXTPEN * Sizeof.w)
SetDrMd_ &rp,#JAM1

; Example text and sizes of gadget
gad_text$="A Button"
gad_width.w=100
gad_height.w=14

; This is not what gadtools.library does - it simply overwrites the edges
; of the gadget (I think) or at least it increases the size of the gadget
; to hold the imagery correctly.
numchars.w = TextFit_(&rp, &gad_text$, Len(gad_text$), &te.TextExtent, 0,
1, gad_width, gad_height)

InitShape 0,gad_width,gad_height,*scr\Depth
ShapesBitMap 0,0
rp\BitMap = Addr BitMap 0

Move_ &rp,0,0 ; Not sure if this is correct - it may need
; to be &rp,0,font height
Text_ &rp,&gad_text$,numchars
FreeScreenDrawInfo_ *di

GTShape gtlist,gadid,x,y,gad_width,gad_height,0,0

Bye



[) /\ \/ ][ [) |\/| � |\/| ][ |\| |\| | dave@blitz-2000.co.uk
http://members.nbci.com/david_mcminn | ICQ = 16827694
Yahoo!'s share price dropped by 50%....now it's called OhS**t!

---------------------------------------------------------------------
To unsubscribe, e-mail: blitz-list-unsubscribe@netsoc.ucd.ie
For additional commands, e-mail: blitz-list-help@netsoc.ucd.ie