Skip to content

Commit

Permalink
enhanced sample
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephan Wald committed Jan 1, 2019
1 parent e324fe6 commit 84f902b
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions Demo/TwoGridsDemo.bbj
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ declare auto BBjListButton lb_tbl!
declare auto BBjToolButton btn_fit!
declare BBjGridExWidget grid!

wnd! = BBjAPI().openSysGui("X0").addWindow(10,10,800,600,"BBj Grid Ex Demo")
wnd! = BBjAPI().openSysGui("X0").addWindow(10,10,800,800,"BBj Grid Ex Demo")

grid! = new BBjGridExWidget(wnd!,100,0,0,800,290)
dtlgrid! = new BBjGridExWidget(wnd!,101,0,295,800,290)
recfield! = wnd!.addCEdit(200,10,610,780,180,"")

wnd! .setCallback(BBjAPI.ON_CLOSE,"byebye")
wnd! .setCallback(BBjAPI.ON_RESIZE,"resize")
Expand All @@ -23,7 +24,7 @@ gosub fillGrid

process_events


fillGrid:

declare SqlQueryBC sbc!
Expand All @@ -33,16 +34,18 @@ fillGrid:

grid!.setCallback(grid!.ON_GRID_SELECT_ROW(),"showDetails")
grid!.setSelectionMode(grid!.GRID_SELECT_ROW())
grid!.setMultipleSelection(0)

grid!.setMultipleSelection(0)

dtlgrid!.setCallback(grid!.ON_GRID_SELECT_ROW(),"showRecord")

return

byebye:
bye

resize:
ev! = BBjAPI().getLastEvent()
h=int(ev!.getHeight()/2)-2
h=int((ev!.getHeight()-200)/2)-2
grid!.setSize(ev!.getWidth(),h)
dtlgrid!.setSize(ev!.getWidth(),h)
dtlgrid!.setLocation(0,h+2)
Expand All @@ -55,5 +58,16 @@ showDetails:
dsbc! = new SqlQueryBC(BBjAPI().getJDBCConnection("ChileCompany"))
drs! = dsbc!.retrieve("SELECT * FROM ORDER_HEADER WHERE CUST_NUM='"+cust$+"'")
dtlgrid!.setData(drs!)
return


recfield!.setText("")
return

showRecord:
rec! = grid!.getSelectedRows().get(0).asDataRow()
txt$=str(rec!)
txt$=txt$+$0a$+"----------------------"+$0a$
rec! = dtlgrid!.getSelectedRows().get(0).asDataRow()
txt$=txt$+str(rec!)
recfield!.setText(txt$)

return

0 comments on commit 84f902b

Please sign in to comment.