The fastest easiest way to get it right.

Making a Very Simple Grid

The Andromeda grid is useful for very simple scrollable lists. To make a grid that lists something, you follow these steps:

  1. Create the grid.
  2. Define the columns
  3. Load the Data
class x6example extends androX6 {
    function x6main() {
        # Always begin with this:
        $top = html('div');
        #  ...other html is added here...
        # Now for the grid create command.  The parameters are:
        # 1) Height
        # 2) Table we are editing
        # 3) Flag for lookup textboxes, no in this case
        # 4) Flag for sortable.  No
        # 5) Flag for buttonbar, No, not editable
        # 6) Flag for editable, no
        $grid = $top->addGrid(hSize(300),'states','N','N','N','N');
        # Now add a single column, take it from the
        # data dictinoary, that is always easiest
        $dd = ddTable('songs');
        # Now pull the data and add it.  Note that we
        # pull the 'skey' column so the grid has a
        # unique ID for each row.
        $view = ddtable('songs');
        $sq="select skey,songname from $view";
        $rows = SQL_AllRows($sq);
        # ...and this is always at the end

This code produces a scrollable read-only grid with a list of songs in it. The grid will be 300px high in 1024x768, and it will be scaled appropriately in other skin sizes.

comments powered by Disqus
Home |  Documentation |  Download |  Credits |  Contact |  Login
Andromeda © Copyright 2004-2013, Licensed under the GPL Version 2