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
>
- References:
- Buttons and Overwriting a Cell
- From: Gregory Lypny <gregory.lypny@videotron.ca>
- Buttons and Overwriting a Cell