BookmarkSubscribeRSS Feed
Choose Language Hide Translation Bar
Highlighted
DRemd
New Contributor

Issue with selecting individual window

So I'm trying to make a program that will open up some graphs in separate windows and have a save button that will  allow you to make changes to said graph and then save it. The saving functionality works except when you open a second window, clicking the button in the first window will save the graph in the second one. Is there a way to keep one button pointing to the window that it was created in?

0 Kudos
1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Issue with selecting individual window

I assume that you are getting your pointers to the different windows reset when you are openning a new window.  Here is a piece of code that illustrates one way of getting around that.  Check out the messages in the log when each of the "Push Me" buttons are clicked on

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/big class.jmp" );

For( i = 1, i <= 2, i++,
	Eval(
		Substitute(
				Expr(
					__nw__ = New Window( "The Window " || Char( i ),
						__dis__ = Distribution( Continuous Distribution( Column( :height ) ) ),
						Button Box( "Push Me", Show( __i__ ) )
					)
				),
			Expr( __nw__ ), Parse( "nw" || Char( i ) ),
			Expr( __dis__ ), Parse( "dis" || Char( i ) ),
			Expr( __i__ ), "Button " || Char( i )
		)
	)
);
Jim
0 Kudos
1 REPLY 1
txnelson
Super User

Re: Issue with selecting individual window

I assume that you are getting your pointers to the different windows reset when you are openning a new window.  Here is a piece of code that illustrates one way of getting around that.  Check out the messages in the log when each of the "Push Me" buttons are clicked on

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/big class.jmp" );

For( i = 1, i <= 2, i++,
	Eval(
		Substitute(
				Expr(
					__nw__ = New Window( "The Window " || Char( i ),
						__dis__ = Distribution( Continuous Distribution( Column( :height ) ) ),
						Button Box( "Push Me", Show( __i__ ) )
					)
				),
			Expr( __nw__ ), Parse( "nw" || Char( i ) ),
			Expr( __dis__ ), Parse( "dis" || Char( i ) ),
			Expr( __i__ ), "Button " || Char( i )
		)
	)
);
Jim
0 Kudos