Scott,
The functionality you want requires the use of the
readcontrolvalue function. Below is a bit of code that should solve
your problem. Hope this helps.
John Hollingsworth
The Buxton Company
[EMAIL PROTECTED]
Code included below
'************************************************************
include "mapbasic.def"
declare sub main
declare sub DialogSub
global gLayers(),gWindows() as string
global gWinID as integer
'********************************************************
sub main
dim I_MAPWINDOW,LayNum as integer
dim i,j as smallint
'place all of the mapper windows into an integer array
j = 1
for i = 1 to numwindows()
if windowinfo(i,WIN_INFO_TYPE) = WIN_MAPPER then
redim gWindows(j)
gWindows(i) = windowinfo(i,WIN_INFO_NAME)
j = j + 1
end if
next
'dialog
DIALOG
Control Statictext id 1 Position 10,10 Title "Please Select Mapwindow"
Control Statictext id 2 Position 10,25 Title "To Find Layer"
Control Popupmenu id 3 Position 10,40 Title From Variable gWindows Width
100 Into I_Mapwindow calling DialogSub
Control Popupmenu id 4 Position 10,60 Title From Variable gLayers Width
100 Into LayNum
Control Okbutton
Control Cancelbutton
print gLayers(LayNum)
'example shading code
'shade window gWinID gLayers(LayNum) . . .
end sub
'********************************************************
sub DialogSub
dim i,j,WinNum as smallint
'read the element number selected from the array
WinNum = readcontrolvalue(3)
'get the window identifier of the chosen window
for i = 1 to numwindows()
if windowinfo(i,WIN_INFO_NAME) = gWindows(WinNum) then
gWinID = windowinfo(i,WIN_INFO_WINDOWID)
end if
next
'place all of the eligible layers into a global string array
j = 1
for i = 1 to mapperinfo(gWinID,MAPPER_INFO_LAYERS)
if layerinfo(gWinID,i,LAYER_INFO_TYPE) = LAYER_INFO_TYPE_NORMAL then
redim gLayers(j)
gLayers(j) = layerinfo(gWinID,i,LAYER_INFO_NAME)
j = j + 1
end if
next
'alter the second pulldown menu with the layer names
alter control 4 title from variable gLayers active
end sub
-----Original Message-----
From: Snashall, Scott [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 13, 1999 6:06 PM
To: '[EMAIL PROTECTED]'
Subject: MI finding the layer number of a table in mapinfo
Hello all,
I am trying to find the specific layer number of a table within a
mapwindow.
I am trying to write an application in which a user is prompted with a
menu
which allows him to pick a mapwindow from various mapwindows that are
open.
after he has selected the mapwindow(from the popumenu(scroll_down) I
would
like the user to pick a layer on which to create a theme by prompting
him
with a scroll down menu of all the layers that are open.
below is the code I have used to get the information on the mapper
window
FOR I = 1 TO NUMWINDOWS()
WINDOWS(I) = WINDOWINFO(I,WIN_INFO_NAME)
next
DIALOG
CONTROL STATICTEXT POSITION 10,10 TITLE "PLEASE SELECT MAPWINDOW"
CONTROL STATICTEXT POSITION 10,25 TITLE "TO FIND LAYER"
CONTROL POPUPMENU POSITION 10,40 TITLE FROM VARIABLE WINDOWS WIDTH 100
INTO
I_MAPWINDOW
CONTROL OKBUTTON
CONTROL CANCELBUTTON
I would like to do something similar for the layer information
but I
am having problems using the various commands
mapperinfo() and layerinfo()
Any help in coming up with a solution would be appreciated being
rather new at mapbasic and programming in general this is driving me
batty
thanks
----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]
----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]