table control

From: Erik Spaans <"Erik>
Date: Tue, 17 Jun 2003 19:27:42 +0200

Hello,

I am experimenting a little with BlackBox. I'm trying to create a form with
a table control. It's a simple 2 by 2 table with a little text in one of the
cells. I first tried something simular to the other complex controls (list
box etc), as follows:

MODULE ExTable;

IMPORT
Dialog,StdTables;

VAR

Dlg* : RECORD
tab* : StdTables.Table;
END;
item : Dialog.String;

PROCEDURE Do*;
BEGIN
END Do;

BEGIN
Dlg.tab.SetSize(2,2);

item := 'ABC';
Dlg.tab.SetItem(0,0,item);

END ExTable.
<commander>"StdCmds.OpenAuxDialog('Ex/Rsrc/Table','TABLE')";
 
After compiling and linking the module to a new form it displays something,
but not a 2 by 2 table, just 2 fields with captions.

I read the StdTables documentation and it says to create a table object
first:

MODULE ExTable;

IMPORT
Dialog,StdTables, Controls, Views;

VAR

Dlg* : RECORD
tab* : StdTables.Table;
END;

p : Controls.Prop;
v : Views.View;

item : Dialog.String;

PROCEDURE Do*;
BEGIN
END Do;

BEGIN
v := StdTables.dir.NewControl(p); (* create table object with
factory method *)


Dlg.tab.SetSize(2,2);

item := 'ABC';
Dlg.tab.SetItem(0,0,item);

END ExTable.
"StdCmds.OpenAuxDialog('Ex/Rsrc/Table','TABLE')";
 
It compiles, but on execution runs into a trap (probably because the
properties pointers is NIL). But in any case I do not understand how to link
the table view v to the tab variable. There is no example. I'm also not very
sure how to set the properties.

Can someone send me an example how to the above correctly (and just possibly
a few of more complex uses)?

Erik







Received on Tue Jun 17 2003 - 19:27:42 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:29:11 UTC