cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
miguello
Level VI

How to restrict\prohibit box resizing? [updated]

I have a window that has some Graph Builder, Filter and other elements. When I use the Filter, my Legend on Graph Builder can change size when some categories are excluded. Then the whole Graph Builder box would change size, breaking the design.

Question: How do I put the Graph Builder in some box and set a fixed size so no matter how it resizes inside that box, outside does not move?

Here is an example:

dt = New Table( "TestTable",
	Add Rows( 2 ),
	New Column( "x", Numeric, "Continuous", Format( "Best", 6 ), Set Values( [2, 4] ) ),
	New Column( "y", Numeric, "Continuous", Format( "Best", 6 ), Set Values( [3, 5] ) ),
	New Column( "Cat", Character, "Nominal", Set Values( {"short", "a very long category"} ) )
);

HBox = H List Box(
	dt << Graph Builder(
		Size( 390, 368 ),
		Show Control Panel( 0 ),
		Variables( X( :x ), Y( :y ), Overlay( :Cat ) ),
		Elements( Points( X, Y, Legend( 5 ) ) )
	), 

	filter = dt << Data Filter(
		Mode( Show( 1 ), Include( 1 ) ),
		Add Filter(
			columns( :Cat, ),
			Display( :Cat, "Check Box Display" ), 
						
		)
	)
);

NW = New Window( "Example", <<show window( 1 ), HBox );

It creates H List with Graph Builder on the left and Data Filter on the right. If I only select "short" category in filter - Graph Builder box changes size shifting everything else.

I don't want that. How should I organize my Display Boxes so that anything to the right of a box that changes size does not shift?

 

2 REPLIES 2
Jasean
Staff

Re: How to restrict\prohibit box resizing? [updated]

Spacer Boxes are very handy for controlling space in a window.  Try this:

dt = New Table( "TestTable",
Add Rows( 2 ),
New Column( "x", Numeric, "Continuous", Format( "Best", 6 ), Set Values( [2, 4] ) ),
New Column( "y", Numeric, "Continuous", Format( "Best", 6 ), Set Values( [3, 5] ) ),
New Column( "Cat", Character, "Nominal", Set Values( {"short", "a very long category"} ) )
);

HBox = H List Box( V List Box( Spacer Box(size(560, 0)), dt << Graph Builder( Size( 390, 368 ), Show Control Panel( 0 ), Variables( X( :x ), Y( :y ), Overlay( :Cat ) ), Elements( Points( X, Y, Legend( 5 ) ) ) ) ), filter = dt << Data Filter( Mode( Show( 1 ), Include( 1 ) ), Add Filter( columns( :Cat, ), Display( :Cat, "Check Box Display" ), ) ) ); NW = New Window( "Example", <<show window( 1 ), HBox );

It creates a spacer box just above the graph builder.  If the graph builder box goes below the width of the spacer box, the Data Filter will not move.  However, if you interactively make the graph builder box bigger, you will again see the behavior you are currently experiencing.

To better see what the spacer box is doing for you, try replacing it with this one:

Spacer Box(size(560, 10), Color("yellow"))
ih
Super User (Alumni) ih
Super User (Alumni)

Re: How to restrict\prohibit box resizing? [updated]

Adding a scroll box should do the trick, the scroll bars take up a little space but it should never change size regardless of the graph.

Names default to here(1);

dt = New Table( "TestTable",
	Add Rows( 2 ),
	New Column( "x", Numeric, "Continuous", Format( "Best", 6 ), Set Values( [2, 4] ) ),
	New Column( "y", Numeric, "Continuous", Format( "Best", 6 ), Set Values( [3, 5] ) ),
	New Column( "Cat", Character, "Nominal", Set Values( {"short", "a very long category"} ) )
);

HBox = H List Box(
	Scroll Box( size(600,450), // Added this element line
		dt << Graph Builder(
			Size( 390, 368 ),
			Show Control Panel( 0 ),
			Variables( X( :x ), Y( :y ), Overlay( :Cat ) ),
			Elements( Points( X, Y, Legend( 5 ) ) )
		)
	),

	filter = dt << Data Filter(
		Mode( Show( 1 ), Include( 1 ) ),
		Add Filter(
			columns( :Cat, ),
			Display( :Cat, "Check Box Display" ), 
						
		)
	)
);

NW = New Window( "Example", <<show window( 1 ), HBox );