[futurebasic] Jumpin' Jimminy

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : July 2003 : Group Archive : Group : All Groups

From: Ken Shmidheiser <kshmidheiser@...>
Date: Wed, 23 Jul 2003 19:20:44 -0400
Okay, here is one of those "I'm too stupid, lazy, 
(--fill in your word--) to figure this out" 
questions.

I'm using a disclosure triangle to reveal a part 
of a window with additional options/info. Since 
the window changes dimension with each click of 
the triangle, I am attempting to maintain the 
present window coordinates using the new 
Appearance WINDOW() commands on Carbon OS X.

Now the problem: Each time the triangle is 
clicked the window jumps upward. After several 
clicks it has moved off the screen.

Could some kind soul show me the error of my ways?

Thanks,

Ken


'~'A
'                       Runtime : Rntm Appearance.Incl
'                           CPU : Carbon
'                      Debugger : Off
'               DIM'd Vars Only : On
'              No Re-DIM'd Vars : On
'                    CALL Req'd : Off
'                 Register Vars : On
'                MacsBug Labels : On
'           Ary Bounds Checking : On
'                     QB Labels : Off
'                 Optimize STR# : On
'         Make Line Start Table : Off
'                 Show Warnings : On
'~'B

local fn BuildWindow
dim as rect r

setrect( r, 0, 0, 580, 460 )
appearance Window -1, "Jumpin' Jimminy", @r, ¬
_kDocumentWindowClass, _kWindowStandardFloatingAttributes

def SetWindowBackground( _kThemeActiveDialogBackgroundBrush,_zTrue)

text _applFont, 12
edit = 4
setrect( r, 20, 20, 560, 200)
edit field 1,"Doin' stuff here...", @r,_framed,_leftJust

setrect( r, 20, 240, 560, 440)
edit field 2,"...and doin' more stuff here.", @r,_framed,_leftJust

setrect( r, 10, 212, 25, 228 )
appearance button 10, _activeBtn, 0, 0, 1,¬
"",@r,_kControlTriangleAutoToggleProc

setrect( r, 0, 0 , 580, 230 )
window -1,,@r

def windowreposition( 1, 0, _kWindowCenterOnMainScreen )

edit field 0

window 1

end fn

local fn WindowToggle( btnID as long )
dim as rect   r
dim as handle btnH
dim as long   value, t, l, w, h

  btnH = BUTTON&( btnID )
value = FN GETCONTROLVALUE( btnH )

l = window(_kFBstructureLeft)
t = window(_kFBstructureTop)
w = window(_kFBstructureWidth)
h = window(_kFBstructureHeight)

long if value = 1
setrect( r, l, t, l + 580, t + 460 )
window 1,,@r
window output 1
xelse
setrect( r, l, t, l + 580, t + 230 )
window 1,,@r
window output 1
end if

edit field 0

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 10 : fn WindowToggle( id )
end select
end select

end fn

on dialog fn DoDialog

fn BuildWindow

do
handleevents
until gFBQuit
end