Note: Data and script uploaded below...
I have developed the following script that first plots a wide area showing a route taken. A modal window pops up that allows the user to enter a code for a specific location -- in this example a 1 or 2. With this information, the graph will zoom in to that location. All this works fine but it's not exactly what I need. Most importantly, the dialog box disappears once the selection in made and the script ends. Second, I have been trying to get this to work with a ComboBox pulldown menu. I can get the menu itself working but for some reason, I can't seem to get the choice to make a change in the graph.
Here is what I have with the modal text box...
Names Default To Here( 1 );
dt = Data Table( "Test Data" );
gb = Graph Builder(
Graph Spacing( 10 ),
Spacing Borders( 1 ),
Variables( X( :Longitude ), Y( :Latitude ) ),
Elements( Points( X, Y, Legend( 3 ) ) ),
SendToReport(
Dispatch( {}, "Longitude", ScaleBox, {Min( -104 ), Max( -98.47 )} ),
Dispatch( {}, "Latitude", ScaleBox, {Min( 29.21 ), Max( 33.30 )} ),
Dispatch( {}, "Graph Builder", FrameBox,
{Background Map( Images( "Street Map Service", "Mapbox Satellite", "" ) )}
)
)
);
// Build the modal input window
New Window( "Pick a spot",
Modal,
H List Box(
V List Box( Text Box( "Location Number:" ), ),
V List Box( box = Number Edit Box( "Enter location number..." ), )
),
Button Box( "OK",
// Script to run when "OK" is clicked
locNum = box << Get;
Print( "Location Number: " || Char( locNum ) );
),
Button Box( "Cancel",
// Script to run when "Cancel" is clicked
Throw()
)
);
If(
locNum == 1,
minLat = 30.99;
maxLat = 31.06;
minLong = -101.21;
maxLong = -101.11;
run = "1|1";,
locNum == 2,
minLat = 31.34;
maxLat = 31.41;
minLong = -101.81;
maxLong = -101.71;
run = "2|1";
);
gb << Dispatch( {}, "Longitude", ScaleBox, {Min( minLong ), Max( maxLong )} );
gb << Dispatch( {}, "Latitude", ScaleBox, {Min( minLat ), Max( maxLat )} );
The initial map looks like this...

And the zoomed in view looks like this...

So my dilemmas are 1) how do I get the ComboBox to work with this, and 2) how can I prevent the script from completing so the user can continue to select different items from the pulldown menu.
I have a feeling this has something to do with the Set Function command but my multiple attempts at getting this to work have been fruitless.
Any guidance on this would be greatly appreciated.
Thanks.