Giles
Not sure what you mean by "dropdown list string" but it needs to be an
ARRAY of string values.
Then the result of the selection needs to go into a variable, as index
into the selected element of the array.
You'd select the value to be stored by accessing the appropriate array
element.
Never tried it but I'm not sure you can set up a dialog of drop-downs
via a FOR loop - I think each needs to be set up individually.
Finally, to do anything with the selection from the
combo/drop-down/pop-up, you need a handler routine (e.g. to do the above
accessing of the array)
E.g.
DIALOG
Title "My Dialog Title"
Control StaticText
Title "Select Route:"
Control PopUpMenu
Title from Variable gaRouteNames
Value 1
Into gnSelRouteID
calling STORE_ROUTE_PROC
Control StaticText
Title "Select Stop:"
Control PopUpMenu
Title from Variable gaStopNames
Value 1
Into gnSelStopID
calling STORE_STOP_PROC
...
Control OKButton
Control CancelButton
Where gaRouteNames and gaStopNames are global arrays of string,
gnSelRouteID, gnSelStopID are global integers
And the called procs would have code like
----------------------
lcSelectedRoute = gaRouteNames( gnSelRouteID)
Insert into <tablename> ( RouteName ) values ( lcSelectedRoute) ' or
gaRouteNames( gnSelRouteID)
Or
Update <tablename> set RouteName = lcSelectedRoute
----------------------
I haven't bothered putting in the X/Y positions of the above controls -
leave that up to you. Without it, MB will find its own positions -
usually one above the next.
HTH
Terry McDonnell
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Giles
Sent: 13 January 2006 20:46
To: Terry McDonnell
Subject: [MI-L] Drop-down boxes to populate tables
Hello there,
I am an experienced MapInfo user and have just purchased MapBasic. I
need to come up with an easy way of creating custom proformas with drop
down boxes to poulate tables in the field on tablets. I have been
looking at the 'control popupmenu' function within the 'dialog'
function, does anyone have any ideas? I have tried to do it by looping
x number of times and adding a new drop down box for eah loop:
i.e.
X = number of columns
Y = dropdown list string
ddist = the distance down from the top of the dialog box of each drop
down box
dialog
title "Please fill in DATA fields"
Ddist=ddist+10
'then the loop
For x = 1 to x
control popupmenu
ID x
title from variable Y
Position 100, ddist
next x
This doesn't seem to work am I barking up the wrong tree completely? Is
there a simple way of building data input boxes for tables?
Any help would be greatly appreciated
Giles
_______________________________________________
MapInfo-L mailing list
[email protected]
http://www.directionsmag.com/mailman/listinfo/mapinfo-l