Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Can nobody help me? Re: selecting a column in a grid

3 views
Skip to first unread message

Paul Ellsmore

unread,
Apr 3, 2009, 9:12:12 PM4/3/09
to

The key point in this problem is that the columns are not equal widths, and
in fact are variable width, depending on the particular data displayed. So I
set ItemSize to automatic, so that each column width is defined by the data.
The trouble is that MousePosition gives me coordinates that are a linear
function of the position in the grid, but the columns are not linearly
spaced in the Grid, so how do I know which column the mouse is in?

I need one of three things, all three of which are beyond my skills:

1) I could get the actual values that ItemSize is set to when Automatic is
used. CurrentValue[ItemSize] doesn't work. Anyone got an alternative?
2) I could calculate what values ItemSize will be set to by looking at the
type and number of characters in each grid cell, knowing the font size,
font family, cell margins, frame linewidth etc. But I don't have access to
the information needed - how many pixels does a Courier Size 10 "n" take up?
3) I could use EventHandler in a better way. Currently I wrap it around the
whole Grid, but if I could wrap it around a cell, that would work for me. No
syntax that I have tried works - should I try using GridBox, or is there an
obvious better idea?

Nobody got any ideas at all? What kind of language is this, where you can't
even select a column in a table?

Cheers,

Paul.
-----Original Message-----
From: Paul Ellsmore [mailto:paul.e...@nanion.co.uk]
Sent: 01 April 2009 11:55
Subject: selecting a column in a grid

Hi,

I have a tricky problem with a graphical user interface. I have a grid of
data, and I want to be able to MouseClick in the grid to either select a row
or a column. Using GUIKit, this is trivial, but I want to be able to
distribute my program using PlayerPro, which won't support GUIKit.

Selecting a row is straightforward using EventHandler and
EventHandlerScaled, since I know how many rows there are and they are all
one line in height. However, the column widths change according to the data,
since I have set ItemSize to Auto. So is there some way of retrieving the
actual values used in ItemSize, when Auto is used? I have tried
CurrentValue[ItemSize] in many variations, but it always fails.

I could, of course, look at the data that will be in the grid, and compute
the widths of each column accordingly, and synthesize the values that
ItemSize will take. To do that, though, I would need to know what the pixel
width of a particular text string will be, which varies with font family,
size etc. Is there an easy way to do this? This is essentially what
Mathematica does when ItemSize is set to Auto, but I have no idea how to do
it myself.

Currently I have EventHandler wrapped around the whole grid. Is it possible
to wrap it around each individual cell in a grid? I have tried a few ideas,
but they don't seem to work. The documentation suggests that EventHandler
can be wrapped around any expression, but that doesn't seem to be the case,
or at least the wrapped expression doesn't seem to display properly inside
other constructs, such as Grid, Column etc.

Is there some better approach I could take, rather than using EventHandler?

All ideas gratefully received.

Cheers,

Paul.

Dr. Paul A. Ellsmore

Nanion Limited

Oxford Centre for Innovation

Mill Street

Oxford

United Kingdom

OX2 0JX

Tel: +44 (0) 1865 811175

Fax: +44 (0) 1865 248594


Paul Ellsmore

unread,
Apr 5, 2009, 6:32:38 AM4/5/09
to

Sjoerd C. de Vries

unread,
Apr 5, 2009, 6:39:56 AM4/5/09
to
Hi Paul,

Cool down ;-) Try this for inspiration:

Dynamic[clickpos]
Grid[
Table[
DynamicModule[
{col=Black, pos = {i, j}},
EventHandler[
Style[RandomInteger[{0, 1000000}], FontColor -> Dynamic[col]],
{"MouseDown" :> (clickpos = pos; col = Red),
"MouseUp" :> (col = Black)}
]
], {i, 5}, {j, 5}]
]

Cheers -- Sjoerd

On Apr 4, 3:12 am, "Paul Ellsmore" <paul.ellsm...@nanion.co.uk> wrote:
> The key point in this problem is that the columns are not equal widths, a=
nd
> in fact are variable width, depending on the particular data displayed. S=
o I
> set ItemSize to automatic, so that each column width is defined by the da=


ta.
> The trouble is that MousePosition gives me coordinates that are a linear
> function of the position in the grid, but the columns are not linearly
> spaced in the Grid, so how do I know which column the mouse is in?
>
> I need one of three things, all three of which are beyond my skills:
>

> 1) I could get the actual values that ItemSize is set to when Automatic i=


