Interface RecordSetFillable

Description

In BBj 4.0 and higher, any BBjControl that supports filling from a BBjRecordSet implements the RecordSetFillable.

Superinterfaces

RecordSetBindable

Implementing Classes

BBjListBox, BBjListButton, BBjListEdit, BBjListSpinner

Methods of RecordSetFillable

Return Value

Method

void

fillFromRecordSet(BBjRecordSet recordset, string fieldname)

Methods inherited from RecordSetBindable

Return Value

Method

void

bindRecordSet(BBjRecordSet recordset, string fieldname)

string

getBoundFieldName()

Example

REM Data-bound controls sample for fillFromRecordSet

REM Obtain the instance of the BBjAPI object
LET myAPI!=BBjAPI()

REM Open the SysGui device
SYSGUI=UNT
OPEN (SYSGUI)"X0"

rem ' If the client is Java 1.4.2 or later on Windows XP, set XP L&F
if (info(3,6)="0" and info(0,0)="Windows XP" and info(1,1)>="1.4.2") or (info(3,6)<>"0" and
: BBjAPI().getThinClient(err=*next).getClientOSName(err=*next)="Windows XP" and
: BBjAPI().getThinClient(err=*next).getClientJavaVersion(err=*next)>="1.4.2") then
: if java.lang.System.getProperty("swing.noxp")=null() then
: BBjAPI().getSysGui().setLookAndFeel("WindowsXPLookAndFeel")

REM Obtain the instance of the BBjSysGui object
LET mySysGui!=myAPI!.getSysGui()

REM ' Create the data file
FILENAME$="State.dat"
MODES$=""
TEMPLATE$="STATE:C(2),NAME:C(16*=0)"
erase FILENAME$,err=*next
mkeyed FILENAME$,[0:1:2],0,32
channel=unt
open (channel)FILENAME$
dim REC$:TEMPLATE$

REM ' Load the file with state codes and names
while 1
dread rec.state$,rec.name$,END=*break
write record (channel)rec$
wend
close (channel)

REM ' Create a file-based RecordSet
RecordSet! = BBJAPI().createFileRecordSet(FILENAME$,MODES$,TEMPLATE$)

REM Set addWindow param values
X=200
Y=200
WIDTH=350
HEIGHT=200
TITLE$="Data-bound controls sample"

REM Set the current context
mySysGui!.setContext(0)

REM Create a window
myWindow! = mySysGui!.addWindow(X,Y,WIDTH,HEIGHT,TITLE$)

myWindow!.addStaticText(101,50,10,100,25,"State:")
state! = myWindow!.addStaticText(201,100,10,40,25,"")
state!.bindRecordSet(RecordSet!,"state")

myWindow!.addStaticText(102,50,40,100,25,"Name:")
name! = myWindow!.addStaticText(202,100,40,200,25,"")
name!.bindRecordSet(RecordSet!,"name")

myWindow!.addStaticText(103,50,70,150,25,"List:")
list! = myWindow!.addListBox(203,100,70,200,50,"")
list!.fillFromRecordSet(RecordSet!,"name")
list!.bindRecordSet(RecordSet!,"name")

Navigator! = myWindow!.addNavigator(100,50,120,250,30,"Navigator",$$)
Navigator!.setCallback(Navigator!.ON_NAV_FIRST,"firstRecord")
Navigator!.setCallback(Navigator!.ON_NAV_PREVIOUS,"previousRecord")
Navigator!.setCallback(Navigator!.ON_NAV_NEXT,"nextRecord")
Navigator!.setCallback(Navigator!.ON_NAV_LAST,"lastRecord")

toggle! = myWindow!.addButton(1,50,160,80,25,"Unbind")
toggle!.setCallback(toggle!.ON_BUTTON_PUSH,"toggle")

close! = myWindow!.addButton(2,220,160,80,25,"Close")
close!.setCallback(close!.ON_BUTTON_PUSH,"APP_CLOSE")

myWindow!.setCallback(myWindow!.ON_CLOSE,"APP_CLOSE")

process_events

toggle:
boundRecordSet!=list!.getBoundRecordSet(err=bind)
list!.unbindRecordSet()
toggle!.setText("Bind")
return

bind:
list!.bindRecordSet(RecordSet!,"name")
toggle!.setText("Unbind")
return

firstRecord:
RecordSet!.first()
return

previousRecord:
RecordSet!.previous(err=*next)
return

nextRecord:
RecordSet!.next(err=*next)
return

lastRecord:
RecordSet!.last()
return

DATA "AK","Alaska"
DATA "AL","Alabama"
DATA "AR","Arkansas"
DATA "AZ","Arizona"
DATA "CA","California"
DATA "CO","Colorado"
DATA "CT","Connecticut"
DATA "DC","District of Columbia"
DATA "DE","Delaware"
DATA "FL","Florida"
DATA "GA","Georgia"
DATA "GU","Guam"
DATA "HI","Hawaii"
DATA "IA","Iowa"
DATA "ID","Idaho"
DATA "IL","Illinois"
DATA "IN","Indiana"
DATA "KS","Kansas"
DATA "KY","Kentucky"
DATA "LA","Louisiana"
DATA "MA","Massachusetts"
DATA "MD","Maryland"
DATA "ME","Maine"
DATA "MI","Michigan"
DATA "MN","Minnesota"
DATA "MO","Missouri"
DATA "MS","Mississippi"
DATA "MT","Montana"
DATA "NC","North Carolina"
DATA "ND","North Dakota"
DATA "NE","Nebraska"
DATA "NH","New Hampshire"
DATA "NJ","New Jersey"
DATA "NM","New Mexico"
DATA "NV","Nevada"
DATA "NY","New York"
DATA "OH","Ohio"
DATA "OK","Oklahoma"
DATA "OR","Oregon"
DATA "PA","Pennsylvania"
DATA "PR","Puerto Rico"
DATA "RI","Rhode Island"
DATA "SC","South Carolina"
DATA "SD","South Dakota"
DATA "TN","Tennessee"
DATA "TX","Texas"
DATA "UT","Utah"
DATA "VA","Virginia"
DATA "VI","Virgin Islands"
DATA "VT","Vermont"
DATA "WA","Washington"
DATA "WI","Wisconsin"
DATA "WV","West Virginia"
DATA "WY","Wyoming"

APP_CLOSE:
release

end

See Also

BBjAPI

BBjSysGui

BBjRecordSet

RecordSetBindable

See the BBj Object Diagram for an illustration of the relationship between BBj Objects.



______________________________________________________________________________________

Copyright BASIS International Ltd. BBj®, Visual PRO/5®, PRO/5®, and BBx® are registered trademarks.