Skip to main content
added 34 characters in body
Source Link
Sjoerd C. de Vries
  • 66.2k
  • 15
  • 189
  • 327

Consider the following code:

info = {};
CreatePalette[
  CreatePalette[
   Dynamic[
    Grid[Transpose[info], Dividers -> All, ItemSize -> Full]],
   WindowSize -> {150, 150},
   WindowMargins -> {{0, Automatic}, {Automatic, 0}},
   WindowElements -> {"HorizontalScrollBar"},
   WindowTitle -> "SecondPalette"];
  
  mydata = {100, 200, 300};
  Column[{TextCell[Row[{"My data is: ", mydata}]],
    Button["Add data", AppendTo[info, mydata]]}],
  
  WindowSize -> {150, 150},
  WindowTitle -> "First Palette"];

Mathematica graphics


When you execute this code, you see two palettes. The rightmost palette (named "FirstPalette", controls entry of data into the leftmost palette (named "SecondPalette").

Notice when you click the "Add data" button, data is dynamically updated in the SecondPalette.

When the size of data inside SecondPalette becomes larger than the size of the palette window (press Add data 6 times in a row), the HorizontalScrollBar does not activate like I was hoping it would.

Question A: Is there a way to get the scrollbar to activate when using a data-entry process like the one illustrated in this toy example? (Ii.Ee., I need the interaction between palettes to activate the scrollbar when the data becomes too large to hold inside a window.)

Question B: Is there a way to force a window to display a scrollbar even if the window's content is smaller than the size of the window? (I know this sounds odd, but if I can't get a solution to question A, I thought maybe there would be a way to always have the scrollbar displayed?)

Thanks for reading. Todd

Consider the following code:

info = {};
CreatePalette[
  CreatePalette[
   Dynamic[
    Grid[Transpose[info], Dividers -> All, ItemSize -> Full]],
   WindowSize -> {150, 150},
   WindowMargins -> {{0, Automatic}, {Automatic, 0}},
   WindowElements -> {"HorizontalScrollBar"},
   WindowTitle -> "SecondPalette"];
  
  mydata = {100, 200, 300};
  Column[{TextCell[Row[{"My data is: ", mydata}]],
    Button["Add data", AppendTo[info, mydata]]}],
  
  WindowSize -> {150, 150},
  WindowTitle -> "First Palette"];

When you execute this code, you see two palettes. The rightmost palette (named "FirstPalette", controls entry of data into the leftmost palette (named "SecondPalette").

Notice when you click the "Add data" button, data is dynamically updated in the SecondPalette.

When the size of data inside SecondPalette becomes larger than the size of the palette window (press Add data 6 times in a row), the HorizontalScrollBar does not activate like I was hoping it would.

Question A: Is there a way to get the scrollbar to activate when using a data-entry process like the one illustrated in this toy example? (I.E., I need the interaction between palettes to activate the scrollbar when the data becomes too large to hold inside a window.)

Question B: Is there a way to force a window to display a scrollbar even if the window's content is smaller than the size of the window? (I know this sounds odd, but if I can't get a solution to question A, I thought maybe there would be a way to always have the scrollbar displayed?)

Thanks for reading. Todd

Consider the following code:

info = {};
CreatePalette[
  CreatePalette[
   Dynamic[
    Grid[Transpose[info], Dividers -> All, ItemSize -> Full]],
   WindowSize -> {150, 150},
   WindowMargins -> {{0, Automatic}, {Automatic, 0}},
   WindowElements -> {"HorizontalScrollBar"},
   WindowTitle -> "SecondPalette"];
  
  mydata = {100, 200, 300};
  Column[{TextCell[Row[{"My data is: ", mydata}]],
    Button["Add data", AppendTo[info, mydata]]}],
  
  WindowSize -> {150, 150},
  WindowTitle -> "First Palette"];

Mathematica graphics


When you execute this code, you see two palettes. The rightmost palette (named "FirstPalette", controls entry of data into the leftmost palette (named "SecondPalette").

Notice when you click the "Add data" button, data is dynamically updated in the SecondPalette.

When the size of data inside SecondPalette becomes larger than the size of the palette window (press Add data 6 times in a row), the HorizontalScrollBar does not activate like I was hoping it would.

Question A: Is there a way to get the scrollbar to activate when using a data-entry process like the one illustrated in this toy example? (i.e., I need the interaction between palettes to activate the scrollbar when the data becomes too large to hold inside a window.)

Question B: Is there a way to force a window to display a scrollbar even if the window's content is smaller than the size of the window? (I know this sounds odd, but if I can't get a solution to question A, I thought maybe there would be a way to always have the scrollbar displayed?)

Source Link
Todd Allen
  • 2.1k
  • 5
  • 29
  • 32

Interactions between windows & dynamically updating scrollbars

Consider the following code:

info = {};
CreatePalette[
  CreatePalette[
   Dynamic[
    Grid[Transpose[info], Dividers -> All, ItemSize -> Full]],
   WindowSize -> {150, 150},
   WindowMargins -> {{0, Automatic}, {Automatic, 0}},
   WindowElements -> {"HorizontalScrollBar"},
   WindowTitle -> "SecondPalette"];
  
  mydata = {100, 200, 300};
  Column[{TextCell[Row[{"My data is: ", mydata}]],
    Button["Add data", AppendTo[info, mydata]]}],
  
  WindowSize -> {150, 150},
  WindowTitle -> "First Palette"];

When you execute this code, you see two palettes. The rightmost palette (named "FirstPalette", controls entry of data into the leftmost palette (named "SecondPalette").

Notice when you click the "Add data" button, data is dynamically updated in the SecondPalette.

When the size of data inside SecondPalette becomes larger than the size of the palette window (press Add data 6 times in a row), the HorizontalScrollBar does not activate like I was hoping it would.

Question A: Is there a way to get the scrollbar to activate when using a data-entry process like the one illustrated in this toy example? (I.E., I need the interaction between palettes to activate the scrollbar when the data becomes too large to hold inside a window.)

Question B: Is there a way to force a window to display a scrollbar even if the window's content is smaller than the size of the window? (I know this sounds odd, but if I can't get a solution to question A, I thought maybe there would be a way to always have the scrollbar displayed?)

Thanks for reading. Todd