Title: RE: [MI-L] Dialog box variables not populating

Dave,

This is the typical mistake when working with dialogs and reading values in a handler.

The values on the controls are not written to the variables assigned to the controls until the dialog has been dismissed.

And the dialog has not been dismissed when you are within a handle of the same dialog.

To read values from a "running" dialog, you should use the ReadControlValue() function:

SUB Mission0EllipseOKButtonCalling

        Print "Ok button pressed from Ellipse dialog"

        s_EllipseCentreLat = ReadControlValue(  Edit1ID)       
        'where Edit1ID is the ID of the control to read the value from
        Print Time(24) & " " & s_EllipseCentreLat
       
END SUB

HTH,

Peter Horsbøll Møller
GIS Developer, MTM
Geographical Information & IT
 
COWI A/S
Odensevej 95
DK-5260 Odense S.
Denmark
 
Tel     +45 6311 4900
Direct  +45 6311 4908
Mob     +45 5156 1045
Fax     +45 6311 4949
E-mail  [EMAIL PROTECTED]
http://www.cowi.dk/gis

"For enden af regnbuen..." - hvordan kommer man dertil og er det overhovedet muligt?
Læs mere om årets MapInfo konference på www.cowi.dk/mapinfokonference

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of [EMAIL PROTECTED]

Sent: Wednesday, July 26, 2006 8:29 AM
To: MapInfo-L@lists.directionsmag.com
Subject: [MI-L] Dialog box variables not populating

I have a very strange problem:

First I have a global definition:

Global s_EllipseCentreLat AS STRING

I have a menu option which calls a dialog box. The dialog box has this code:

  DIALOG
    POSITION 491, 359
    WIDTH 165 HEIGHT 153
    TITLE "Create Ellipse"

    CONTROL EditText
      POSITION 73, 27
      WIDTH 80 HEIGHT 12
      ID Edit1ID
      Value "0.001"
      INTO s_EllipseCentreLat

    CONTROL OKButton
      POSITION 47, 130
      WIDTH 38 HEIGHT 14
      'ID OK1ID
      TITLE "OK"
      CALLING Mission0EllipseOKButtonCalling

So, it's basically edit test box & an OK button. The handler looks like this:

SUB Mission0EllipseOKButtonCalling

        Print "Ok button pressed from Ellipse dialog"
       
        Print Time(24) & " " & s_EllipseCentreLat
       
END SUB


The really strange thing is that when I run the dialog & press Ok, I get the correct time printed out, with no variable value.

When I run the dialog the second time & press Ok, I get the correct time followed by
0.001 which was the original value! It seems the variable is not populated when the Ok button is pressed, but at some stage after that. If I change the value of the variable I don't see that new value after pressing the Ok button, but instead see it the NEXT time I press the Ok button - it seems to be lagging behind.

Anyone know why this happens? I've never had any trouble like this before and am mystified as to what is causing it.

(MapInfo 8.0 & MapBasic 8.0)

Thanks,

Dave
_______________________________________________
MapInfo-L mailing list
MapInfo-L@lists.directionsmag.com
http://www.directionsmag.com/mailman/listinfo/mapinfo-l



_______________________________________________
MapInfo-L mailing list
MapInfo-L@lists.directionsmag.com
http://www.directionsmag.com/mailman/listinfo/mapinfo-l

Reply via email to