Example: Using the Select Dialog Window Tab

This example shows how to use the Select Dialog Window tab to transfer selections between windows.


We will create two drawings, both of which show objects from the same table.   We will then create two different selections in the two drawings and will show how to transfer those selections to the table.   The example will also show how edits in one drawing, such as adding points, are immediately shown in the other drawing as well since both draw their contents from the same table.

Create a Drawing

We begin by creating a new drawing, which we will call Drawing  A.   




To do so we right-click into the Project pane and choose New Drawing from the context menu.  That launches the New Drawing dialog.




We click Create Drawing.




That creates a table, named Drawing Table, and a drawing named Drawing which uses geometry in that table from the field Geom.


In the usual Windows way, Slow double-click onto the drawing to begin changing its name.




We change the default Name to Drawing  A and then press Enter to commit the change..  




Create a Second Drawing using the Same Table : Copy and Paste

There are two ways to create a second drawing that uses the same Geom field in the same table as Drawing  A:



We will illustrate both methods.   First, the copy and paste method:




Click on the Drawing  A component in the Project pane and then click on the Copy icon in the toolbar, or press Ctrl-C for copy.



Click on the Paste icon in the toolbar or press Ctrl-v for paste.  That creates a copy of the drawing that is automatically named Drawing A 2.   We will change that name.



In the usual Windows way, Slow double-click onto the resulting Drawing  A 2 component to open the name for editing.  Change the name to Drawing  B and then press Enter or click anywhere else to close the edit.




We now have two drawings that both use the same Geom field in the same table for their objects.

Create a Second Drawing using the Same Table : Using SQL

We can also use SQL to create a second drawing showing objects from the same table used by Drawing  A.   In casual use we would almost always prefer the copy and paste method but knowing how to do the same thing in SQL is useful for when we want to automate such things.   This also shows how Manifold can automatically write queries for us, a very cool and useful capability.


We begin by choosing View - New Command Window - SQL to open a command window for queries.   




In the Project pane we copy the Drawing  A




and then in the command pane of the command window we paste.   




To paste we either simply press Ctrl-v for paste or we right-click into the command pane and choose Paste from the context menu.




The command window will automatically generate the SQL CREATE query that would create that drawing from the table called Drawing Table.




To create a new drawing that also takes its objects from that same table we can simply edit the query to create a drawing using whatever name we want and then run the query.   We will change the query so that it creates a drawing called Drawing  B, that is, changing the query text to:



  PROPERTY 'FieldGeom' 'Geom',

  PROPERTY 'Table' '[Drawing Table]'



When we run that query by pressing the ! button or by choosing View - Run, a new drawing appears in the Project pane called Drawing  B.   




Close the command window by pressing the X in the upper right corner.

Create Points

In the Project pane, double-click on the Drawing  A drawing to open it.



Alt-click onto the title tab of the drawing to undock the window and then resize the window to a convenient size.




Click the Create Point tool to begin creating points.




As we click on each location where we would like to create a point, a blue square preview symbol appears.   When we have clicked all the points we want to create, we right-click.




In the resulting dialog we choose Save Changes.




That saves the changes to create points in our drawing.




In the main toolbar we switch back to Default mode so we can use the cursor to select points later on in this example.

Open the Select Dialog

We now open and undock Drawing  B and we position it conveniently next to Drawing  A, close enough to allow making screen shots that will fit into this documentation.  




We zoom to fit in the Drawing  B window so that the points we created in the Drawing  A window are also visible in Drawing  B.  Both of the drawings show objects from the same table. When we create a point in Drawing  A that creates an object in the table and thus a point that will also be shown by Drawing  B.


We also open the table, called Drawing Table, undock the window and then resize it and arrange the table conveniently in view of the other windows.




With the focus on the table we then choose Edit - Select to open the Select dialog. We click on the Window tab in the dialog.  We arrange all of the open items conveniently near each other so all will fit into screen shots we will make for this documentation.

Make Selections

The Window tab of the Select dialog has entries for both Drawing  A and Drawing  B.  It has those entries because both of those drawings take their objects from Drawing Table.  Selections in either of those drawings can be transferred to the table.




We now use Ctrl-click and drag to draw a selection box that selects five points in Drawing  A.   




We then use Ctrl-click and drag to draw a selection box that selects five other points in Drawing  B.   




Selections are a property of individual windows so that there can be two different selections in the two different drawings even though those drawings show the same objects from the same table.

Preview Selections

Now that we have made selections in the A drawing and the B drawing, we can preview those selections in the Window tab of the Select dialog.




In the Select dialog we click on the Drawing  A row.  This row is for the selection, if any, in that drawing.   When we click on the row the five objects in the table that correspond to the five selected points in the drawing become highlighted in blue preview color.   This shows us the records which would be affected in the table if we transferred the selection from the drawing to the table.




If now in the Select dialog we click on the Drawing  B row the blue preview color in the table will highlight records for the points that are selected in the B drawing.   

Change Selections

