Re: Buttons and Overwriting a Cell
- To: mathgroup at smc.vnet.net
- Subject: [mg105567] Re: [mg105545] Buttons and Overwriting a Cell
- From: Gregory Lypny <gregory.lypny at videotron.ca>
- Date: Wed, 9 Dec 2009 05:43:48 -0500 (EST)
- References: <200912081143.GAA29184@smc.vnet.net> <4B1E7379.8050400@wolfram.com>
Thanks, Adam. Will do.
Gregory
On Tue, Dec 8, 2009, at 10:40 AM, Adam Griffith wrote:
> 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