[futurebasic] Re: [FB] A Scrolling Puzzle PS

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : November 2002 : Group Archive : Group : All Groups

From: Ken Shmidheiser <kshmidheiser@...>
Date: Sat, 2 Nov 2002 01:17:26 -0500
Responding to Alain Pastor, Joe wrote:

>Alain Pastor wrote:
>
>  > Joe,
>>
>>  Check if the EF rectangle and the scrollbar rectangle don't overlap.
>>
>Thanks for the suggestion, but I didn't specify the rect for the scroll
>button; I assumed from what the manual says, that it is located and
>handled automatically. It appears in the right relationship to the edit
>field; just doesn't work.  Actually, I don't believe they do overlap. If
>I adjust the field width so that they do, then the text runs under the
>scroll bar. Still struggling!
>
>Joe Wilkins

Joe,

Perhaps this little Appearance demo will help. Tested in PPC and
Carbon OS X. You must build a rect for the 16-pixel wide scroll
button built beginning from the left edge of the edit field. Also, if
you use the Edit statement to provide a margin around your edit
field, as I do below, you must compensate for the 4 pixel difference.

HTH

Ken


#if cpu68K
compile shutdown "Requires PPC or Carbon Compile"
#endif

begin globals
dim as container gC
end globals

local fn FillContainer
gC += "'Twas brillig, and the slithy toves" + chr$(13)
gC += "Did gyre and gimble in the wabe;" + chr$(13)
gC += "All mimsy were the borogoves," + chr$(13)
gC += "And the mome raths outgrabe." + chr$(13) + chr$(13)
gC += """Beware the Jabberwock, my son!""" + chr$(13)
gC += "The jaws that bite, the claws that catch!" + chr$(13)
gC += """Beware the Jubjub bird, and shun" + chr$(13)
gC += "The frumious Bandersnatch!""" + chr$(13) + chr$(13)
gC += "He took his vorpal sword in hand:" + chr$(13)
gC += "Long time the manxome foe he sought--" + chr$(13)
gC += "So rested he by the Tumtum tree," + chr$(13)
gC += "And stood awhile in thought." + chr$(13) + chr$(13)
gC += "And, as in uffish thought he stood," + chr$(13)
gC += "The Jabberwock, with eyes of flame," + chr$(13)
gC += "Came whiffling through the tulgey wood," + chr$(13)
gC += "And burbled as it came!" + chr$(13) + chr$(13)
gC += "One two! One two! And through and through" + chr$(13)
gC += "The vorpal blade went snicker-snack!" + chr$(13)
gC += "He left it dead, and with its head" + chr$(13)
gC += "He went galumphing back." + chr$(13) + chr$(13)
gC += """And hast thou slain the Jabberwock?""" + chr$(13)
gC += "Come to my arms, my beamish boy!" + chr$(13)
gC += """O frabjous day! Callooh! Callay!""" + chr$(13)
gC += "He chortled in his joy."  + chr$(13) + chr$(13)
gC += "'Twas brillig, and the slithy toves" + chr$(13)
gC += "Did gyre and gimble in the wabe;" + chr$(13)
gC += "All mimsy were the borogoves," + chr$(13)
gC += "And the mome raths outgrabe." + chr$(13)
end fn

local fn BuildWindow
dim as rect r

setrect( r, 0, 0, 320, 250)
appearance window -1,"Jabberwocky", @r,¬
_kDocumentWindowClass, _kWindowStandardFloatingAttributes

def SetWindowBackground( _kThemeActiveDialogBackgroundBrush,_zTrue)

/*
    Scroll button and edit field share the same number
    This means no other button in the app can have the
    same number as either that edit field or scroll button.

    Note: The - (negative) sign is no longer need in front of
    the number of a a styled edit field in the Appearance
    Compliant runtime. However, the attached scroll button
    still requires the - (negative) sign upon creation.
*/

_margin = 4
edit = _margin
text _sysfont, 12
setrect( r, 20, 20, 284, 190)
edit field 10, #gC, @r, _framed,_leftJust
setrect( r, 284, 20 -_margin, 300, 190 + _margin)
scroll button -10,0,0,0,0, @r, _scrollOther
setselect 1, 1

gC = ""

setrect( r, 240, 210, 300, 230)
button 1, 1, "Quit", @r, _shadow

edit field 0

window 1

end fn

local fn DoDialog
dim as long evnt, id

evnt = dialog(0)
id = dialog(evnt)

select case( evnt )
case _wndClose
select( id )
case 1 :  gFBQuit = _zTrue
end select
case _btnClick
select( id )
case 1 :  gFBQuit = _zTrue
end select
end select

end fn

on dialog fn DoDialog

fn FillContainer
fn BuildWindow

do
handleevents
until gFBQuit
end