Prev: Copying and Pasting from a Grid with Dividers
Next: PlotLegend-> and DateListPlot[]...incompatible or broken?
From: Nate Dudenhoeffer on 5 Jul 2010 21:13 I frequently use buttons in my projects, and almost always use the Mehod->"Queued" option. Is there a way to change the default setting so I don't have to type this every time? It seems like this should be possible using a stylesheet, but I don''t know the syntax. Any help would be appreciated. Nate
From: Simon on 6 Jul 2010 05:03 Hi Nate, You can see the default options using: In[1]:= Options[Button] Out[1]= {Active->True,Alignment->Automatic,Appearance- >Automatic,AutoAction->False,Background->Automatic,BaselinePosition- >Automatic,BaseStyle->GenericButton,DefaultBaseStyle->Button,Enabled- >Automatic,Evaluator->Automatic,FrameMargins->Automatic,ImageMargins- >0,ImageSize->Full,Method->Preemptive} You can set options with: In[2]:= SetOptions[Button,Method->"Queued"] Out[2]= {Active->True,Alignment->Automatic,Appearance- >Automatic,AutoAction->False,Background->Automatic,BaselinePosition- >Automatic,BaseStyle->GenericButton,DefaultBaseStyle->Button,Enabled- >Automatic,Evaluator->Automatic,FrameMargins->Automatic,ImageMargins- >0,ImageSize->Full,Method->Queued} Simon On Jul 6, 11:13 am, Nate Dudenhoeffer <ndudenhoef...(a)gmail.com> wrote: > I frequently use buttons in my projects, and almost always use the > Mehod->"Queued" option. Is there a way to change the default setting so I > don't have to type this every time? It seems like this should be possible > using a stylesheet, but I don''t know the syntax. Any help would be > appreciated. > > Nate
From: Albert Retey on 7 Jul 2010 07:41 Hi, > I frequently use buttons in my projects, and almost always use the > Mehod->"Queued" option. Is there a way to change the default setting so I > don't have to type this every time? It seems like this should be possible > using a stylesheet, but I don''t know the syntax. Any help would be > appreciated. in principle it would be possible to set Options for Button globally, like this: SetOptions[Button,Method->"Queued"] but since Button might be used at many places you might break things outside of your package if you do so. I'd probably rather define a myButton as follows and use that in your projects, then you'd be sure to not break other code... SetAttributes[myButton,HoldRest]; Options[myButton]=Replace[Options[Button],_[Method,_]:>(Method->"Queued"),{1}] myButton[label_,code_,opts:OptionsPattern[]]:=With[{ newopts=Sequence@@Flatten[{opts,Options[myButton]}] }, Button[label,code,newopts] ] hth, albert
From: David Reiss on 7 Jul 2010 07:42
On Jul 6, 5:03 am, Simon <simonjty...(a)gmail.com> wrote: > Hi Nate, > > You can see the default options using: > In[1]:= Options[Button] > Out[1]= {Active->True,Alignment->Automatic,Appearance- > > >Automatic,AutoAction->False,Background->Automatic,BaselinePosition- > >Automatic,BaseStyle->GenericButton,DefaultBaseStyle->Button,Enabled- > >Automatic,Evaluator->Automatic,FrameMargins->Automatic,ImageMargins- > >0,ImageSize->Full,Method->Preemptive} > > You can set options with: > In[2]:= SetOptions[Button,Method->"Queued"] > Out[2]= {Active->True,Alignment->Automatic,Appearance- > > >Automatic,AutoAction->False,Background->Automatic,BaselinePosition- > >Automatic,BaseStyle->GenericButton,DefaultBaseStyle->Button,Enabled- > >Automatic,Evaluator->Automatic,FrameMargins->Automatic,ImageMargins- > >0,ImageSize->Full,Method->Queued} > Although this would be the way to do this, I would strongly recommend against it since considerable breakage of other things can occur. The simple reason is that any other button that appears in any other user interface (including the ones that come with mathematica itself such as the preferences UI) would then end up using Method->"Queued". It is generally best to explicitly set the Method option for Button or any other similar user interface widgets.... --David > Simon > > On Jul 6, 11:13 am, Nate Dudenhoeffer <ndudenhoef...(a)gmail.com> wrote: > > > > > I frequently use buttons in my projects, and almost always use the > > Mehod->"Queued" option. Is there a way to change the default setting= so I > > don't have to type this every time? It seems like this should be pos= sible > > using a stylesheet, but I don''t know the syntax. Any help would be > > appreciated. > > > Nate |