Re: Synchronize column width of two tables

2004-06-07 Thread Bert Halstead
 There is no way to share the fiducials, is there?

Friedger,

The way Grid and Table are currently built, there is not a way to share
fiducials between multiple Tables (or Grids).  It would certainly be interesting
to be able to do so, although it could also be fairly hairy in the general case.

So about the only alternatives I can suggest to you are either (1) use some kind
of scheme like Cheese outlined, where you observe the changes in sizes of
objects in one Table and propagate them explicitly to a second Table (or
actually the second container might not have to be a Table, depending on your
situation), or else (2) find a way to combine your two Tables into one, perhaps
by putting the intervening material, or an empty placeholder, also in the Table.
Depending on your situation, you could make this work by adding the intervening
material as an object that spans all of the Table's rows (or columns) -- or if
you use an empty placeholder, present the intervening material as another object
overlaid over the placeholder.  -Bert

***
To unsubscribe from this list, send a mail to:
mailto:[EMAIL PROTECTED]
To contact a human list administrator, send a mail to:
mailto:[EMAIL PROTECTED]
To recieve a list of other options for this list, send a mail to:
mailto:[EMAIL PROTECTED]



Re: Synchronize column width of two tables

2004-06-06 Thread John Chisholm

My first thought was to use events but then I thought Observer/Observable
might make better sense. Some basic sample code is below. As always, this
implementation is liable to be incomplete, and there may be better ways, but
this seems to do what I think you're asking for.

Cheese

|| 
{curl 3.0 applet}

{import * from CURL.UTIL.OBSERVER}

{define-class MyTable {inherits Table, Observer, Observable}
  {constructor {default ...}
{construct-super.Table ...}
  }
  {method public {handle-observer-message source:Observable,
message:any}:void
{type-switch message
 case ws:{Array-of any} do
{for i:int = 0 below ws.size do
{if i  self.column-count then
|| I'm not sure, but there may be times where
|| you want to check ws[i] for null first.
set {self.get-column i}.width = ws[i]
}
}
}
  }
  {method public {notify message:any = null}:void
let ws:{Array-of any} = {new {Array-of any}}
{for i:int = 0 below self.column-count do
{ws.append {self.get-column i}.width}
}
{self.notify-observers message = ws}
  }
}

{value
let t1:MyTable =
{MyTable
cell-border-width = 1pt,
cell-border-color = black,
A, B, C
}
let t2:MyTable =
{MyTable
cell-border-width = 1pt,
cell-border-color = black,
A, B, C
}
{t1.add-observer t2}
||--{t2.add-observer t1}
{VBox
{ScrollBox
width = 6cm,
t1
},
{ScrollBox
t2
},
{HBox
{CommandButton
label = Set,
{on Action do
set {t1.get-column 0}.width = 1cm
set {t1.get-column 1}.width = 3cm
{t1.notify}
}
},
{CommandButton
label = Reset,
{on Action do
{if-non-null tc = {t1.get-column 0} then
{unset tc.width}
}
{if-non-null tc = {t1.get-column 1} then
{unset tc.width}
}
{t1.notify}
}
}
}
}
}


- Original Message - 
From: Friedger [EMAIL PROTECTED]
To: Curlbreaker-l [EMAIL PROTECTED]
Sent: Sunday, June 06, 2004 10:32 AM
Subject: Synchronize column width of two tables


 Hi,

 is it possible to synchronise the column widths of two different tables?

 I would like to use it like the following:

 {VBox
 {ScrollBox
 {Table A, B, C}
 },
 {ScrollBox
 {Table A, B, C}
 }
 }

 Any thoughts?

 Cheers,
 Friedger

 ***
 To unsubscribe from this list, send a mail to:
 mailto:[EMAIL PROTECTED]
 To contact a human list administrator, send a mail to:
 mailto:[EMAIL PROTECTED]
 To recieve a list of other options for this list, send a mail to:
 mailto:[EMAIL PROTECTED]




***
To unsubscribe from this list, send a mail to:
mailto:[EMAIL PROTECTED]
To contact a human list administrator, send a mail to:
mailto:[EMAIL PROTECTED]
To recieve a list of other options for this list, send a mail to:
mailto:[EMAIL PROTECTED]