s
> used. CurrentValue[ItemSize] doesn't work. Anyone got an alternative?

> 2) I could calculate what values ItemSize will be set to by looking at th=
e
> type and number of characters in each grid cell, knowing the font size=
,
> font family, cell margins, frame linewidth etc. But I don't have access t=
o
> the information needed - how many pixels does a Courier Size 10 "n" take =
up?
> 3) I could use EventHandler in a better way. Currently I wrap it around t=
he
> whole Grid, but if I could wrap it around a cell, that would work for me.=
No
> syntax that I have tried works - should I try using GridBox, or is there =
an
> obvious better idea?
>
> Nobody got any ideas at all? What kind of language is this, where you can=


't
> even select a column in a table?
>
> Cheers,
>
> Paul.
>
> -----Original Message-----
> From: Paul Ellsmore [mailto:paul.ellsm...@nanion.co.uk]
> Sent: 01 April 2009 11:55
> Subject: selecting a column in a grid
>
> Hi,
>
> I have a tricky problem with a graphical user interface. I have a grid of

> data, and I want to be able to MouseClick in the grid to either select a =


row
> or a column. Using GUIKit, this is trivial, but I want to be able to
> distribute my program using PlayerPro, which won't support GUIKit.
>
> Selecting a row is straightforward using EventHandler and
> EventHandlerScaled, since I know how many rows there are and they are all

> one line in height. However, the column widths change according to the da=


ta,
> since I have set ItemSize to Auto. So is there some way of retrieving the
> actual values used in ItemSize, when Auto is used? I have tried
> CurrentValue[ItemSize] in many variations, but it always fails.
>

> I could, of course, look at the data that will be in the grid, and comput=


e
> the widths of each column accordingly, and synthesize the values that

> ItemSize will take. To do that, though, I would need to know what the pix=


el
> width of a particular text string will be, which varies with font family,
> size etc. Is there an easy way to do this? This is essentially what

> Mathematica does when ItemSize is set to Auto, but I have no idea how to =
do
> it myself.
>
> Currently I have EventHandler wrapped around the whole grid. Is it possib=
le
> to wrap it around each individual cell in a grid? I have tried a few idea=


s,
> but they don't seem to work. The documentation suggests that EventHandler

> can be wrapped around any expression, but that doesn't seem to be the cas=
e,
> or at least the wrapped expression doesn't seem to display properly insid=


e
> other constructs, such as Grid, Column etc.
>

> Is there some better approach I could take, rather than using EventHandle=

Albert Retey

unread,
Apr 5, 2009, 6:41:02 AM4/5/09
to
Hi,

> Currently I have EventHandler wrapped around the whole grid. Is it possible
> to wrap it around each individual cell in a grid? I have tried a few ideas,
> but they don't seem to work. The documentation suggests that EventHandler
> can be wrapped around any expression, but that doesn't seem to be the case,
> or at least the wrapped expression doesn't seem to display properly inside
> other constructs, such as Grid, Column etc.

