|
| 1 | +<h2>Routines example</h2> |
| 2 | +<pre><code> |
| 3 | +use ::BBjGridExWidget/BBjGridExWidget.bbj::BBjGridExWidget |
| 4 | +use com.basiscomponents.db.ResultSet |
| 5 | +use com.basiscomponents.bc.SqlQueryBC |
| 6 | + |
| 7 | +declare auto BBjTopLevelWindow wnd! |
| 8 | +wnd! = BBjAPI().openSysGui("X0").addWindow(10, 10, 800, 600, "My First Grid") |
| 9 | +wnd!.setCallback(BBjAPI.ON_CLOSE,"byebye") |
| 10 | + |
| 11 | +gosub main |
| 12 | +process_events |
| 13 | + |
| 14 | +rem Retrieve the data from the database and configure the grid |
| 15 | +main: |
| 16 | +declare SqlQueryBC sbc! |
| 17 | +declare ResultSet rs! |
| 18 | +declare BBjGridExWidget grid! |
| 19 | + |
| 20 | +sbc! = new SqlQueryBC(BBjAPI().getJDBCConnection("CDStore")) |
| 21 | +rs! = sbc!.retrieve("SELECT * FROM CDINVENTORY") |
| 22 | + |
| 23 | +grid! = new BBjGridExWidget(wnd!, 100, 0, 0, 800, 600) |
| 24 | +grid!.setData(rs!) |
| 25 | +return |
| 26 | + |
| 27 | +byebye: |
| 28 | +bye |
| 29 | +</code></pre> |
| 30 | + |
| 31 | +<h2>OOP example</h2> |
| 32 | +<pre><code> |
| 33 | +use java.util.Arrays |
| 34 | +use java.util.ArrayList |
| 35 | +use ::BBjGridExWidget/BBjGridExWidget.bbj::BBjGridExWidget |
| 36 | + |
| 37 | +rem /** |
| 38 | +rem * This file is part of the MyPackage. |
| 39 | +rem * |
| 40 | +rem * For the full copyright and license information, please view the LICENSE |
| 41 | +rem * file that was distributed with this source code. |
| 42 | +rem */ |
| 43 | +rem /** |
| 44 | + |
| 45 | +class public Employee |
| 46 | +field public BBjNumber ID |
| 47 | +field public BBjString Name$ |
| 48 | +classend |
| 49 | + |
| 50 | +class public Salaried extends Employee implements Payable |
| 51 | +field public BBjNumber MonthlySalary |
| 52 | +method public BBjNumber pay() |
| 53 | +methodret #MonthlySalary |
| 54 | +methodend |
| 55 | +method public void print() |
| 56 | +print "Employee",#getID(),": ",#getName() |
| 57 | +print #pay():"($###,###.00)" |
| 58 | +methodend |
| 59 | +method public BBjNumber account() |
| 60 | +methodret 11111 |
| 61 | +methodend |
| 62 | +classend |
| 63 | +</code></pre> |
0 commit comments