We will demonstrate how the Window tab choices in the Select dialog will dynamically and automatically update to reflect any changes made in selections.




We will change the selection in one of the drawings and see what happens.   In the A drawing we use Alt-Ctrl-click and drag to draw a deselection box that encompasses two of the selected points.   




That will deselect those points.




Back in the Select dialog we click on the row for Drawing  A and see that the new preview in blue color in the table now only previews three records.   The two points that are no longer part of the selection in the A drawing are no longer previewed in blue. tech_tina_sm.png


Tech tip:  When we change a selection in a drawing, if we currently have that drawing chosen in the Window tab of a Select dialog, the preview will not be updated to show the changed selection on the fly.   To refresh the preview we need to make a change in the Select dialog such as switching to a different tab and back to the Window tab, or to click on a different drawing in any rows shown in the Window tab or otherwise to toggle the display in some way. In this example the refresh happened because the preview was showing the B drawing's selection at the time we modified the selection in A, so when we switched the preview to A that naturally showed the changed selection in A in the preview.

Transferring a Selection from a Drawing to the Table

Selections are a property of specific windows.  The selection we make in one window does not automatically change any selections made in any other windows.  This allows us to make different selections in different windows.    Transferring a previewed selection from a drawing to the drawing's table is fast and easy.  




We can transfer the selection from a drawing to the table with a single click.   To have the selection in the table be the same as what is previewed, we press the Replace Selection button in the Select pane.   That will take whatever is being previewed and make that the selection in the table, replacing any previous selection that was in the table.




Pressing the Replace Selection button transfers the selection from Drawing  A into the current selection in the table as well.   The preview shows a color that is a blend between red selection color and blue preview color because the previewed records are now also selected in the table.




Combining Selections

One reason selections are a property of individual windows is that having different selections in different windows allows us to combine those selections in Boolean operations, to replace, add to, intersect with, invert with  and subtract from an existing selection in a table.  That opens the door to immense selection power.


We use the Select dialog to combine selections from other windows into the selection that is in the table.   For example, suppose we click on the row for Drawing  B.    The selected points in B are previewed in the table in blue color.




In the pull-down menu for the command button we choose Add to Selection.   The pull-down menu shows the different choices that we can make to combine selections:



By choosing Add to Selection we can add the points that are selected in the B drawing to those already selected in the table.




After choosing the new setting for the command button, we press the Add to Selection button.




The result in the table is that the table's selection now has added those points that were also selected in the B drawing.  The records newly-added to the selection are seen in a color that is a blend between red selection color and the blue preview color which still shows the preview from the choice of the B drawing in the Window tab of the Select dialog.




If we close the Select dialog we can see the table without any preview color to see that the selection in the table now consists of both the records in the selection in the A drawing as well as the records in the selection in the B drawing.


Deleting Points and Dynamic Updating of Drawings

Although this example is about using the Select dialog, we can also use it to illustrate how drawings take their content from tables.  




Suppose we Delete the selected records in the table, either by pressing the Delete key on the keyboard or by choosing Edit - Delete from the main menu.  When we delete those selected records the points in the drawings associated with them also are deleted.




Suppose we now click on the title bar for Drawing  A to move the focus to that drawing and once more we click on the Create Point tool.




We can click multiple times now into Drawing  A to create points.  As we did before when creating points, we could right-click after the last point and In the resulting dialog choose Save Changes, or we could use the keyboard shortcut of pressing Ctrl-Enter to commit the creation of those new points.




When we do so we see that the new points appear in the A drawing, in the table and also in the B drawing which also shows the same table.   


Once again, we see that drawings take their content from tables.  Creating a point in a drawing is just a different user interface way of creating a record in the source table, in this case records that have a geom defining a point.   Any other drawings which use that same table and which use that same geom field will show the same points.



Example tables - In this topic we use tables adapted from the ubiquitous nwind example database.  To keep the illustrations as small as possible to fit into this documentation we will often take a moment to hide the mfd_id field and to hide other fields in the table window that are not being used or are not central to the example.  We also frequently show dialogs overlapping the table windows.  There is no requirement to overlap a table window with a dialog for that table window but doing so allows us to fit more dialogs and tables into a smaller illustration.


Transition from pre-Radian products -  The Select dialog provides within a single dialog the functionality of the Selection Toolbar, Saved Selections pane and Selection Modes in pre-Radian versions of Manifold GIS.


See Also



Select Dialog


Example: Using the Select Dialog Template Tab -  A sequence of actions using Select dialog templates.


Example: Using the Select Dialog Saved Tab - How to save selections and then use them later.


Example: Multiple Windows with Multiple Select Dialogs - Open multiple windows for the same table and open a Select dialog for each. This shows how multiple Select dialogs providing multiple selections and multiple previews for the same table can be opened and used at the same time.   


Example: Construct JSON String using Select and Transform - Use the Select and Transform dialogs to manually construct a JSON string using values from other fields in a table. Shows how we can manipulate text to build desired contents in a field.