MapBasic - Dialog box - Dropdown menu with column names

567 views
Skip to first unread message

Jamie

unread,
Jun 29, 2015, 9:29:29 AM6/29/15
to mapi...@googlegroups.com
I've seen other peoples tool that have the following in a dialog box

1st drop down to select map window

2nd drop down menu to choose table from those already open

3rd drop down to select columns from the above table

can any one give any guidance or show me some example code to achieve this.

Thomas Bacon

unread,
Jun 29, 2015, 9:59:15 AM6/29/15
to mapi...@googlegroups.com

Hi Jamie,

 

Here’s an example I made for someone a while ago which shows how to update a ‘Columns’ dropdown when the ‘Tables’ dropdown selection is changed. Hopefully it will give you enough info to work out how to do the same with the map window etc…

 

The code is well commented but if you have any questions then do ask.

 

Tom Bacon

GIS Engineer, Mouchel

T 01444 472380 │ E thomas...@mouchel.com W www.mouchel.com

Our values: innovation │ excellence │ integrity │ responsibility

--
--
You received this message because you are subscribed to the
Google Groups "MapInfo-L" group.To post a message to this group, send
email to mapi...@googlegroups.com
To unsubscribe from this group, go to:
http://groups.google.com/group/mapinfo-l/subscribe?hl=en
For more options, information and links to MapInfo resources (searching
archives, feature requests, to visit our Wiki, visit the Welcome page at
http://groups.google.com/group/mapinfo-l?hl=en

---
You received this message because you are subscribed to the Google Groups "MapInfo-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mapinfo-l+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



            

Mouchel Limited (Mouchel) is registered in England and Wales with registered number 01686040 at Export House, Cawsey Way, Woking, Surrey, UK, GU21 6QX.  The information in this e-mail is confidential and may be legally privileged. It is intended solely for the addressee. Access to this email by anyone else is unauthorised. Any views or opinions expressed in this e-mail may be solely those of the author and are not necessarily those of Mouchel. No contracts may be concluded on behalf of Mouchel by means of email communications. Mouchel reserves the right to monitor and intercept emails sent and received on our network. 

PopUpMenu.mb

Jamie

unread,
Jun 29, 2015, 11:50:31 AM6/29/15
to mapi...@googlegroups.com
Thanks Tom just what i was after.

a follow up question i am in the process of making a tool to jump to each row of a table in turn, create a screenshot and save the image with the name found in the column the user chose.

how can i extract the field contents?

i'm looking for something similar to this i guess - SvNam = Zones.selectedColumn (in my case the field name is SPS_Code and is COL4 though this could change based on what the user selects)

Where Zones is my current row selection
and selected column should be the one chosen earlier by the user using your dialog box you posted.

Jamie

unread,
Jun 29, 2015, 12:04:24 PM6/29/15
to mapi...@googlegroups.com
i might also be able to get this to work if can find a way to get the COL number of the one the user selected.

Jamie

unread,
Jun 29, 2015, 12:26:31 PM6/29/15
to mapi...@googlegroups.com
ok i've go the column number using

COL_REF = ColumnInfo(selectedTable, selectedColumn, COL_INFO_NUM)

The problem i've got now is that my command is being run as a string so it sees "Zones.COL4" as a string rather than dynamically filling in the fields contents. so my output file is just "Zones.COL4.jpg" rather than "Zones.x.jpg"

i know this should work i'm sure i'm just doing something wrong. if i just use Zones.COL4 in the command below it works.

SvWin = "Save Window " & nMID & " As " + chr$(34) & File_Dir + "Zones." + ("COL" & COL_REF) + ".JPG" + chr$(34) + " Type ""JPEG""" + " Resolution 150"
Note SvWin
Run Command SvWin
Capture.PNG

Peter Horsbøll Møller

unread,
Jun 29, 2015, 3:03:20 PM6/29/15
to mapi...@googlegroups.com

The Alias variable to the rescue!

 

Dim aCol As Alias

aCol = "Zones.COL" & COL_REF

SvWin = "Save Window " & nMID & " As "

      + chr$(34) & File_Dir + aCol + ".JPG" + chr$(34)

      + " Type ""JPEG""" + " Resolution 150"

 

Hope this helps

 

Peter Horsbøll Møller

GIS/LI Presales Specialist

Location Intelligence | MapInfo

 

M: +45 29 133 769

peter....@pb.com | @phorsbollmoller

pitneybowes.com/dk | mapinfo.com

--

--
You received this message because you are subscribed to the
Google Groups "MapInfo-L" group.To post a message to this group, send
email to


To unsubscribe from this group, go to:
http://groups.google.com/group/mapinfo-l/subscribe?hl=en
For more options, information and links to MapInfo resources (searching
archives, feature requests, to visit our Wiki, visit the Welcome page at
http://groups.google.com/group/mapinfo-l?hl=en

---
You received this message because you are subscribed to the Google Groups "MapInfo-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mapinfo-l+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jamie

unread,
Jun 30, 2015, 8:07:38 AM6/30/15
to mapi...@googlegroups.com
Perfect again Peter. I had come across Alias's before but had never really known when to use them. Think i'll need to go back to the user guide to get some more info on this.

any top examples on when these would be useful? could be an interesting article for the 'Monthly' MapInfo Journal

Peter Horsbøll Møller

unread,
Jun 30, 2015, 3:43:32 PM6/30/15
to mapi...@googlegroups.com

Jamie,

 

I did cover the Alias variable in my most recent post on LinkedIn:

https://www.linkedin.com/pulse/4-typical-questions-when-writing-mapbasic-peter-horsbøll-møller

 

Peter Horsbøll Møller

GIS/LI Presales Specialist

Location Intelligence | MapInfo

 

M: +45 29 133 769

peter....@pb.com | @phorsbollmoller

pitneybowes.com/dk | mapinfo.com

 

From: mapi...@googlegroups.com [mailto:mapi...@googlegroups.com] On Behalf Of Jamie
Sent: 30. juni 2015 14:08
To: mapi...@googlegroups.com
Subject: Re: [MI-L] MapBasic - Dialog box - Dropdown menu with column names

 

Perfect again Peter. I had come across Alias's before but had never really known when to use them. Think i'll need to go back to the user guide to get some more info on this.



any top examples on when these would be useful? could be an interesting article for the 'Monthly' MapInfo Journal

--

--
You received this message because you are subscribed to the
Google Groups "MapInfo-L" group.To post a message to this group, send
email to


To unsubscribe from this group, go to:
http://groups.google.com/group/mapinfo-l/subscribe?hl=en
For more options, information and links to MapInfo resources (searching
archives, feature requests, to visit our Wiki, visit the Welcome page at
http://groups.google.com/group/mapinfo-l?hl=en

---
You received this message because you are subscribed to the Google Groups "MapInfo-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mapinfo-l+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages