home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
stazsoftware.com
/
www.stazsoftware.com.tar
/
www.stazsoftware.com
/
futurebasic
/
sample-code
/
SwitchingToFB.sit
/
storage_bin
/
Window.incl
< prev
next >
Wrap
Text File
|
2002-07-31
|
5KB
|
178 lines
/*
this function insures that you are not entering
text before 'new' is selected
*/
LOCAL FN storBinEFFilter
'~';
DIM ignore
LONG IF gCurrentRecord(WINDOW(_outputWnd)) == -1//oops! no record created yet
CALL PARAMTEXT("Click 'New' to create a record","before attempting to type.","","")
ignore = FN NOTEALERT(1,0)
EDIT FIELD 0
XELSE
TEKEY$ = TEKEY$
END IF
END FN
/*
this routine builds a prompt field (static text) and
an editable field.
*/
LOCAL FN createFields(prompt$,efNum,dividingLine,prevBottom)
'~';
DIM r AS RECT
DIM err AS OSErr
gEFfilterAddr = @fn storBinEFFilter
err = FN USETHEMEFONT(_kThemeEmphasizedSystemFont,_smSystemScript)
SETRECT(r,_margin,prevBottom + _margin,dividingLine - _margin \\2 ,prevBottom + _margin + USR FONTHEIGHT)
EDIT FIELD efNum + 1000, prompt, @r,_statNoFramed,_rightJust
r.left = dividingLine + _margin\\2
r.right = WINDOW(_width) -_margin
err = FN USETHEMEFONT(_kThemeApplicationFont,_smSystemScript)
EDIT FIELD efNum,"",@r,_framedNoCR,_leftJust,gEFfilterAddr
END FN = r.bottom
/*
this routine builds the navigation buttons in the
storage bin editor window and moves the rectangle
to the left so that it is in position for the next
button
*/
LOCAL FN buildButton(bRef,cTitle AS STR255,@rPtr AS ^RECT,state)
'~';
DIM r AS RECT
DIM err AS OSErr
DIM wd AS WORD
BLOCKMOVE rPtr,@r,SIZEOF(RECT)
err = FN USETHEMEFONT(_kThemeSystemFont,_smSystemScript)
wd = FN STRINGWIDTH(cTitle) + _margin * 3
r.left = r.right - wd
APPEARANCE BUTTON bRef,state,1,0,1,cTitle,@r,┬
_kControlPushButtonProc_kControlUsesOwningWindowsFontVariant
rPtr.right = r.left - _margin
END FN
/*
here, we open a storage bin window & build
the fields and buttons
*/
LOCAL FN openSBWindow(wRef AS LONG, wTitle AS STR63)
'~';
DIM r AS RECT
DIM wClass AS WindowClass
DIM wAttributes AS WindowAttributes
DIM err AS OSErr
dim bot
_edge = 96
// the window
SETRECT(r,0,0,360,260)
wClass = _kDocumentWindowClass
wAttributes = _kWindowCloseBoxAttribute_kWindowCollapseBoxAttribute
DEF NEWWINDOWPOSITIONMETHOD(_kWindowCascadeOnMainScreen)
APPEARANCE WINDOW wRef,wTitle,@r,wClass,wAttributes
DEF SETWINDOWBACKGROUND( _kThemeActiveDialogBackgroundBrush,_zTrue)
// the record number
err = FN USETHEMEFONT(_kThemeEmphasizedSystemFont,_smSystemScript)
SETRECT(r,_margin,_margin,WINDOW(_width)-_margin,_margin + USR FONTHEIGHT)
EDIT FIELD _recNumField,,@r,_statNoFramed
bot = r.bottom
bot = FN createFields("Last Name:" ,_lastNameField ,_edge ,bot)
bot = FN createFields("First Name:",_firstNameField,_edge ,bot)
bot = FN createFields("Address:" ,_address1Field ,_edge ,bot)
bot = FN createFields("" ,_address2Field ,_edge ,bot)
bot = FN createFields("City:" ,_cityField ,_edge ,bot)
bot = FN createFields("State:" ,_stateField ,_edge ,bot)
bot = FN createFields("Zip:" ,_zipfield ,_edge ,bot)
bot = FN createFields("Phone:" ,_phonefield ,_edge ,bot)
EDIT FIELD _lastNameField
// navigation buttons
r.bottom = WINDOW(_height) - _margin
r.right = WINDOW(_width ) -_margin
r.top = r.bottom - 24
r.left = r.right - 24
FN buildButton(_lastBtn ,"->|",r,_grayBtn)
FN buildButton(_nextBtn ,"->",r,_grayBtn)
FN buildButton(_prevBtn ,"<-",r,_grayBtn)
FN buildButton(_firstBtn,"|<-" ,r,_grayBtn)
FN buildButton(_newBtn ,"New" ,r,_grayBtn)
FN buildButton(_delBtn ,"Delete",r,_grayBtn)
FN displayRecord
END FN
/*
this opens the preference window & builds
the fields and buttons
*/
LOCAL FN openPrefWindow
'~';
DIM r AS RECT
DIM wClass AS WindowClass
DIM wAttributes AS WindowAttributes
DIM err AS OSErr
DIM b AS WORD
DIM btnValue AS WORD
// the window
SETRECT(r,0,0,300,108)
wClass = _kDocumentWindowClass
wAttributes = _kWindowCloseBoxAttribute_kWindowCollapseBoxAttribute
DEF NEWWINDOWPOSITIONMETHOD(_kWindowAlertPositionOnMainScreen)
APPEARANCE WINDOW _prefWnd,"Preferences",@r,wClass,wAttributes
DEF SETWINDOWBACKGROUND( _kThemeActiveDialogBackgroundBrush,_zTrue)
b = FN createFields("Report Title:" ,_preftitleFld ,92 ,8)
EDIT$(_preftitleFld) = gPref.reportTitle
SETRECT(r,8,b + _margin * 2,WINDOW(_width)\\2,b + USR FONTHEIGHT+ _margin * 2)
LONG IF gPref.titleInfoFlags AND _includeDateMask
btnValue = _kControlCheckBoxCheckedValue
XELSE
btnValue = _kControlCheckBoxUncheckedValue
END IF
APPEARANCE BUTTON _prefIncludeDateBtn,_activebtn ,btnValue,0,┬
_kControlCheckBoxCheckedValue,"Include Date",┬
@r,_kControlCheckBoxProc
r.left = r.Right + _margin
r.Right = WINDOW(_width) -_margin
LONG IF gPref.titleInfoFlags AND _includePageNumber
btnValue = _kControlCheckBoxCheckedValue
XELSE
btnValue = _kControlCheckBoxUncheckedValue
END IF
APPEARANCE BUTTON _prefIncludePageNumberBtn,_activebtn ,btnValue,0,┬
_kControlCheckBoxCheckedValue,"Include Page #",┬
@r,_kControlCheckBoxProc
r.bottom = WINDOW(_height) - _margin
r.right = WINDOW(_width ) -_margin
r.top = r.bottom - 24
r.left = r.right - 24
FN buildButton(_prefOKBtn ,"OK" ,r ,_activeBtn)
FN buildButton(_prefCancelBtn ,"Cancel",r ,_activeBtn)
END FN