Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #6760

Re: CDF examples

From Armand Tamzarian <mike.honeychurch@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: CDF examples
Date 2011-11-26 10:11 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jaqe08$nhh$1@smc.vnet.net> (permalink)
References <janpjl$b7q$1@smc.vnet.net>

Show all headers | View raw


On Nov 25, 9:11 pm, Tom De Vries <tidetable...@gmail.com> wrote:
> Hi everyone,
>
> Wolfram has posted some very nice examples of documents in the CDF format=
.
>
> Many of them would be very nice to use for classroom presentations.
>
> In particular the file  "Adopting CDF" has a compelling way of moving
> between parts of the document.
>
> I tried to decipher it,  but with all the graphics used,  it's not
> really easy to get at the parts and try to use them.
>
> As with many things Mathematica ,  I'd like to learn more, but the
> "finished" product is impossible for me to get into and work on.
>
> I wonder if anyone in the forum has looked at this example, and might
> be able to produce a "toy" version that could be experimented with
> more easily.
>
> Obviously Wolfram has put a lot of time and energy into these
> examples, so I'm not trying to "steal" that work.
>
> But those who are using Mathematica at a lower level could really
> benefit from having some of these presentation techniques to help us
> put a "better front" on the work we are trying to do with our
> students.
>
> Tom

Tom I am not sure which specific example you are looking at but in
many/most examples they make extensive use of EventHandler to create
the tabs to switch between displays. EventHandler is also used in the
tab DockedCell in the web analytics CDF. Also things like PaneSelector
get used. If you don't mind reading the box code you can see it all in
a text editor. Not sure how this cut and paste will go but try this
for the docked cell:

I can't paste images so in the code for the banner below:

image#1 is the banner

image#2 is a "slice" type graphic that is only a pixel or 2 wide and
is resized to provide the shading of the selected tab

image#3 is the little arrow pointing down that appears under the
selected tab

banner = Graphics[{
   Inset[image #1, {0, 0}, {Left, Bottom}, {1800, 64}],
   Inset[
    Style["Web Ad Dashboard", FontFamily -> "Georgia", 26,
     White], {60, 21}, {Left, Baseline}],

   EventHandler[{
          Dynamic[
             If[selected === 1,
       { Inset[
         ImageResize[image #2, {100, Scaled[1]},
          Resampling -> "Nearest"], {550, 0}, {Center, Bottom}, {100,
          63}], Inset[image #3, {550, 0}, {Center, Top}, {19, 9}]},
       {}],
            TrackedSymbols :> {selected}],

     MouseAppearance[
      Inset[ Style["Summary", FontFamily -> "Arial", 14,
        White], {550, 21}, {Center, Baseline}], "LinkHand"]},
      {"MouseClicked" :> (SelectionMove[ SelectedNotebook[], Before,
        Notebook]; selected = 1), PassEventsDown -> Automatic,
     PassEventsUp -> True}],

   EventHandler[{
          Dynamic[
             If[selected === 2,
       { Inset[
         ImageResize[image #2, {100, Scaled[1]},
          Resampling -> "Nearest"], {675, 0}, {Center, Bottom}, {100,
          63}], Inset[image #3, {675, 0}, {Center, Top}, {19, 9}]},
       {}],
            TrackedSymbols :> {selected}],

     MouseAppearance[
      Inset[ Style["Comparison", FontFamily -> "Arial", 14,
        White], {675, 21}, {Center, Baseline}], "LinkHand"]},
      {"MouseClicked" :> (SelectionMove[ SelectedNotebook[], Before,
        Notebook]; selected = 2), PassEventsDown -> Automatic,
     PassEventsUp -> True}],

   EventHandler[{
          Dynamic[
             If[selected === 3,
       { Inset[
         ImageResize[image #2, {100, Scaled[1]},
          Resampling -> "Nearest"], {805, 0}, {Center, Bottom}, {100,
          63}], Inset[image #3, {805, 0}, {Center, Top}, {19, 9}]},
       {}],
            TrackedSymbols :> {selected}],

     MouseAppearance[
      Inset[ Style["Analysis", FontFamily -> "Arial", 14,
        White], {805, 21}, {Center, Baseline}], "LinkHand"]},
      {"MouseClicked" :> (SelectionMove[ SelectedNotebook[], Before,
        Notebook]; selected = 3), PassEventsDown -> Automatic,
     PassEventsUp -> True}]},
  BaseStyle -> Directive[FontFamily -> "Arial", 14, White],
  ImageSize -> {1800, 92},
  PlotRange -> {{0, 1800}, {-29, 63}}]

So you'll see 3 blocks of EventHandler code corresponding to the 3
"tabs". So once you put actual images in that code and evaluated it,
now do this:

SetOptions[EvaluationNotebook[], DockedCells ->
{First[ToBoxes[TextCell[banner, CellMargins -> 0]]]}]

when you click on a "tab" you change the appearance by activating the
ImageResize function which "spreads" the shading across the tab, and
you change the value of the variable "selected" and its value controls
what is displayed in the notebook, and you move back to the top of the
notebook (the MouseClicked code).

To remove the banner do this:

SetOptions[EvaluationNotebook[], DockedCells -> {}]

some non Wolfram examples of interfaces:

http://ibnhconsulting.blogspot.com/

Mike

Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

CDF examples Tom De Vries <tidetabletom@gmail.com> - 2011-11-25 10:11 +0000
  Re: CDF examples Armand Tamzarian <mike.honeychurch@gmail.com> - 2011-11-26 10:11 +0000

csiph-web