[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).

'~Constants

//Windows
begin enum 1
_Untitled1Wnd
end enum

//_Untitled1Wnd Controls
begin enum 1
_checkBox1
_checkBox2
end enum

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

wa = _kWindowCloseBoxAttribute¬
      _kWindowCollapseBoxAttribute¬
      _kWindowFullZoomAttribute¬
      _kWindowResizableAttribute

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 ) ==  
_kControlCheckBoxCheckedValue
print "check 1 is checked"
xelse
print "check 1 is UNchecked"
end if
end fn

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

end fn


'~Init
local fn Init
'~'1
fn BuildUntitled1Wnd
end fn

'~DoDialog
local fn DoDialog
'~'1
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

'~Main
fn Init

on dialog fn DoDialog

do
HandleEvents
until gFBQuit



Brian S.