I'm very new to the MapBasic programming side of things but am trying to get better aquainted with it by building a couple of menu's and toolbars.
What I am trying to do at the moment is build a button which, when clicked, will allow the user to do a boundary select of all the points within a polygon which will immediately launch a dialog box displaying the types of point (church, house, garage etc from the points table column "POI_DESCRIPTION") grouped in a multilistbox.
The user would then be able to select a radio button requesting either a count of the type of points selected from the list box, or a table listing each point with its address, coordinate etc.
Is this possible?
I've got as far as calling the boundary select tool and then browsing a full list by pressing a separate push button but I would like to be able to select points, launch dialog with one click.
here's the simplifed code I have so far:
Include "icons.def"
Include "Mapbasic.def"
Include "menu.def"
declare sub main
declare sub emplan_menu
declare sub poi_button
declare sub POI_dialog
'******************************************
sub main
call emplan_menu
end sub
'******************************************
sub emplan_menu
Create menu "Emergency Planning" as
"Display Toolbar" calling Emplan_toolbar
Alter menu bar add "Emergency Planning"
End sub
'*****************************************
sub emplan_toolbar
create buttonpad "Emergency Planning" as
Togglebutton
HelpMsg "Points of Interest Query \n Run"
Icon 1
Calling M_TOOLS_SEARCH_BOUNDARY
Pushbutton 'I dont really want this button, would rather
Icon 2 'everything could be done using the above button
Calling POI_Dialog
End Sub
'******************************************
sub POI_Dialog
Dim strDisplay(2) as string
strDisplay(1) = "Display Details"
strDisplay(2) = "Count"
Select POI_Catagory from Selection group by POI_Catagory order by POI_Catagory into Selection
browse * from selection
Dialog
Title "Points of Interest"
Control Multilistbox
Control Groupbox
Title "Display:"
Control Radiogroup
Title from variable strDisplay
Control Okbutton
Control Cancelbutton
end sub
*******************************************
I'm pretty sure that I need to be converting the selection into an array variable in order to insert it into the multilistbox but I cant get that working. I've browsed the table to make sure that the code is working.
At the moment my first pushbutton is doing nothing more than selecting the normal boundary select button.
My main aim is to eliminate the need for an 'execute' pushbutton by executing POI_Dialog as soon as the user clicks in the desired polygon.
Any help would be much appreciated.
Matt O'Keeffe
Did you know?
In any one month, Social Care is likely to have 1,669 clients receiving domiciliary care, 618 clients in permanent residential care and 231 clients in permanent nursing care.
*****************************************************
This email is for the intended recipient(s) only.
If you have received this email due to an error in addressing, transmission or for any other reason, please reply to it and let the author know. If you are not the intended recipient, you must not use, disclose, distribute, copy or print it.
This email may be monitored, read, recorded and/or kept by Portsmouth City Council. Email monitoring and blocking software may be used.
*****************************************************
Just a thought.
Greg Driver
System Administrator
Applications Support
ICT
Surrey Police
NOT PROTECTIVELY MARKED
*Internet communications are not secure and therefore Surrey Police does not accept legal responsibility for the contents of this message. This email and any attachments may be confidential. They may contain privileged information and are intended for the named addressee (s) only. They must not be distributed without our consent. If you are not the intended recipient, please notify us immediately and delete the message and any attachments from your computer, do not disclose, distribute, or retain this email or any part of it. Unless expressly stated, opinions in this email are those of the individual sender, and not of Surrey Police. We believe but do not warrant that this e-mail and any attachments are virus free. You must therefore take full responsibility for virus checking. Surrey Police reserves the right to monitor all email communications through their networks.*