MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Buttons and Overwriting a Cell

  • To: mathgroup at smc.vnet.net
  • Subject: [mg105557] Re: [mg105545] Buttons and Overwriting a Cell
  • From: Adam Griffith <adamg at wolfram.com>
  • Date: Wed, 9 Dec 2009 05:41:54 -0500 (EST)
  • References: <200912081143.GAA29184@smc.vnet.net>

Hi Gregory,

In ref/Button, a 'roughly similar' example can be found:

Button["Delete Me", SelectionMove[ButtonNotebook[], All, ButtonCell];
 NotebookDelete[ButtonNotebook[]]]

So for example, I would have my button  programmatically find an 
appropriate location in a notebook to paste the table if one does not 
already exist. Otherwise, overwrite the cell with tag "RandomTable" 
using NotebookFind[] and NotebookWrite[].

I would also take a look at tutorial/ManipulatingNotebooksFromTheKernel 
which I found to be most useful for a project similar to yours.

-Adam

Gregory Lypny wrote:
> Hello everyone,
>
> I'm trying to create a button that will produce a 2x2 table of random integers, which I think I've succeeded in doing with the following.
>
> Button["Hit Me", Print[TableForm[{{RandomInteger[{2,12}], RandomInteger[{2,12}]},
> {RandomInteger[{2,12}], RandomInteger[{2,12}]}},
> TableHeadings->{Automatic,Automatic}]]]
>
> I'd also like it to overwrite any existing table that it has produced on a previous click.  I know I need to set CellAutoOverwrite to True, but I'm not sure how to work that into my Button statement.  Any suggestions would be much appreciated.
>
> Regards,
>
> 	Gregory
>   


  • Prev by Date: Re: JLink broken on Snow Leopard
  • Next by Date: Re: Washington DC Area Mathematica Special Interest Group
  • Previous by thread: Buttons and Overwriting a Cell
  • Next by thread: Re: Buttons and Overwriting a Cell