I think using EventHandler for the content of individual cells will work
much better and it works as documented, see below. The problem is that a
cell in a grid is not something that exists as an individual expression
(Item would actually be, but this indeed doesn't work, it looks like
Grid doesn't recognize the Item as such if it is wrapped with EventHandler).

> Is there some better approach I could take, rather than using EventHandler?

Would this be close to what you want? Admittedly it is a little hacky,
since one needs to play with the ImageMargins and Spacings options to
get a result that has no blind spots for the mouse clicks and looks
decent. The possibility to wrap Item in Grid with EventHandler would be
nicer, or an option for Item that would allow the handling of events...

Deploy[Grid[
MapIndexed[
Item[
EventHandler[
Pane[#1, ImageMargins -> {3*{1, 1}, {0, 0}}],
{"MouseClicked" :> (selectedcolumn = #2[[2]])}],
Background ->
Dynamic[If[selectedcolumn == #2[[2]], LightGray, White]]
] &,
{{aasdf, b, c}, {dasdf, e, f}, {gasdf, h, i}},
{2}
],
Dividers -> All,
Spacings -> 0.15
]]

note that I needed to set a small value for Spacings, otherwise when
clicking in the Spacing-area, the events won't be triggered. Using
Spacings->0 will make the Dividers become invisible which may or may not
be a problem for you. To get back the normal look of the table with
decent margins for the contents of the cells I am using a Pane with
individual ImageMargins options, which you might adopt to your taste. I
was choosing something that is close to the default spacings Grid will
use with no options. Without using Deploy it can happen that instead of
triggering the MouseClick Event you end up selecting some content of the
cell without changing the column selection, so I think usually using
Deploy will be a good choice for an interactive graphical user
interface. Changing the background color for the selected column is just
to demonstrate that it works...

Here is the same thing for selecting cells:

Deploy[Grid[
MapIndexed[
Item[
EventHandler[
Pane[#1, ImageMargins -> {3*{1, 1}, {0, 0}}],
{"MouseClicked" :> (selectedcell = #2)}],
Background -> Dynamic[Switch[selectedcell,
#2, LightRed,{#2[[1]], _}, LightBlue,
{_, #2[[2]]}, LightGreen,_, White]]
] &,
{{aasdf, b, c}, {dasdf, e, f}, {gasdf, h, i}},
{2}
],
Dividers -> All,
Spacings -> 0.15
]]


hth,

albert

Paul Ellsmore

unread,
Apr 6, 2009, 5:00:55 AM4/6/09
to
Thanks Sjoerd,

Unfortunately, this approach has a problem for me, and I have to admit I
don't know why it works at all!

The following example shows my problem (I think I have adapted your code to
use a user-defined list of data properly):
myData = {{aasdfpppppppppppp, bbbbbbbbb, c}, {dasdf, "", f},
{gasdf, h, i}};
Dynamic[clickpos]
Grid[Table[DynamicModule[{col = Black, pos = {i, j}},
EventHandler[Style[myData[[i, j]], FontColor -> Dynamic[col]],

{"MouseDown" :> (clickpos = pos; col = Red),

"MouseUp" :> (col = Black)}]], {i, 3}, {j, 3}],
Frame -> All,
BaseStyle -> {Editable -> False, Selectable -> False}]

In the grid that results, the cell selection only works if the mouse is
clicked inside the text in the cell, not in any whitespace, and the empty
cell cannot be selected at all. This is a problem for me. But how does it
work anyway? Eventhandler seems to be wrapped around the cell contents,
rather than the cell itself, but why is there a dynamic value of {i,j}
associated with the cell? I assume that it is something to do with the fact
that pos is defined within Dynamic, but how does the code know what value of
{i,j} is associated with each block of displayed text? Is this some normal
behaviour of Table that I was not aware of, and where would I look to find
more information about this behaviour? More to the point, is there a way of
forcing each CELL to take the value of {i,j}, because this would solve my
problem instantly?

Incidentally, if you double-click in the empty cell, the whole table goes
blue - why is that?

Many thanks, but I still cannot believe that such a simple task is proving
to be so complicated.

Cheers,

Paul.

-----Original Message-----
From: Sjoerd C. de Vries [mailto:sjoerd.c...@gmail.com]
Sent: 05 April 2009 11:40
Subject: Re: Can nobody help me? Re: selecting a column in a grid

Hi Paul,

Cool down ;-) Try this for inspiration:

Dynamic[clickpos]
Grid[
Table[
DynamicModule[
{col=Black, pos = {i, j}},
EventHandler[
Style[RandomInteger[{0, 1000000}], FontColor -> Dynamic[col]],
{"MouseDown" :> (clickpos = pos; col = Red),
"MouseUp" :> (col = Black)}
]
], {i, 5}, {j, 5}]
]

Cheers -- Sjoerd

On Apr 4, 3:12 am, "Paul Ellsmore" <paul.ellsm...@nanion.co.uk> wrote:

> The key point in this problem is that the columns are not equal widths, a=
nd
> in fact are variable width, depending on the particular data displayed. S=
o I
> set ItemSize to automatic, so that each column width is defined by the da=


ta.
> The trouble is that MousePosition gives me coordinates that are a linear
> function of the position in the grid, but the columns are not linearly
> spaced in the Grid, so how do I know which column the mouse is in?
>
> I need one of three things, all three of which are beyond my skills:
>

> 1) I could get the actual values that ItemSize is set to when Automatic i=


s
> used. CurrentValue[ItemSize] doesn't work. Anyone got an alternative?

> 2) I could calculate what values ItemSize will be set to by looking at th=
e
> type and number of characters in each grid cell, knowing the font size=
,
> font family, cell margins, frame linewidth etc. But I don't have access t=
o
> the information needed - how many pixels does a Courier Size 10 "n" take =
up?
> 3) I could use EventHandler in a better way. Currently I wrap it around t=
he
> whole Grid, but if I could wrap it around a cell, that would work for me.=
No
> syntax that I have tried works - should I try using GridBox, or is there =
an
> obvious better idea?
>
> Nobody got any ideas at all? What kind of language is this, where you can=


't
> even select a column in a table?
>
> Cheers,
>
> Paul.
>
> -----Original Message-----
> From: Paul Ellsmore [mailto:paul.ellsm...@nanion.co.uk]
> Sent: 01 April 2009 11:55
> Subject: selecting a column in a grid
>
> Hi,
>
> I have a tricky problem with a graphical user interface. I have a grid of

> data, and I want to be able to MouseClick in the grid to either select a =


row
> or a column. Using GUIKit, this is trivial, but I want to be able to
> distribute my program using PlayerPro, which won't support GUIKit.
>
> Selecting a row is straightforward using EventHandler and
> EventHandlerScaled, since I know how many rows there are and they are all

> one line in height. However, the column widths change according to the da=


ta,
> since I have set ItemSize to Auto. So is there some way of retrieving the
> actual values used in ItemSize, when Auto is used? I have tried
> CurrentValue[ItemSize] in many variations, but it always fails.
>

> I could, of course, look at the data that will be in the grid, and comput=


e
> the widths of each column accordingly, and synthesize the values that

> ItemSize will take. To do that, though, I would need to know what the pix=


el
> width of a particular text string will be, which varies with font family,
> size etc. Is there an easy way to do this? This is essentially what

> Mathematica does when ItemSize is set to Auto, but I have no idea how to =
do
> it myself.
>
> Currently I have EventHandler wrapped around the whole grid. Is it possib=
le
> to wrap it around each individual cell in a grid? I have tried a few idea=


s,
> but they don't seem to work. The documentation suggests that EventHandler

> can be wrapped around any expression, but that doesn't seem to be the cas=
e,
> or at least the wrapped expression doesn't seem to display properly insid=


e
> other constructs, such as Grid, Column etc.
>

> Is there some better approach I could take, rather than using EventHandle=

Paul Ellsmore

unread,
Apr 6, 2009, 5:02:30 AM4/6/09
to
Albert, this is an excellent idea, many thanks. BTW, your "hackish" code is
positively elegant compared to the stuff I write!

Cheers,

Paul.

-----Original Message-----
From: Albert Retey [mailto:aw...@gmx-topmail.de]
Sent: 05 April 2009 11:42
Subject: Re: Can nobody help me? Re: selecting a column in a grid

Hi,

> Currently I have EventHandler wrapped around the whole grid. Is it


possible
> to wrap it around each individual cell in a grid? I have tried a few
ideas,
> but they don't seem to work. The documentation suggests that EventHandler
> can be wrapped around any expression, but that doesn't seem to be the
case,
> or at least the wrapped expression doesn't seem to display properly inside
> other constructs, such as Grid, Column etc.

I think using EventHandler for the content of individual cells will work


much better and it works as documented, see below. The problem is that a
cell in a grid is not something that exists as an individual expression
(Item would actually be, but this indeed doesn't work, it looks like
Grid doesn't recognize the Item as such if it is wrapped with EventHandler).

> Is there some better approach I could take, rather than using
EventHandler?

Would this be close to what you want? Admittedly it is a little hacky,

Paul Ellsmore

unread,
Apr 6, 2009, 5:03:12 AM4/6/09
to
Hi Albert,

Actually, I have looked at this again, and I have a problem. If you use the
following data to populate the grid
myData = {{aasdfpppppppppppp, bbbbbbbbb, c}, {dasdf, "", f},
{gasdf, h, i}}

You will see that the cell can only be selected by clicking in the text, not
in any whitespace, and the empty cell cannot be selected at all. This is the
same problem as I have with another suggested solution, which also looked
promising. You mentioned an issue with Spacing, but I don't see why that
matters. Eventhandler is wrapped around each Pane, so mouseclicked should be
recognized anywhere in each Pane. Possibly your ImageMargin setting is
making the Pane only extend as far as the text, does that sound right? I
will try changing those settings, or using a different construct to Pane,
but any advice would be welcome.

Incidentally, just to show my ignorance, I am confused about #1 and #2. I
think #1 means that Pane is applied to each element in the data list at
level 2, but I don't understand what #2[[2]] means, could you explain?

Cheers,

Paul.

-----Original Message-----
From: Albert Retey [mailto:aw...@gmx-topmail.de]
Sent: 05 April 2009 11:42

Subject: Re: Can nobody help me? Re: selecting a column in a grid

Hi,

> Currently I have EventHandler wrapped around the whole grid. Is it


possible
> to wrap it around each individual cell in a grid? I have tried a few
ideas,
> but they don't seem to work. The documentation suggests that EventHandler
> can be wrapped around any expression, but that doesn't seem to be the
case,
> or at least the wrapped expression doesn't seem to display properly inside
> other constructs, such as Grid, Column etc.

I think using EventHandler for the content of individual cells will work


much better and it works as documented, see below. The problem is that a
cell in a grid is not something that exists as an individual expression
(Item would actually be, but this indeed doesn't work, it looks like
Grid doesn't recognize the Item as such if it is wrapped with EventHandler).

> Is there some better approach I could take, rather than using
EventHandler?

Would this be close to what you want? Admittedly it is a little hacky,

Sjoerd C. de Vries

unread,
Apr 6, 2009, 5:04:16 AM4/6/09
to
Paul,

I wouldn't have thought my little program was that difficult to understand.

If you'd follow the code closely you'd see that it generates a table of
event handlers. Each event handler is wrapped around a piece of styled data.


I've also wrapped a DynamicModule around every table entry, which causes the
variable pos to be localized. If you examine the start of the module you can
see that it is initializes pos with the value {i,j}, i.e. the values of the
indices which are use to build up the table.

Therefore, each event handler in each table cell has its own value of pos
and this is the reason it knows its own position in the table.

To address your other questions:

myData = {{aasdfpppppppppppp, bbbbbbbbb, c}, {dasdf, "", f}, {gasdf,

h, i}};
Dynamic[clickpos]
longest =
Select[#,
Function[{x},
Composition [StringLength, ToString][x] ==
Max[Composition [StringLength, ToString] /@ #]],
1] & /@ (myData\[Transpose]);
Grid[
Table[
DynamicModule[{col = White, pos = {i, j}},
EventHandler[
Graphics[
{
Text[longest[[j, 1]] // Invisible],
Text[myData[[i, j]]]
},
Background -> Dynamic[col],
ImageSize -> {Automatic, 14}


],
{"MouseDown" :> (clickpos = pos; col = Red),

"MouseUp" :> (col = White)}
]
], {i, Length[myData]}, {j, Length[myData[[1]]]}


], Frame -> All,
BaseStyle -> {Editable -> False, Selectable -> False}
]

Cheers -- Sjoerd

> -----Original Message-----
> From: Paul Ellsmore [mailto:paul.e...@nanion.co.uk]
> Sent: 05 April 2009 16:44
> To: 'Sjoerd C. de Vries'
> Cc: math...@smc.vnet.net
> Subject: RE: Re: Can nobody help me? Re: selecting a column
> in a grid
>

> Thanks Sjoerd,
>
> Unfortunately, this approach has a problem for me, and I have to admit
> I
> don't know why it works at all!
>
> The following example shows my problem (I think I have adapted your
> code to
> use a user-defined list of data properly):

> myData = {{aasdfpppppppppppp, bbbbbbbbb, c}, {dasdf, "", f},

> {gasdf, h, i}};


> Dynamic[clickpos]
> Grid[Table[DynamicModule[{col = Black, pos = {i, j}},
> EventHandler[Style[myData[[i, j]], FontColor -> Dynamic[col]],
> {"MouseDown" :> (clickpos = pos; col = Red),
> "MouseUp" :> (col = Black)}]], {i, 3}, {j, 3}],
> Frame -> All,
> BaseStyle -> {Editable -> False, Selectable -> False}]
>
> In the grid that results, the cell selection only works if the mouse is

> clicked inside the text in the cell, not in any whitespace, and the
> empty


> cell cannot be selected at all. This is a problem for me. But how does
> it
> work anyway? Eventhandler seems to be wrapped around the cell contents,
> rather than the cell itself, but why is there a dynamic value of {i,j}
> associated with the cell? I assume that it is something to do with the
> fact
> that pos is defined within Dynamic, but how does the code know what
> value of
> {i,j} is associated with each block of displayed text? Is this some
> normal
> behaviour of Table that I was not aware of, and where would I look to
> find
> more information about this behaviour? More to the point, is there a
> way of
> forcing each CELL to take the value of {i,j}, because this would solve
> my
> problem instantly?
>
> Incidentally, if you double-click in the empty cell, the whole table
> goes
> blue - why is that?
>
> Many thanks, but I still cannot believe that such a simple task is
> proving
> to be so complicated.
>

> Cheers,
>
> Paul.


>
> -----Original Message-----
> From: Sjoerd C. de Vries [mailto:sjoerd.c...@gmail.com]

> Sent: 05 April 2009 11:40
> To: math...@smc.vnet.net
> Subject: Re: Can nobody help me? Re: selecting a column in a
> grid
>

> Hi Paul,
>
> Cool down ;-) Try this for inspiration:
>
> Dynamic[clickpos]
> Grid[
> Table[
> DynamicModule[
> {col=Black, pos = {i, j}},
> EventHandler[
> Style[RandomInteger[{0, 1000000}], FontColor -> Dynamic[col]],
> {"MouseDown" :> (clickpos = pos; col = Red),
> "MouseUp" :> (col = Black)}
> ]
> ], {i, 5}, {j, 5}]
> ]
>
> Cheers -- Sjoerd
>
> On Apr 4, 3:12 am, "Paul Ellsmore" <paul.ellsm...@nanion.co.uk> wrote:

> > The key point in this problem is that the columns are not equal

> widths, a=


> nd
> > in fact are variable width, depending on the particular data

> displayed. S=


> o I
> > set ItemSize to automatic, so that each column width is defined by

> the da=


> ta.
> > The trouble is that MousePosition gives me coordinates that are a
> linear
> > function of the position in the grid, but the columns are not
> linearly
> > spaced in the Grid, so how do I know which column the mouse is in?
> >
> > I need one of three things, all three of which are beyond my skills:
> >
> > 1) I could get the actual values that ItemSize is set to when

> Automatic i=


> s
> > used. CurrentValue[ItemSize] doesn't work. Anyone got an alternative?
> > 2) I could calculate what values ItemSize will be set to by looking

> at th=


> e
> > type and number of characters in each grid cell, knowing the font

> size=


> ,
> > font family, cell margins, frame linewidth etc. But I don't have

> access t=


> o
> > the information needed - how many pixels does a Courier Size 10 "n"

> take =


> up?
> > 3) I could use EventHandler in a better way. Currently I wrap it

> around t=


> he
> > whole Grid, but if I could wrap it around a cell, that would work for

> me.=


> No
> > syntax that I have tried works - should I try using GridBox, or is

> there =


> an
> > obvious better idea?
> >
> > Nobody got any ideas at all? What kind of language is this, where you

> can=


> 't
> > even select a column in a table?
> >
> > Cheers,
> >
> > Paul.
> >
> > -----Original Message-----
> > From: Paul Ellsmore [mailto:paul.ellsm...@nanion.co.uk]
> > Sent: 01 April 2009 11:55
> > Subject: selecting a column in a grid
> >
> > Hi,
> >
> > I have a tricky problem with a graphical user interface. I have a
> grid of
> > data, and I want to be able to MouseClick in the grid to either

> select a =


> row
> > or a column. Using GUIKit, this is trivial, but I want to be able to
> > distribute my program using PlayerPro, which won't support GUIKit.
> >
> > Selecting a row is straightforward using EventHandler and
> > EventHandlerScaled, since I know how many rows there are and they are
> all
> > one line in height. However, the column widths change according to

> the da=


> ta,
> > since I have set ItemSize to Auto. So is there some way of retrieving
> the
> > actual values used in ItemSize, when Auto is used? I have tried
> > CurrentValue[ItemSize] in many variations, but it always fails.
> >
> > I could, of course, look at the data that will be in the grid, and

> comput=


> e
> > the widths of each column accordingly, and synthesize the values that
> > ItemSize will take. To do that, though, I would need to know what the

> pix=


> el
> > width of a particular text string will be, which varies with font
> family,
> > size etc. Is there an easy way to do this? This is essentially what
> > Mathematica does when ItemSize is set to Auto, but I have no idea how

> to =


> do
> > it myself.
> >
> > Currently I have EventHandler wrapped around the whole grid. Is it

> possib=


> le
> > to wrap it around each individual cell in a grid? I have tried a few

> idea=


> s,
> > but they don't seem to work. The documentation suggests that
> EventHandler
> > can be wrapped around any expression, but that doesn't seem to be the

> cas=


> e,
> > or at least the wrapped expression doesn't seem to display properly

> insid=


> e
> > other constructs, such as Grid, Column etc.
> >
> > Is there some better approach I could take, rather than using

> EventHandle=

0 new messages