This MapBasic tool allows you to generate a complete standard application for data in a MapInfo table:

  • create a new object by digitization and save it into your table
  • editing an object
  • deleting an object

It generates a file with global variables, a file for the definitions of the functions, and a file for the functions themselves.

The code includes menu definition, button pad definition, access to a ini file, initialization of default values etc.


Order | Bestellung

'------------------------------
'Type Definitions
'------------------------------
type BlattschnittType
  obj                             As	object
  Text                            As 	string
  RW_OL                           As 	Float
  HW_OL                           As 	Float
  RW_UR                           As 	Float
  HW_UR                           As 	Float
  FK_Name                         As 	string
End Type 'BlattschnittType

Global gtBlattschnitt as BlattschnittType

The definitions of global variables (example)

'------------------------------
'Globals
'------------------------------
Global gsAppDescription As String
Global gsAppFilename    As String
Global gsAppPath        As String

Global giLicence        As Integer
Global gsCopyright      As String
Global gsDataPath, gsSystemPath, gsLogPath, gsCosmeticLayer as string
Global gsIniFileName    as string
Global gsHelpFileName   as string
Global gsMenuTitle      as string
Global gsToolbarTitle   as string
Global glDebug		  as Logical
Global giLogFile	  as Integer
Global giMapperWinID as integer
Global gsCurrentTable as string
Global gPen as Pen, gSymbol as Symbol, gBrush as Brush, gFont as Font

The definitions of the subroutines (example)

'------------------------------
'Declarations
'------------------------------
Declare Sub main
Declare sub GenerateHydras_for_importButtonPad
Declare sub GenerateHydras_for_importMenu
Declare sub dlgHydras_for_importUebersicht
Declare sub dlgHydras_for_importAbout
Declare sub CreateHydras_for_importObjectHandler
Declare sub Hydras_for_importEndHandler
Declare sub Hydras_for_importHelpHandler
Declare sub Hydras_for_importStartDigitizingHandler
Declare sub Hydras_for_importEndDigitizingHandler
Declare sub Hydras_for_importPlotHandler
Declare sub WinFocusChangedHandler
Declare sub WinChangedHandler
Declare sub SelChangedHandler

Order

'---------------------------------------------
Sub Main
'---------------------------------------------
  OnError Goto STANDARD_ERROR_HANDLING
  dim tName as string
  dim lOK, lCancel as logical
  gsAppDescription = "Brücken_bundesstraße-Verwaltung"
  gsCopyright   = "gis-news.de,  " + Year(CurDate())
  gsAppPath        = ApplicationDirectory$()
  gsSystemPath     = ApplicationDirectory$() + "system\"
  gsDataPath       = ApplicationDirectory$() + "data\"
  gsLogPath        = ApplicationDirectory$() + "log\"
  gsReportPath        = ApplicationDirectory$() + "report\"
  gsIniFileName    = gsAppPath & "Brücken_bundesstraße" & ".ini"
  gsHelpFileName   = gsAppPath & "Brücken_bundesstraße" & ".hlp"
  gsMenuTitle      = "Brücken_bundesstraße-Verwaltung"
  gsToolbarTitle   = "Brücken_bundesstraße"

  if Not DirectoryExists(gsSystemPath) then
     lOK = CreateNewDirectoryOK(gsSystemPath)
  end if
  if Not DirectoryExists(gsReportPath) then
     lOK = CreateNewDirectoryOK(gsReportPath)
  end if
  if Not DirectoryExists(gsLogPath) then
     lOK = CreateNewDirectoryOK(gsLogPath)
  end if
  if Not DirectoryExists(gsDataPath) then
     lOK = CreateNewDirectoryOK(gsDataPath)
    end if

  gPen       = MakePen(1, 4, BLACK)
  gBrush     = MakeBrush(1, BLUE, -1)
  gSymbol    = MakeFontSymbol(44,32768,10,"MapInfo Cartographic",0,0)
  gFont      = MakeFont("Arial", 1, 6,BLACK,-1)
  
  call SetMapInfoMainTitle(gsAppDescription)
  print chr$(12) + gsAppDescription & " " & VERSIONSNR
  
  call GenerateBrücken_bundesstraßeButtonPad
  call GenerateBrücken_bundesstraßeMenu
  glDebug = GetIniLogical(gsIniFileName, "Parameter", "Debug", FALSE)
  call SetIniLogical(gsIniFileName, "Parameter", "Debug", glDebug)
  giLogFile = 7
  if glDebug then
     Open File gsLogPath + Brücken_bundesstraße + ".log" For OUTPUT Access WRITE As #giLogFile CharSet "WindowsLatin1"
     Print #giLogFile,gsAppDescription & " " & VERSIONSNR + ", " + str$(curdate())
  end if
  
  
  '---------------------------
  ' Datenstruktur vorbelegen
  '---------------------------
  Metadata Table sTabName SetKey  "\Anfangsnetzknoten" To gtBridge_BStreet.Anfangsnetzknoten
  Metadata Table sTabName SetKey  "\Endnetzknoten" To gtBridge_BStreet.Endnetzknoten
  Metadata Table sTabName SetKey  "\VonStation" To gtBridge_BStreet.VonStation
  Metadata Table sTabName SetKey  "\BisStation" To gtBridge_BStreet.BisStation
...

Example for genereated menu

'---------------------------------------------
Sub GenerateBrücken_bundesstraßeMenu
'---------------------------------------------
  OnError Goto STANDARD_ERROR_HANDLING

  Create Menu "Maßstab" As
                 "1:250"      ID M_250 Calling ScaleMenuHandler,
                "1:500"      ID M_500 Calling ScaleMenuHandler,
                    "1:1000"     ID M_1000 Calling ScaleMenuHandler,
                    "1:2000"     ID M_2000 Calling ScaleMenuHandler,
                    "1:2500"     ID M_2500 Calling ScaleMenuHandler,
                    "1:5000"     ID M_5000 Calling ScaleMenuHandler,
                    "1:10000"     ID M_10000 Calling ScaleMenuHandler,
                    "1:20000"     ID M_20000 Calling ScaleMenuHandler,
                "(-",
                    "Gesamt"     ID M_GESAMT Calling ScaleMenuHandler
  Create Menu gsMenuTitle As
                "Datenerfassung..." HelpMsg "Buttonpad für Datenerfassung anzeigen" Calling Brücken_bundesstraßeStartDigitizingHandler,
                "Datenpflege..." HelpMsg "Datenpflege" Calling dlgBrücken_bundesstraßeUebersicht,
                "(-",
                "Hilfe ..."        HelpMsg "Online-Hilfe zum Produkt" Calling Brücken_bundesstraßeHelpHandler,
                "(-",
                "Maßstab" As "Maßstab",
                "Report" HelpMsg "Reporterzeugung" Calling ReportBrücken_bundesstraßeHandler,
                "(-",
                "Über ..." HelpMsg "Information zum Produkt" Calling dlgBrücken_bundesstraßeAbout,
                "(-",
                "Ende" HelpMsg "Beendet die Anwendung" Calling Brücken_bundesstraßeEndHandler
  Alter Menu Bar Add gsMenuTitle
  exit sub
  STANDARD_ERROR_HANDLING:
  note error$()
  print error$()
end sub

Schreiben Sie einen Kommentar

Ihre E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahren Sie mehr darüber, wie Ihre Kommentardaten verarbeitet werden .