[futurebasic] Re: [FB] porting program

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : February 2008 : Group Archive : Group : All Groups

From: Brian Stevens <bstevens33@...>
Date: Sat, 2 Feb 2008 11:13:48 -0700
On Feb 2, 2008, at 9:08 AM, Bob Bryce wrote:

> However, I haven't got radio buttons and check boxes working yet  
> for the rest
> of the WINDOW info. My attempt so far looks like this;

Bob - here is a code snippet. I made some assumptions since your  
email doesn't say whether it uses the appearance runtime (it should).  
Also it doesn't show how the checkboxes and window are created.

If you are NOT creating your window and checkboxes using this method,  
I recommend you do (unless you are using a nib).


begin enum 1
end enum

//_Untitled1Wnd Controls
begin enum 1
end enum

'~Build Untitled1Wnd
local fn BuildUntitled1Wnd
dim as Rect                r
dim as WindowAttributes    wa

wa = _kWindowCloseBoxAttribute¬

SetRect( r, 0, 0, 382, 207 )

appearance window -_Untitled1Wnd, "Untitled 1", @r,  
_kDocumentWindowClass, wa
def SetWindowBackground( _kThemeActiveDialogBackgroundBrush, _zTrue )

SetRect( r, 135, 66, 205, 80 )
appearance button _checkBox1,, _kControlCheckBoxCheckedValue,,,  
"Check1", @r, _kControlCheckBoxAutoToggleProc

SetRect( r, 135, 99, 205, 113 )
appearance button _checkBox2,, _kControlCheckBoxCheckedValue,,,  
"Check2", @r, _kControlCheckBoxAutoToggleProc

appearance window _Untitled1Wnd
end fn

local fn ProcessCheckBox1
long if button (_checkBox1,_FBGetCtlRawValue ) ==  
print "check 1 is checked"
print "check 1 is UNchecked"
end if
end fn

local fn ProcessCheckBox2
long if button (_checkBox2,_FBGetCtlRawValue ) ==  
print "check 2 is checked"
print "check 2 is UNchecked"
end if

end fn

local fn Init
fn BuildUntitled1Wnd
end fn

local fn DoDialog
dim as Rect r
dim as long ev, id

ev = dialog( 0 )
id = dialog( ev )

select ev
case _wndClick : window id
case _btnClick
select window( _outputWnd )
case _Untitled1Wnd
select id
case _checkBox1 : fn ProcessCheckBox1
case _checkBox2 : fn ProcessCheckBox2
end select
end select
end select
end fn

fn Init

on dialog fn DoDialog

until gFBQuit

Brian S.