Dynamic web world Maps drived from VFP

Published on by Yousfi Benameur


this code uses the web (https://maps-for-free.com/) who gives a free world map nearly as google maps provides.
its -a zoommable map (zoom in +zoom out on any point of the world)
    -a movable map by mouse down (zoom and pan).
    -execute some actions as (Export map to local image,info,capitals,countries,volcanoes,locations).
    -it can paste some layers on the original map as (water,admin,Streets,country,crops,Grass,tundra,sand,swamp,ice,tiles,forest)
 originally all theses controls are drawn and react with javascript code.
 i make a vfp toolbar (as top level form) for commanding all these controls making vfp interacting with javascript.
 the form cited:
   - fires an internetexplorer.application (can support all navigations in contrary of a normal form with browser olecontrol)
   -i make it in fullscreen mode and place the form at the desktop bottom.it releases when the form releases (and invisible if form minimized).
    apIE icon is hidden on taskbar by vfp code.
   -all the javascript actions are translated as vfp actions with automation (by OOP as DOM logic).
   -have many capabilities (see tooltips in any fp control).
   -some controls (google map,capture,colors styles,navigation (zoom in ,zoom out,show/hide javascript controls,point to any world country capital,execute from vfp any javascript control...)
   *for 2 commandgroups click to show reclick to hide .
   -this is a demo how to traverse javascript codes from vfp.
 -can build a project an generate a compiled executable.
 *for any non personal use, please read the site policies.
 *(this code rendered on 32 pouces screen)
 [post 248]


Click on code to select [then copy] -click outside to deselect


*1* created on friday 08 of decmember 2017

If !_vfp.StartMode=0
  On Shutdown Quit
Endi

Publi yform
yform=Newobject("yFreeMap")
yform.Show
Read Events
Retu
*
Define Class yFreeMap As Form
  BorderStyle = 0
  Top = 12
  Left = 7
  Height = 44
  Width = 1500
  ShowWindow = 2
  ScrollBars = 1
  ShowTips = .T.
  Caption = ""
  AlwaysOnTop = .T.
  ymem = ""
  Name = "Form1"

  Add Object timer1 As Timer With ;
    Top = 11, ;
    Left = 432, ;
    Height = 23, ;
    Width = 23, ;
    Interval = 2000, ;
    Name = "Timer1"

  Add Object commandgroup1 As CommandGroup With ;
    AutoSize = .T., ;
    ButtonCount = 6, ;
    Anchor = 0, ;
    BackStyle = 0, ;
    Value = 1, ;
    Height = 37, ;
    Left = 1, ;
    Top = 0, ;
    Width = 421, ;
    Name = "Commandgroup1", ;
    Command1.AutoSize = .T., ;
    Command1.Top = 5, ;
    Command1.Left = 5, ;
    Command1.Height = 27, ;
    Command1.Width = 78, ;
    Command1.Caption = "Export Map", ;
    Command1.Name = "Command1", ;
    Command2.AutoSize = .T., ;
    Command2.Top = 5, ;
    Command2.Left = 87, ;
    Command2.Height = 27, ;
    Command2.Width = 38, ;
    Command2.Caption = "Info", ;
    Command2.Name = "Command2", ;
    Command3.AutoSize = .T., ;
    Command3.Top = 5, ;
    Command3.Left = 128, ;
    Command3.Height = 27, ;
    Command3.Width = 64, ;
    Command3.Caption = "Capitals", ;
    Command3.Name = "Command3", ;
    Command4.AutoSize = .T., ;
    Command4.Top = 5, ;
    Command4.Left = 194, ;
    Command4.Height = 27, ;
    Command4.Width = 72, ;
    Command4.Caption = "Countries", ;
    Command4.Name = "Command4", ;
    Command5.AutoSize = .T., ;
    Command5.Top = 5, ;
    Command5.Left = 267, ;
    Command5.Height = 27, ;
    Command5.Width = 75, ;
    Command5.Caption = "Volvanoes", ;
    Command5.Name = "Command5", ;
    Command6.AutoSize = .T., ;
    Command6.Top = 5, ;
    Command6.Left = 344, ;
    Command6.Height = 27, ;
    Command6.Width = 72, ;
    Command6.Caption = "Locations", ;
    Command6.Name = "Command6"

  Add Object shape1 As Shape With ;
    Top = 12, ;
    Left = 434, ;
    Height = 15, ;
    Width = 15, ;
    Anchor = 0, ;
    Curvature = 99, ;
    MousePointer = 15, ;
    ToolTipText = "Toggle web buttons", ;
    BackColor = Rgb(0,255,0), ;
    Name = "Shape1"

  Add Object combo1 As ComboBox With ;
    Anchor = 768, ;
    Height = 18, ;
    Left = 1364, ;
    ToolTipText = "Another solution", ;
    Top = 1, ;
    Width = 88, ;
    Name = "Combo1"

  Add Object ycombo As ycapitals With ;
    Anchor = 768, ;
    Height = 18, ;
    Left = 1364, ;
    ToolTipText = "Capitals (vfp)", ;
    Top = 5+18+1, ;
    Width = 88, ;
    Name = "yCombo"

  Add Object label1 As Label With ;
    AutoSize = .T., ;
    FontBold = .T., ;
    FontSize = 16, ;
    Anchor = 768, ;
    BackStyle = 0, ;
    Caption = "X", ;
    Height = 27, ;
    Left = 1475, ;
    MousePointer = 15, ;
    Top = 0, ;
    Width = 16, ;
    ForeColor = Rgb(255,0,0), ;
    Name = "Label1"

  Add Object label3 As Label With ;
    AutoSize = .F., ;
    FontBold = .T., ;
    FontSize = 16, ;
    Anchor = 768, ;
    BackStyle = 0, ;
    Caption = "-", ;
    Height = 15, ;
    Left = 1460, ;
    MousePointer = 15, ;
    Top = 0, ;
    Width = 10, ;
    ForeColor = Rgb(255,0,0), ;
    Name = "Label3"


  Add Object timer2 As Timer With ;
    Top = 21, ;
    Left = 0, ;
    Height = 23, ;
    Width = 23, ;
    Enabled = .F., ;
    Interval = 1000, ;
    Name = "Timer2"


  Add Object commandgroup2 As CommandGroup With ;
    AutoSize = .T., ;
    ButtonCount = 12, ;
    Anchor = 0, ;
    BackStyle = 0, ;
    Value = 1, ;
    Height = 37, ;
    Left = 425, ;
    SpecialEffect = 0, ;
    Top = 0, ;
    Width = 642, ;
    Name = "Commandgroup2", ;
    Command1.AutoSize = .T., ;
    Command1.Top = 5, ;
    Command1.Left = 5, ;
    Command1.Height = 27, ;
    Command1.Width = 50, ;
    Command1.Caption = "Water", ;
    Command1.BackColor = Rgb(128,255,0), ;
    Command1.Name = "Command1", ;
    Command2.AutoSize = .T., ;
    Command2.Top = 5, ;
    Command2.Left = 58, ;
    Command2.Height = 27, ;
    Command2.Width = 53, ;
    Command2.Caption = "Admin", ;
    Command2.Name = "Command2", ;
    Command3.AutoSize = .T., ;
    Command3.Top = 5, ;
    Command3.Left = 114, ;
    Command3.Height = 27, ;
    Command3.Width = 57, ;
    Command3.Caption = "Streets", ;
    Command3.Name = "Command3", ;
    Command4.AutoSize = .T., ;
    Command4.Top = 5, ;
    Command4.Left = 172, ;
    Command4.Height = 27, ;
    Command4.Width = 60, ;
    Command4.Caption = "Country", ;
    Command4.Name = "Command4", ;
    Command5.AutoSize = .T., ;
    Command5.Top = 5, ;
    Command5.Left = 233, ;
    Command5.Height = 27, ;
    Command5.Width = 45, ;
    Command5.Caption = "Crop", ;
    Command5.Name = "Command5", ;
    Command6.AutoSize = .T., ;
    Command6.Top = 5, ;
    Command6.Left = 279, ;
    Command6.Height = 27, ;
    Command6.Width = 52, ;
    Command6.Caption = "Grass", ;
    Command6.Name = "Command6", ;
    Command7.AutoSize = .T., ;
    Command7.Top = 5, ;
    Command7.Left = 333, ;
    Command7.Height = 27, ;
    Command7.Width = 57, ;
    Command7.Caption = "Tundra", ;
    Command7.Name = "Command7", ;
    Command8.AutoSize = .T., ;
    Command8.Top = 5, ;
    Command8.Left = 390, ;
    Command8.Height = 27, ;
    Command8.Width = 47, ;
    Command8.Caption = "Sand", ;
    Command8.Name = "Command8", ;
    Command9.AutoSize = .T., ;
    Command9.Top = 5, ;
    Command9.Left = 439, ;
    Command9.Height = 27, ;
    Command9.Width = 50, ;
    Command9.Caption = "Swamp", ;
    Command9.Name = "Command9", ;
    Command10.AutoSize = .T., ;
    Command10.Top = 5, ;
    Command10.Left = 502+2, ;
    Command10.Height = 27, ;
    Command10.Width = 34, ;
    Command10.Caption = "Ice", ;
    Command10.Name = "Command10", ;
    Command11.AutoSize = .T., ;
    Command11.Top = 5, ;
    Command11.Left = 538, ;
    Command11.Height = 27, ;
    Command11.Width = 45, ;
    Command11.Caption = "Tiles", ;
    Command11.Name = "Command11", ;
    Command12.AutoSize = .T., ;
    Command12.Top = 5, ;
    Command12.Left = 584, ;
    Command12.Height = 27, ;
    Command12.Width = 53, ;
    Command12.Caption = "Forest", ;
    Command12.Name = "Command12"

  Add Object shape2 As Shape With ;
    Top = 12, ;
    Left = 1153, ;
    Height = 15, ;
    Width = 15, ;
    Anchor = 0, ;
    Curvature = 99, ;
    MousePointer = 15, ;
    ToolTipText = "This backcolor", ;
    BackColor = Rgb(0,0,128), ;
    Name = "Shape2"

  Add Object shape3 As Shape With ;
    Top = 12, ;
    Left = 1172, ;
    Height = 15, ;
    Width = 15, ;
    Anchor = 0, ;
    Curvature = 99, ;
    MousePointer = 15, ;
    ToolTipText = "Capture", ;
    BackColor = Rgb(255,128,64), ;
    Name = "Shape3"

  Add Object shape4 As Shape With ;
    Top = 12, ;
    Left = 1192, ;
    Height = 15, ;
    Width = 15, ;
    Anchor = 0, ;
    Curvature = 99, ;
    MousePointer = 15, ;
    ToolTipText = "Hide/show app tool", ;
    BackColor = Rgb(0,255,255), ;
    Name = "Shape4"

  Add Object shape5 As Shape With ;
    Top = 12, ;
    Left = 1211, ;
    Height = 15, ;
    Width = 15, ;
    Anchor = 0, ;
    Curvature = 99, ;
    MousePointer = 15, ;
    ToolTipText = "App tool colors", ;
    BackColor = Rgb(255,255,0), ;
    Name = "Shape5"

  Add Object label2 As Label With ;
    AutoSize = .T., ;
    FontBold = .T., ;
    FontSize = 20, ;
    BackStyle = 0, ;
    Caption = "?", ;
    Height = 35, ;
    Left = 1358+3, ;
    MousePointer = 15, ;
    Top = 1, ;
    Width = 19, ;
    ForeColor = Rgb(0,255,0), ;
    Name = "Label2"

  Add Object ydummy As CommandButton With ;
    Top = 12, ;
    Left = 1092, ;
    Height = 13, ;
    Width = 25, ;
    Caption = "Command1", ;
    Style = 1, ;
    Name = "ydummy"

  Add Object shape6 As Shape With ;
    Top = 12, ;
    Left = 1229, ;
    Height = 15, ;
    Width = 15, ;
    Anchor = 0, ;
    Curvature = 99, ;
    MousePointer = 15, ;
    ToolTipText = "Hide /show 2 legends", ;
    BackColor = Rgb(128,0,255), ;
    Name = "Shape6"

  Add Object Command1 As CommandButton With ;
    AutoSize = .T., ;
    Top = 6, ;
    Left = 1294, ;
    Height = 32, ;
    Width = 31, ;
    FontBold = .T., ;
    FontSize = 11, ;
    Caption = "-", ;
    MousePointer = 15, ;
    ToolTipText = "zoomIn", ;
    ForeColor = Rgb(255,0,0), ;
    BackColor = Rgb(128,255,0), ;
    Name = "Command1"

  Add Object Command2 As CommandButton With ;
    AutoSize = .T., ;
    Top = 6, ;
    Left = 1325, ;
    Height = 32, ;
    Width = 35, ;
    FontBold = .T., ;
    FontSize = 11, ;
    Caption = "+", ;
    MousePointer = 15, ;
    ToolTipText = "zoom OUT", ;
    ForeColor = Rgb(255,0,0), ;
    BackColor = Rgb(128,255,0), ;
    Name = "Command2"

  Add Object Command3 As CommandButton With ;
    AutoSize = .T., ;
    Top = 7, ;
    Left = 1247, ;
    Height = 32, ;
    Width = 47, ;
    FontBold = .T., ;
    FontSize = 11, ;
    Caption = "BT", ;
    MousePointer = 15, ;
    ToolTipText = "Show/hide navigation btns", ;
    ForeColor = Rgb(255,0,0), ;
    BackColor = Rgb(128,255,0), ;
    Name = "Command3"

  Add Object shape7 As Shape With ;
    Top = 12, ;
    Left = 1131, ;
    Height = 15, ;
    Width = 15, ;
    Curvature = 99, ;
    MousePointer = 15, ;
    ToolTipText = "Google MAP", ;
    BackColor = Rgb(255,0,0), ;
    Name = "Shape7"

  Procedure label3.Click
    apie.Visible=.F.
    Thisform.WindowState=1
    Thisform.timer2.Enabled=.T.
  Endproc


  Procedure timer2.Timer
    If Thisform.WindowState=0
      apie.Visible=.T.
      This.Enabled=.F.
    Endi
  Endproc

  Procedure ydisp
    Lparameters xID
    With apie.Document.getElementById(xID)
      .Style.visibility=Iif(.Style.visibility="hidden","visible","hidden")
      *expand select object (it seems to be a great problem on dom & javascript!)
      .Style.Top="50px"
      .Style.Width="250px"
      .Size=.options.Length
      .Style.Height="350px"

    Endwith
    Thisform.ymem=xID
  Endproc

  Procedure yactions
    Lparameters nButton, nShift, nXCoord, nYCoord
    *--- aevent create an array laEvents
    Aevents( myArray, 0)
    *--- reference the calling object
    loObject = myArray[1]
    Local m.xcaption
    m.xcaption=Alltrim(loObject.Caption)
    _Cliptext="*"+m.xcaption
    m.xcaption=Strtran(m.xcaption,Chr(9),"")   &&2tabs in beginng ??

    Local m.x,m.y
    m.x=apie.Document.getElementsByClassName("layerform")
    N=x.Length

    For Each obj In  m.x
      If  Lower(Allt(obj.innerText))==Lower(Allt(m.xcaption))
        obj.Style.background="rgba(0,255,0,0.8)"
        m.y=obj.getElementsByClassName("layerinput")

        For Each xobj In Y
          xobj.checked=!xobj.checked
          xobj.Click(.T.)
          DoEvents
        Next

      Else
        obj.Style.background="#fff"

      Endi
    Next
  Endproc

  Procedure MouseMove
    Lparameters nButton, nShift, nXCoord, nYCoord
    *to give the focus to the form objects only and fires tootips(ydummy is an invisible commandbutton)
    This.ydummy.SetFocus
  Endproc

  Procedure Resize
    With Thisform
      .commandgroup1.Left=5
      .commandgroup1.Top=5

      .shape1.Left=.commandgroup1.Left+.commandgroup1.Width+10

      .commandgroup2.Left=.shape1.Left+.shape1.Width+10
      .commandgroup2.Top=5
    Endwith
  Endproc

  Procedure Init
    With Thisform
      .TitleBar=0
      .BackColor=Rgb(45,45,45)
      .Top=Sysmetric(2)-.Height
      .Width=Sysmetric(1)
      .Left=1
      .Resize()
      .ydummy.SetFocus
    Endwith

    Publi apie
    apie=Newobject("internetexplorer.application")  &&IE11 or edge emulation
    With apie
      .Navigate("https://maps-for-free.com/")
      .fullscreen=1
      bringWindowToTop(.HWnd)
      =yhideonTaskbar(.HWnd)   &&hide the IE icon on taskbar
      Inke(2)
      .Visible=.T.
    Endwith
  Endproc

  Procedure Load
    Declare Integer BringWindowToTop In user32 Integer HWnd
    Declare Integer ReleaseCapture In WIN32API
    Declare Integer SendMessage In WIN32API Integer, Integer, Integer, Integer
    _Screen.WindowState=1
  Endproc

  Procedure Destroy
    Try
      apie.Quit
    Catch
    Endtry

    Release apie
    Clea Events
  Endproc

  Procedure MouseDown
    Lparameters nButton, nShift, nXCoord, nYCoord
    lnHandle = Thisform.HWnd    &&or getFocus() in activeWindow
    param1 = 274
    param2 = 0xF012
    Thisform.MousePointer=15
    bb=ReleaseCapture()
    bb=SendMessage(lnHandle, param1, param2,0)
    Thisform.MousePointer=0
  Endproc

  Procedure KeyPress
    Lparameters nKeyCode, nShiftAltCtrl
    If nKeyCode=27
      Thisform.Release
    Endi
  Endproc

  Procedure timer1.Timer
    Thisform.shape1.Click()
    This.Enabled=.F.
  Endproc

  Procedure commandgroup1.Init
    With This
      .AutoSize=.T.
      .BackStyle=0
      .SetAll("mousepointer",15,"commandbutton")
      .SetAll("Backcolor",Rgb(200,40,100),"commandbutton")
      .SetAll("fontbold",.T.,"commandbutton")
      .SetAll("autosize",.F.,"commandbutton")
      .SetAll("specialEffect",2,"commandbutton")
    Endwith
  Endproc

  Procedure commandgroup1.Command1.Click
    Local m.xID
    m.xID="exportMap"
    With apie.Document.getElementById(m.xID)
      .Style.visibility=Iif(.Style.visibility="hidden","visible","hidden")
    Endwith
    Thisform.ymem=xID
  Endproc

  Procedure commandgroup1.Command2.Click
    Local m.xID
    m.xID="openModal"

    With apie.Document.getElementById(m.xID)
      .Style.visibility=Iif(.Style.visibility="hidden","visible","hidden")
    Endwith

    Thisform.ymem=xID

    apie.Navigate("https://maps-for-free.com/#openModal")
  Endproc

  Procedure commandgroup1.Command3.Click
    Thisform.ydisp("capitals")
  Endproc

  Procedure commandgroup1.Command4.Click
    Thisform.ydisp("countries")
  Endproc

  Procedure commandgroup1.Command5.Click
    Thisform.ydisp("volcanoes")
  Endproc

  Procedure commandgroup1.Command6.Click
    Thisform.ydisp("locations")
  Endproc

  Procedure shape1.Click
    *hide al buttons actions in commandGroup1
    With apie.Document
      Try
        .getElementById("exportMap").Style.visibility="hidden"
        .getElementById("openModal").Style.visibility="hidden"
        .getElementById("capitals").Style.visibility="hidden"
        .getElementById("countries").Style.visibility="hidden"
        .getElementById("volcanoes").Style.visibility="hidden"
        .getElementById("locations").Style.visibility="hidden"
      Catch
      Endtry

    Endwith
  Endproc

  Procedure combo1.Click
    x=apie.Document.getElementsByClassName("layerform")
    N=x.Length
    For Each obj In  x
      If  Lower(Allt(obj.innerText))==Lower(Allt(This.Value))
        obj.Style.background="rgba(0,255,0,0.8)"
        Y=obj.getElementsByClassName("layerinput")
        For Each xobj In Y
          xobj.checked=!xobj.checked
          xobj.Click(.T.)
          DoEvents
        Next

      Else
        obj.Style.background="#fff"

      Endi
    Next
  Endproc

  Procedure combo1.Init
    With This
      .AddItem("Water")
      .AddItem("Admin")
      .AddItem("Streets")
      .AddItem("Country")
      .AddItem("Crop")
      .AddItem("Grass")
      .AddItem("Forest")
      .AddItem("Tundra")
      .AddItem("Sand")
      .AddItem("Swamp")
      .AddItem("Ice")
      .AddItem("Tiles")
      .ListIndex=1
      .Style=2
    Endwith
  Endproc

  Procedure label1.Click
    Thisform.Release
  Endproc

  Procedure commandgroup2.Init
    Local m.myvar
    TEXT to m.myvar noshow
		Water
		Admin
		Streets
		Country
		Crop
		Grass
		Tundra
		Sand
		Swamp
		Ice
		Tiles
		Forest
    ENDTEXT

    With This
      .AutoSize=.T.
      .BackStyle=0
      .SetAll("mousepointer",15,"commandbutton")
      .SetAll("Backcolor",Rgb(0,190,0),"commandbutton")
      .SetAll("fontbold",.T.,"commandbutton")
      .SetAll("autosize",.T.,"commandbutton")
      .SetAll("specialEffect",2,"commandbutton")

      For i=1 To .ButtonCount
        .Buttons(i).Caption=Allt(Mline(m.myvar,i))
        Bindevent(.Buttons(i),"mousedown",Thisform,"yactions")
      Endfor

    Endwith
  Endproc

  Procedure shape2.Click
    Local m.x
    m.x=Getcolor()
    If m.x=-1
      Return .F.
    Endi

    Thisform.BackColor=m.x
  Endproc

  Procedure shape3.Click
    *snippingtools is a 32 bits application.it dont run on 64 bits .the solution is sysnative as below.
    Try
      Run/N c:\Windows\sysnative\snippingtool.Exe
    Catch
      Messagebox("SbippingTool not installed on windows!",16+4096,'',1300)
    Endtry
  Endproc

  Procedure shape4.Click
    *hide show a div without classname or Id.use collection of objects and parentnode property.
    Local m.x,obj As Object
    m.x =apie.Document.getElementsByClassName("layerform")
    i=0
    For  Each obj In m.x
      i=i+1
      If i=1
        obj.parentnode.parentnode.Style.visibility=Iif(obj.parentnode.parentnode.Style.visibility="hidden","visible","hidden")
      Endi
    Endfor
  Endproc

  Procedure shape5.Click
    Local m.x,m.y As Object
    m.x=apie.Document.getElementsByClassName("layerform")
    N=m.x.Length
    For Each obj In  m.x
      obj.Style.backgroundcolor=Rgb(255*Rand(),255*Rand(),0)   &&colorize the app tool with random colors  (even if its invisible)
      obj.Style.fontWeight="900"
    Next
  Endproc

  Procedure label2.Click
    Local m.myvar
    TEXT to m.myvar pretext 7 noshow
this code uses the Freemap site (https://maps-for-free.com/) who gives a free world map exactly as google maps provides.
its -a zoommable map (zoom in +zoom out on any point of the world)
    -a movable map by mouse down (pan).
    -execute some actions as (Export map to local image,info,capitals,countries,volcanoes,locations).
    -it can paste some layers on the original map as (water,admin,Streets,country,crops,Grass,tundra,sand,swamp,ice,tiles,forest)
    -its alwaysontop.simply click on if taskbar cobers it to bring it at topmost.
 originally all theses controls are drawn and react with javascript code.
 i make a vfp toolbar (as top level form) for commanding all these controls making vfp interacting with javascript.

 the form cited:
   - fires an internetexplorer.application (can support all navigations in contrary of a normal form with browser olecontrol)
    [i tested a top level form who cannot pan the world map !].
   -i make it in fullscreen mode and place the form at the bottom.note the form is movable by mousedown.it releases when the form releases
    (and invisible if form minimized).
    apIE icon is hidden on taskbar by vfp code.
   -all the javascript actions are translated as vfp actions with automation (by OOP as DOM logic).
   -have many capabilities (browse tooltips in any vfp control).
   -some controls (google map,capture,colors styles,navigation (zoom in ,zoom out),show/hide javascript controls,point to any world
   country capital,execute from vfp any javascript control...).
   -this is a demo how to traverse javascript codes from vfp.if it's simple when wrinting editable web page (can place ids to reac any control),but
    its some difficult with a live web page. fortunatly at the rescue,the code source can be read to see [id,classname,tags,styles,...structure].
   -note the site can give for free all data relative to any map (and more for developpers interesting with maps).
    ENDTEXT
    Local oshell
    oshell = Createobject('WScript.Shell')
    oshell.Popup(m.myvar,0, 'Summary help ', 0+32+4096)
    oshell=Null
  Endproc

  Procedure shape6.Click
    Local m.x,obj  As Object
    m.x =apie.Document.images   &&collection
    For Each obj In x
      If obj.src="https://maps-for-free.com/images/legend1.png" Or obj.src="https://maps-for-free.com/images/legend2.png"
        obj.Style.visibility=Iif(obj.Style.visibility="hidden","visible","hidden")
      Endi
    Next
  Endproc

  Procedure Command1.Click
    x=apie.Document.getElementsByClassName("ol-zoom-out")
    For Each obj In x
      obj.focus()
      obj.Click(.T.)
    Next
  Endproc

  Procedure Command2.Click
    x=apie.Document.getElementsByClassName("ol-zoom-in")
    For Each obj In x
      obj.focus()
      obj.Click(.T.)
    Next
  Endproc

  Procedure Command3.Click
    Local m.x

    m.x=apie.Document.getElementsByClassName("ol-zoom-out")
    For Each obj In x
      obj.Style.visibility=Iif(obj.Style.visibility="hidden","visible","hidden")
      obj.parentnode.parentnode.Style.visibility=Iif(obj.parentnode.Style.visibility="hidden","visible","hidden")
    Next

    m.x=apie.Document.getElementsByClassName("ol-zoom-in")
    For Each obj In x
      obj.Style.visibility=Iif(obj.Style.visibility="hidden","visible","hidden")
      obj.parentnode.parentnode.Style.visibility=Iif(obj.parentnode.Style.visibility="hidden","visible","hidden")
    Next

    m.x=apie.Document.getElementsByClassName("infobutton")
    For Each obj In x
      obj.Style.visibility=Iif(obj.Style.visibility="hidden","visible","hidden")
    Next
  Endproc

  Procedure shape7.Click
    Local m.xlieu
    m.xlieu=Inputbox("Type any lieu for google maps",""," El bayadh")
    If Empty(m.xlieu)
      Return .F.
    Endi

    Declare Integer BringWindowToTop In user32 Integer

    Local apie1
    apie1=Newobject("internetexplorer.application")
    With apie1
      Local m.x
      m.x="https://maps.google.com/maps?&z=18&t=k&q=loc:"+Allt(m.xlieu)
      .silent=.T.
      .Navigate(m.x)
      .menubar=0
      .Toolbar=0
      .StatusBar=0
      .Resizable=1
      .Width=800
      .Height=600
      .Top=50
      .Left=(Sysmetric(1)-.Width)/2
      Inke(1)
      bringWindowToTop(.HWnd)
      .Visible=.T.
    Endwith

    *!*	http://maps.google.com/maps?z=12&t=k&q=loc:algeria
    *!*	    z is the zoom level (1-20)
    *!*	    t is the map type ("m" map, "k" satellite, "h" hybrid, "p" terrain, "e" GoogleEarth)
    *!*	    q is the search query, if it is prefixed by loc: then google assumes it is a lat lon separated by a +
  Endproc

Enddefine
*
*-- EndDefine: yfreeMap



Define Class ycapitals As ComboBox
  Height = 22
  Left = 81
  SpecialEffect = 2
  Style = 2
  ToolTipText = "Capitals"
  Top = 36
  Width = 132
  DisplayCount = 20
  Name = "Combo2"

  Procedure Init
    Local m.myvar
    TEXT to m.myvar pretext 7 noshow
		'7.4433, 8.8333, 8'>Abuja
		'54.3705, 24.4764, 8'>Abu Zaby/Abu Dhabi
		'-0.2009, 5.5586, 8'>Accra
		'51.5074, 25.2951, 8'>Ad Dawhah/Doha
		'38.7468, 9.0227, 8'>Adis Abeba/Addis Abeba
		'3.0319, 36.7658, 8'>Alger/Algiers
		'32.5322, 15.5501, 8'>Al Khartum/Khartoum
		'48.0039, 29.3294, 8'>Al Kuwayt/Kuwait
		'50.5879, 26.2149, 8'>Al Manamah/Manama
		'31.2508, 30.0779, 8'>Al Qahirah/Cairo
		'35.9329, 31.9494, 8'>Amman
		'4.8948, 52.3730, 8'>Amsterdam
		'1.5156, 42.5079, 8'>Andorra la Vella
		'32.8533, 39.9293, 8'>Ankara
		'47.5277, -18.9077, 8'>Antananarivo
		'-171.7520, -13.8314, 8'>Apia (on Upolu)
		'46.7179, 24.6347, 8'>Ar Riyad/Riyadh
		'58.3901, 37.9504, 8'>Asgabat/Ashgabat
		'38.9262, 15.3324, 8'>Asmara
		'71.4321, 51.1894, 8'>Astana
		'-57.6219, -25.3051, 8'>Asuncion
		'23.6529, 37.9440, 8'>Athinai/Athens
		'44.3978, 33.3340, 8'>Baghdad
		'172.9850, 1.3260, 8'>Bairiki (on Tarawa)
		'49.8162, 40.3243, 8'>Baki/Baku
		'-7.9865, 12.6530, 8'>Bamako
		'114.9490, 4.9409, 8'>Bandar Seri Begawan
		'18.5623, 4.3659, 8'>Bangui
		'-16.5887, 13.4550, 8'>Banjul
		'-62.7309, 17.3000, 8'>Basseterre (on St. Kitts)
		'116.3880, 39.9062, 8'>Beijing
		'-88.7785, 17.2617, 8'>Belmopan
		'20.4656, 44.8024, 8'>Beograd/Belgrade
		'13.3276, 52.5163, 8'>Berlin
		'7.4457, 46.9482, 8'>Bern
		'35.5134, 33.8872, 8'>Beyrouth/Beirut
		'74.5879, 42.8700, 8'>Bishkek
		'-15.5982, 11.8640, 8'>Bissau
		'-74.0805, 4.6302, 8'>Bogota
		'-47.8978, -15.7921, 8'>Brasilia
		'17.1297, 48.1531, 8'>Bratislava
		'15.2837, -4.2808, 8'>Brazzaville
		'-59.6105, 13.0935, 8'>Bridgetown
		'4.3676, 50.8371, 8'>Bruxelles/Brussels
		'26.1230, 44.4305, 8'>Bucuresti/Bucharest
		'19.0936, 47.4976, 8'>Budapest
		'-58.4096, -34.6654, 8'>Buenos Aires
		'29.3561, -3.3725, 8'>Bujumbura
		'149.0420, -35.3499, 8'>Canberra
		'-66.8983, 10.4961, 8'>Caracas
		'-60.9832, 14.0001, 8'>Castries
		'28.8416, 47.0269, 8'>Chisinau
		'8.7846, 3.7536, 8'>Ciudad de Malabo (on Bioko)
		'-99.1276, 19.4271, 8'>Ciudad de Mexico
		'79.8484, 6.9275, 8'>Colombo
		'-13.6716, 9.5504, 8'>Conakry
		'-17.4519, 14.6867, 8'>Dakar
		'171.3833, 7.1000, 8'>Dalap-Uliga-Darrit (on Majuro)
		'90.4071, 23.7099, 8'>Dhaka
		'125.5810, -8.5707, 8'>Dili
		'36.3135, 33.5193, 8'>Dimashq/Damascus
		'43.1452, 11.5941, 8'>Djibouti
		'35.7382, -6.1749, 8'>Dodoma
		'-6.2573, 53.3416, 8'>Dublin
		'68.7750, 38.5593, 8'>Dushanbe
		'-13.2391, 8.4861, 8'>Freetown
		'25.9087, -24.6541, 8'>Gaborone
		'-58.1548, 6.8046, 8'>Georgetown
		'-90.5249, 14.6180, 8'>Guatemala
		'105.8200, 21.0319, 8'>Ha Noi/Hanoi
		'31.0540, -17.8292, 8'>Harare
		'24.9486, 60.1733, 8'>Helsinki
		'159.9490, -9.4268, 8'>Honiara (on Guadalcanal)
		'73.0605, 33.7182, 8'>Islamabad
		'106.8290, -6.1829, 8'>Jakarta (on Java)
		'69.1368, 34.5309, 8'>Kabol/Kabul
		'32.5748, 0.3228, 8'>Kampala
		'85.3130, 27.7120, 8'>Kathmandu
		'30.0588, -1.9501, 8'>Kigali
		'-76.7973, 18.0157, 8'>Kingston
		'-61.2653, 13.2035, 8'>Kingstown (on St. Vincent)
		'15.2987, -4.3208, 8'>Kinshasa
		'12.5234, 55.7040, 8'>Kobenhavn/Copenhagen
		'100.5210, 13.7308, 8'>Krung Thep/Bangkok
		'101.7080, 3.1502, 8'>Kuala Lumpur
		'30.5021, 50.4482, 8'>Kyiv/Kiev
		'-82.3886, 23.1168, 8'>La Habana/Havana
		'9.4536, 0.3908, 8'>Libreville
		'33.7738, -13.9826, 8'>Lilongwe
		'-77.0454, -12.0824, 8'>Lima
		'-9.1228, 38.7559, 8'>Lisboa/Lisbon
		'14.5148, 46.0574, 8'>Ljubljana
		'1.2278, 6.1266, 8'>Lome
		'-0.1190, 51.5275, 8'>London
		'13.2350, -8.8124, 8'>Luanda
		'28.2824, -15.4088, 8'>Lusaka
		'6.1203, 49.6084, 8'>Luxembourg
		'73.5000, 4.1667, 8'>Maale/Male (on Male)
		'-3.6910, 40.4422, 8'>Madrid
		'-86.2730, 12.1515, 8'>Managua
		'121.0060, 14.6096, 8'>Manila
		'32.5737, -25.9622, 8'>Maputo
		'27.4916, -29.3083, 8'>Maseru
		'58.5881, 23.6065, 8'>Masqat/Muscat
		'31.1437, -26.3187, 8'>Mbabane
		'134.6342, 7.4933, 8'>Melekeok (on Babelthuap)
		'27.5756, 53.8999, 8'>Minsk
		'7.4242, 43.7453, 8'>Monaco-Ville
		'-10.7972, 6.3008, 8'>Monrovia
		'-56.0675, -34.8941, 8'>Montevideo
		'43.2434, -11.7005, 8'>Moroni (on Njazidja)
		'37.6665, 55.7388, 8'>Moskva/Moscow
		'45.3441, 2.0412, 8'>Muqdisho/Mogadishu
		'36.8041, -1.2702, 8'>Nairobi
		'-77.3402, 25.0672, 8'>Nassau (on New Providence)
		'15.0505, 12.1041, 8'>N'djamena
		'77.2168, 28.5687, 8'>New Delhi
		'2.1204, 13.5142, 8'>Niamey
		'33.3690, 35.1710, 8'>Nicosia
		'-15.9784, 18.0841, 8'>Nouakchott
		'-175.2160, -21.1360, 8'>Nuku'alofa (on Tongatapu)
		'10.7123, 59.9379, 8'>Oslo
		'-75.6929, 45.4175, 8'>Ottawa
		'-1.5283, 12.3640, 8'>Ouagadougou
		'158.1850, 6.9177, 8'>Palikir (on Pohnpei)
		'-79.5172, 9.0029, 8'>Panama
		'-55.1703, 5.8261, 8'>Paramaribo
		'2.3490, 48.8521, 8'>Paris
		'104.9130, 11.5647, 8'>Phnum Penh/Phnom Penh
		'19.2641, 42.4459, 8'>Podgorica
		'-72.3431, 18.5430, 8'>Port-au-Prince
		'57.4964, -20.1653, 8'>Port Louis
		'147.1840, -9.4818, 8'>Port Moresby
		'-61.4836, 10.6572, 8'>Port of Spain (on Trinidad)
		'2.6325, 6.4783, 8'>Porto-Novo
		'168.3210, -17.7404, 8'>Port Vila (on Efate)
		'14.4423, 50.0785, 8'>Praha/Prague
		'-23.5212, 14.9233, 8'>Praia (on Sao Tiago)
		'28.2184, -25.7313, 8'>Pretoria
		'96.2089, 19.7361, 8'>Pyinmana
		'125.7570, 39.0285, 8'>P'yongyang
		'-78.5243, -0.2295, 8'>Quito
		'-6.8327, 34.0150, 8'>Rabat
		'-21.8952, 64.1353, 8'>Reykjavik
		'24.0860, 56.9483, 8'>Riga
		'12.4906, 41.8955, 8'>Roma/Rome
		'-61.3943, 15.2987, 8'>Roseau
		'-61.7449, 12.0653, 8'>Saint George's
		'-61.8476, 17.1169, 8'>Saint John's (on Antigua)
		'44.2095, 15.3614, 8'>San'a'/Sanaa
		'-84.0786, 9.9305, 8'>San Jose
		'12.4454, 43.9424, 8'>San Marino
		'-89.2002, 13.7014, 8'>San Salvador
		'-70.6475, -33.4750, 8'>Santiago
		'-69.8993, 18.4893, 8'>Santo Domingo
		'6.7278, 0.3368, 8'>Sao Tome (on Sao Tome)
		'18.4134, 43.8564, 8'>Sarajevo
		'126.9350, 37.5424, 8'>Seoul
		'103.8250, 1.2988, 8'>Singapore
		'21.4467, 42.0069, 8'>Skopje
		'23.3319, 42.7073, 8'>Sofiya/Sofia
		'18.0651, 59.3323, 8'>Stockholm
		'-65.2559, -19.0421, 8'>Sucre
		'178.4310, -18.1426, 8'>Suva (on Viti Levu)
		'121.5070, 25.0351, 8'>T'ai-pei/Taipei
		'24.7603, 59.4465, 8'>Tallinn
		'13.1800, 32.8711, 8'>Tarabulus/Tripoli
		'44.7831, 41.7218, 8'>T'bilisi
		'-87.2031, 14.0991, 8'>Tegucigalpa
		'51.4229, 35.6962, 8'>Tehran
		'89.6673, 27.4426, 8'>Thimphu
		'19.8318, 41.3317, 8'>Tirane/Tirana
		'139.8090, 35.6831, 8'>Tokyo
		'69.2690, 41.3052, 8'>Toshkent/Tashkent
		'10.1660, 36.8188, 8'>Tunis
		'106.9120, 47.9286, 8'>Ulaanbaatar
		'9.5215, 47.1431, 8'>Vaduz
		'179.2167, -8.5167, 8'>Vaiaku (on Fongafale)
		'14.5189, 35.9042, 8'>Valletta
		'102.6140, 17.9628, 8'>Viangchan/Vientiane
		'55.4450, -4.6174, 8'>Victoria (on Mahe)
		'16.3210, 48.2021, 8'>Vienna
		'25.2760, 54.6886, 8'>Vilnius
		'21.0119, 52.2449, 8'>Warszawa/Warsaw
		'-77.0162, 38.9051, 8'>Washington
		'174.8070, -41.3348, 8'>Wellington
		'17.0770, -22.5596, 8'>Windhoek
		'-5.2826, 6.8184, 8'>Yamoussoukro
		'11.5136, 3.8651, 8'>Yaounde
		'166.9167, -0.5500, 8'>Yaren
		'44.5327, 40.2080, 8'>Yerevan
		'35.2252, 31.7738, 8'>Yerushalayim/Jerusalem
		'15.9644, 45.8071, 8'>Zagreb
    ENDTEXT

    Create Cursor ycapitals (coord c(20),xcapital c(20))
    Set Memow To 8192
    local m.x1,m.x2
    For i=1 To Memlines(m.myvar)
      m.x1=Getwordnum(Mline(m.myvar,i),1,"'")
      m.x2=Getwordnum(Mline(m.myvar,i),2,">")
      Insert Into ycapitals Values (x1,x2)
    Endfor
    *brow
    With This
      .RowSource="ycapitals.xcapital"
      .RowSourceType=6
      .ListIndex=1
      .Style=2
    Endwith
  Endproc

  Procedure Click
    With apie.Document.getElementById("capitals")
      .Value=Eval("'"+Rtrim(coord)+"'")
      .onchange("centerMap('capitals')")
    Endwith
  Endproc

Enddefine
*
*-- EndDefine:ycapitals



*http://yousfi.over-blog.com/2015/03/hide-any-application-icon-from-the-taskbar.html
Function yhideonTaskbar
  Lparameters HWnd
  Declare Integer Sleep In kernel32 Integer
  Declare Integer GetWindowLong In User32 Integer HWnd, Integer nIndex
  Declare Integer SetWindowLong In user32 Integer HWnd,;
    INTEGER nIndex, Integer dwNewLong
  Declare Long FindWindow In "user32" String lpClassName, String lpWindowName
  Declare Integer ShowWindow In user32;
    INTEGER HWnd,;
    INTEGER nCmdShow

  #Define GWL_STYLE -16
  #Define WS_CAPTION 0x00C00000
  #Define WS_THICKFRAME 0x00040000
  #Define WS_DLGFRAME 0x00400000

  *this extened style dont show any icon window (hwnd) on the taskbar
  #Define SW_HIDE 0
  #Define SW_SHOW 5
  #Define WS_EX_NOACTIVATE 0x08000000 &&L
  #Define GWL_EXSTYLE -20
  ShowWindow(HWnd, SW_HIDE) &&important hide/set/hide window
  SetWindowLong(HWnd, GWL_EXSTYLE , WS_EX_NOACTIVATE)
  ShowWindow(HWnd, SW_SHOW)
Endfunc



Dynamic web world Maps drived from VFP
Dynamic web world Maps drived from VFP
Dynamic web world Maps drived from VFP
Dynamic web world Maps drived from VFP
Dynamic web world Maps drived from VFP

Click on code to select [then copy] -click outside to deselect



*2* created on 11 of december 2017 - updated same day.
*use LeafLet.js an open-source JavaScript library for mobile-friendly interactive maps (http://leafletjs.com/index.html).
*i linked directly libraries to the author site but you can download the sources  and link them as local files.(better for avoiding breaking links)
*I build out a cursor with all world capitals and point to any map with its coordinates latitude,longitude.
*the map is flat (no relief) but shows all informations wanted.
*added a fixed title with main informations (see the css with a container to permit fixing this title otherwise it disappers with map zooms)
*can navigate (zoom in ,zoom out,pan) the map.
*can capture any area with windows snippingtool.(can use custom tools coded in previous posts).
*form is top level(showWindow=2) and alwaysontop-apie is fullscreen.when form releases, the apie releases also.
*update: add 2 textboxes for lat,long of any earth point and fire the map
*        hide IE icon on taskbar
*see the image below to avoid IS initial message for activeX.

Declare Integer BringWindowToTop In user32 Integer HWnd
*DECLARE INTEGER ShowWindow IN user32   INTEGER hwnd, INTEGER nCmdShow  &&if dont want fullscreen
Set Safe Off
_Screen.WindowState=1
Create Cursor ycurs (country c(20),capital c(20),lat c(11),Longi c(11),Code c(3),continent c(20))
Set Memowidth To 8192
*Country Name 	Capital Name 	Capital Latitude 	Capital Longitude 	Country Code 	Continent Name
Local m.myvar
TEXT to m.myvar noshow
Afghanistan 	Kabul 	34.51666667 	69.183333 	AF 	Asia
Aland Islands 	Mariehamn 	60.116667 	19.9 	AX 	Europe
Albania 	Tirana 	41.31666667 	19.816667 	AL 	Europe
Algeria 	Algiers 	36.75 	3.05 	DZ 	Africa
American Samoa 	Pago Pago 	-14.26666667 	-170.7 	AS 	Australia
Andorra 	Andorra la Vella 	42.5 	1.516667 	AD 	Europe
Angola 	Luanda 	-8.833333333 	13.216667 	AO 	Africa
Anguilla 	The Valley 	18.21666667 	-63.05 	AI 	North America
Antarctica 	N/A 	0 	0 	AQ 	Antarctica
Antigua and Barbuda 	Saint John’s 	17.11666667 	-61.85 	AG 	North America
Argentina 	Buenos Aires 	-34.58333333 	-58.666667 	AR 	South America
Armenia 	Yerevan 	40.16666667 	44.5 	AM 	Europe
Aruba 	Oranjestad 	12.51666667 	-70.033333 	AW 	North America
Australia 	Canberra 	-35.26666667 	149.133333 	AU 	Australia
Austria 	Vienna 	48.2 	16.366667 	AT 	Europe
Azerbaijan 	Baku 	40.38333333 	49.866667 	AZ 	Europe
Bahamas 	Nassau 	25.08333333 	-77.35 	BS 	North America
Bahrain 	Manama 	26.23333333 	50.566667 	BH 	Asia
Bangladesh 	Dhaka 	23.71666667 	90.4 	BD 	Asia
Barbados 	Bridgetown 	13.1 	-59.616667 	BB 	North America
Belarus 	Minsk 	53.9 	27.566667 	BY 	Europe
Belgium 	Brussels 	50.83333333 	4.333333 	BE 	Europe
Belize 	Belmopan 	17.25 	-88.766667 	BZ 	Central America
Benin 	Porto-Novo 	6.483333333 	2.616667 	BJ 	Africa
Bermuda 	Hamilton 	32.28333333 	-64.783333 	BM 	North America
Bhutan 	Thimphu 	27.46666667 	89.633333 	BT 	Asia
Bolivia 	La Paz 	-16.5 	-68.15 	BO 	South America
Bosnia and Herzegovina 	Sarajevo 	43.86666667 	18.416667 	BA 	Europe
Botswana 	Gaborone 	-24.63333333 	25.9 	BW 	Africa
Brazil 	Brasilia 	-15.78333333 	-47.916667 	BR 	South America
British Indian Ocean Territory 	Diego Garcia 	-7.3 	72.4 	IO 	Africa
British Virgin Islands 	Road Town 	18.41666667 	-64.616667 	VG 	North America
Brunei Darussalam 	Bandar Seri Begawan 	4.883333333 	114.933333 	BN 	Asia
Bulgaria 	Sofia 	42.68333333 	23.316667 	BG 	Europe
Burkina Faso 	Ouagadougou 	12.36666667 	-1.516667 	BF 	Africa
Burundi 	Bujumbura 	-3.366666667 	29.35 	BI 	Africa
Cambodia 	Phnom Penh 	11.55 	104.916667 	KH 	Asia
Cameroon 	Yaounde 	3.866666667 	11.516667 	CM 	Africa
Canada 	Ottawa 	45.41666667 	-75.7 	CA 	Central America
Cape Verde 	Praia 	14.91666667 	-23.516667 	CV 	Africa
Cayman Islands 	George Town 	19.3 	-81.383333 	KY 	North America
Central African Republic 	Bangui 	4.366666667 	18.583333 	CF 	Africa
Chad 	N’Djamena 	12.1 	15.033333 	TD 	Africa
Chile 	Santiago 	-33.45 	-70.666667 	CL 	South America
China 	Beijing 	39.91666667 	116.383333 	CN 	Asia
Christmas Island 	The Settlement 	-10.41666667 	105.716667 	CX 	Australia
Cocos Islands 	West Island 	-12.16666667 	96.833333 	CC 	Australia
Colombia 	Bogota 	4.6 	-74.083333 	CO 	South America
Comoros 	Moroni 	-11.7 	43.233333 	KM 	Africa
Cook Islands 	Avarua 	-21.2 	-159.766667 	CK 	Australia
Costa Rica 	San Jose 	9.933333333 	-84.083333 	CR 	Central America
Cote d’Ivoire 	Yamoussoukro 	6.816666667 	-5.266667 	CI 	Africa
Croatia 	Zagreb 	45.8 	16 	HR 	Europe
Cuba 	Havana 	23.11666667 	-82.35 	CU 	North America
Curaçao 	Willemstad 	12.1 	-68.916667 	CW 	North America
Cyprus 	Nicosia 	35.16666667 	33.366667 	CY 	Europe
Czech Republic 	Prague 	50.08333333 	14.466667 	CZ 	Europe
Democratic Republic of the Congo 	Kinshasa 	-4.316666667 	15.3 	CD 	Africa
Denmark 	Copenhagen 	55.66666667 	12.583333 	DK 	Europe
Djibouti 	Djibouti 	11.58333333 	43.15 	DJ 	Africa
Dominica 	Roseau 	15.3 	-61.4 	DM 	North America
Dominican Republic 	Santo Domingo 	18.46666667 	-69.9 	DO 	North America
Ecuador 	Quito 	-0.216666667 	-78.5 	EC 	South America
Egypt 	Cairo 	30.05 	31.25 	EG 	Africa
El Salvador 	San Salvador 	13.7 	-89.2 	SV 	Central America
Equatorial Guinea 	Malabo 	3.75 	8.783333 	GQ 	Africa
Eritrea 	Asmara 	15.33333333 	38.933333 	ER 	Africa
Estonia 	Tallinn 	59.43333333 	24.716667 	EE 	Europe
Ethiopia 	Addis Ababa 	9.033333333 	38.7 	ET 	Africa
Falkland Islands 	Stanley 	-51.7 	-57.85 	FK 	South America
Faroe Islands 	Torshavn 	62 	-6.766667 	FO 	Europe
Federated States of Micronesia 	Palikir 	6.916666667 	158.15 	FM 	Australia
Fiji 	Suva 	-18.13333333 	178.416667 	FJ 	Australia
Finland 	Helsinki 	60.16666667 	24.933333 	FI 	Europe
France 	Paris 	48.86666667 	2.333333 	FR 	Europe
French Polynesia 	Papeete 	-17.53333333 	-149.566667 	PF 	Australia
French Southern and Antarctic Lands 	Port-aux-Français 	-49.35 	70.216667 	TF 	Antarctica
Gabon 	Libreville 	0.383333333 	9.45 	GA 	Africa
Georgia 	Tbilisi 	41.68333333 	44.833333 	GE 	Europe
Germany 	Berlin 	52.51666667 	13.4 	DE 	Europe
Ghana 	Accra 	5.55 	-0.216667 	GH 	Africa
Gibraltar 	Gibraltar 	36.13333333 	-5.35 	GI 	Europe
Greece 	Athens 	37.98333333 	23.733333 	GR 	Europe
Greenland 	Nuuk 	64.18333333 	-51.75 	GL 	Central America
Grenada 	Saint George’s 	12.05 	-61.75 	GD 	North America
Guam 	Hagatna 	13.46666667 	144.733333 	GU 	Australia
Guatemala 	Guatemala City 	14.61666667 	-90.516667 	GT 	Central America
Guernsey 	Saint Peter Port 	49.45 	-2.533333 	GG 	Europe
Guinea 	Conakry 	9.5 	-13.7 	GN 	Africa
Guinea-Bissau 	Bissau 	11.85 	-15.583333 	GW 	Africa
Guyana 	Georgetown 	6.8 	-58.15 	GY 	South America
Haiti 	Port-au-Prince 	18.53333333 	-72.333333 	HT 	North America
Heard Island and McDonald Islands 	N/A 	0 	0 	HM 	Antarctica
Honduras 	Tegucigalpa 	14.1 	-87.216667 	HN 	Central America
Hong Kong 	N/A 	0 	0 	HK 	Asia
Hungary 	Budapest 	47.5 	19.083333 	HU 	Europe
Iceland 	Reykjavik 	64.15 	-21.95 	IS 	Europe
India 	New Delhi 	28.6 	77.2 	IN 	Asia
Indonesia 	Jakarta 	-6.166666667 	106.816667 	ID 	Asia
Iran 	Tehran 	35.7 	51.416667 	IR 	Asia
Iraq 	Baghdad 	33.33333333 	44.4 	IQ 	Asia
Ireland 	Dublin 	53.31666667 	-6.233333 	IE 	Europe
Isle of Man 	Douglas 	54.15 	-4.483333 	IM 	Europe
Israel 	Jerusalem 	31.76666667 	35.233333 	IL 	Asia
Italy 	Rome 	41.9 	12.483333 	IT 	Europe
Jamaica 	Kingston 	18 	-76.8 	JM 	North America
Japan 	Tokyo 	35.68333333 	139.75 	JP 	Asia
Jersey 	Saint Helier 	49.18333333 	-2.1 	JE 	Europe
Jordan 	Amman 	31.95 	35.933333 	JO 	Asia
Kazakhstan 	Astana 	51.16666667 	71.416667 	KZ 	Asia
Kenya 	Nairobi 	-1.283333333 	36.816667 	KE 	Africa
Kiribati 	Tarawa 	-0.883333333 	169.533333 	KI 	Australia
Kosovo 	Pristina 	42.66666667 	21.166667 	KO 	Europe
Kuwait 	Kuwait City 	29.36666667 	47.966667 	KW 	Asia
Kyrgyzstan 	Bishkek 	42.86666667 	74.6 	KG 	Asia
Laos 	Vientiane 	17.96666667 	102.6 	LA 	Asia
Latvia 	Riga 	56.95 	24.1 	LV 	Europe
Lebanon 	Beirut 	33.86666667 	35.5 	LB 	Asia
Lesotho 	Maseru 	-29.31666667 	27.483333 	LS 	Africa
Liberia 	Monrovia 	6.3 	-10.8 	LR 	Africa
Libya 	Tripoli 	32.88333333 	13.166667 	LY 	Africa
Liechtenstein 	Vaduz 	47.13333333 	9.516667 	LI 	Europe
Lithuania 	Vilnius 	54.68333333 	25.316667 	LT 	Europe
Luxembourg 	Luxembourg 	49.6 	6.116667 	LU 	Europe
Macau 	N/A 	0 	0 	MO 	Asia
Macedonia 	Skopje 	42 	21.433333 	MK 	Europe
Madagascar 	Antananarivo 	-18.91666667 	47.516667 	MG 	Africa
Malawi 	Lilongwe 	-13.96666667 	33.783333 	MW 	Africa
Malaysia 	Kuala Lumpur 	3.166666667 	101.7 	MY 	Asia
Maldives 	Male 	4.166666667 	73.5 	MV 	Asia
Mali 	Bamako 	12.65 	-8 	ML 	Africa
Malta 	Valletta 	35.88333333 	14.5 	MT 	Europe
Marshall Islands 	Majuro 	7.1 	171.383333 	MH 	Australia
Mauritania 	Nouakchott 	18.06666667 	-15.966667 	MR 	Africa
Mauritius 	Port Louis 	-20.15 	57.483333 	MU 	Africa
Mexico 	Mexico City 	19.43333333 	-99.133333 	MX 	Central America
Moldova 	Chisinau 	47 	28.85 	MD 	Europe
Monaco 	Monaco 	43.73333333 	7.416667 	MC 	Europe
Mongolia 	Ulaanbaatar 	47.91666667 	106.916667 	MN 	Asia
Montenegro 	Podgorica 	42.43333333 	19.266667 	ME 	Europe
Montserrat 	Plymouth 	16.7 	-62.216667 	MS 	North America
Morocco 	Rabat 	34.01666667 	-6.816667 	MA 	Africa
Mozambique 	Maputo 	-25.95 	32.583333 	MZ 	Africa
Myanmar 	Rangoon 	16.8 	96.15 	MM 	Asia
Namibia 	Windhoek 	-22.56666667 	17.083333 	NA 	Africa
Nauru 	Yaren 	-0.5477 	166.920867 	NR 	Australia
Nepal 	Kathmandu 	27.71666667 	85.316667 	NP 	Asia
Netherlands 	Amsterdam 	52.35 	4.916667 	NL 	Europe
New Caledonia 	Noumea 	-22.26666667 	166.45 	NC 	Australia
New Zealand 	Wellington 	-41.3 	174.783333 	NZ 	Australia
Nicaragua 	Managua 	12.13333333 	-86.25 	NI 	Central America
Niger 	Niamey 	13.51666667 	2.116667 	NE 	Africa
Nigeria 	Abuja 	9.083333333 	7.533333 	NG 	Africa
Niue 	Alofi 	-19.01666667 	-169.916667 	NU 	Australia
Norfolk Island 	Kingston 	-29.05 	167.966667 	NF 	Australia
North Korea 	Pyongyang 	39.01666667 	125.75 	KP 	Asia
Northern Cyprus 	North Nicosia 	35.183333 	33.366667 	NULL 	Europe
Northern Mariana Islands 	Saipan 	15.2 	145.75 	MP 	Australia
Norway 	Oslo 	59.91666667 	10.75 	NO 	Europe
Oman 	Muscat 	23.61666667 	58.583333 	OM 	Asia
Pakistan 	Islamabad 	33.68333333 	73.05 	PK 	Asia
Palau 	Melekeok 	7.483333333 	134.633333 	PW 	Australia
Palestine 	Jerusalem 	31.76666667 	35.233333 	PS 	Asia
Panama 	Panama City 	8.966666667 	-79.533333 	PA 	Central America
Papua New Guinea 	Port Moresby 	-9.45 	147.183333 	PG 	Australia
Paraguay 	Asuncion 	-25.26666667 	-57.666667 	PY 	South America
Peru 	Lima 	-12.05 	-77.05 	PE 	South America
Philippines 	Manila 	14.6 	120.966667 	PH 	Asia
Pitcairn Islands 	Adamstown 	-25.06666667 	-130.083333 	PN 	Australia
Poland 	Warsaw 	52.25 	21 	PL 	Europe
Portugal 	Lisbon 	38.71666667 	-9.133333 	PT 	Europe
Puerto Rico 	San Juan 	18.46666667 	-66.116667 	PR 	North America
Qatar 	Doha 	25.28333333 	51.533333 	QA 	Asia
Republic of Congo 	Brazzaville 	-4.25 	15.283333 	CG 	Africa
Romania 	Bucharest 	44.43333333 	26.1 	RO 	Europe
Russia 	Moscow 	55.75 	37.6 	RU 	Europe
Rwanda 	Kigali 	-1.95 	30.05 	RW 	Africa
Saint Barthelemy 	Gustavia 	17.88333333 	-62.85 	BL 	North America
Saint Helena 	Jamestown 	-15.93333333 	-5.716667 	SH 	Africa
Saint Kitts and Nevis 	Basseterre 	17.3 	-62.716667 	KN 	North America
Saint Lucia 	Castries 	14 	-61 	LC 	North America
Saint Martin 	Marigot 	18.0731 	-63.0822 	MF 	North America
Saint Pierre and Miquelon 	Saint-Pierre 	46.76666667 	-56.183333 	PM 	Central America
Saint Vincent and the Grenadines 	Kingstown 	13.13333333 	-61.216667 	VC 	Central America
Samoa 	Apia 	-13.81666667 	-171.766667 	WS 	Australia
San Marino 	San Marino 	43.93333333 	12.416667 	SM 	Europe
Sao Tome and Principe 	Sao Tome 	0.333333333 	6.733333 	ST 	Africa
Saudi Arabia 	Riyadh 	24.65 	46.7 	SA 	Asia
Senegal 	Dakar 	14.73333333 	-17.633333 	SN 	Africa
Serbia 	Belgrade 	44.83333333 	20.5 	RS 	Europe
Seychelles 	Victoria 	-4.616666667 	55.45 	SC 	Africa
Sierra Leone 	Freetown 	8.483333333 	-13.233333 	SL 	Africa
Singapore 	Singapore 	1.283333333 	103.85 	SG 	Asia
Sint Maarten 	Philipsburg 	18.01666667 	-63.033333 	SX 	North America
Slovakia 	Bratislava 	48.15 	17.116667 	SK 	Europe
Slovenia 	Ljubljana 	46.05 	14.516667 	SI 	Europe
Solomon Islands 	Honiara 	-9.433333333 	159.95 	SB 	Australia
Somalia 	Mogadishu 	2.066666667 	45.333333 	SO 	Africa
Somaliland 	Hargeisa 	9.55 	44.05 	NULL 	Africa
South Africa 	Pretoria 	-25.7 	28.216667 	ZA 	Africa
South Georgia and South Sandwich Islands 	King Edward Point 	-54.283333 	-36.5 	GS 	Antarctica
South Korea 	Seoul 	37.55 	126.983333 	KR 	Asia
South Sudan 	Juba 	4.85 	31.616667 	SS 	Africa
Spain 	Madrid 	40.4 	-3.683333 	ES 	Europe
Sri Lanka 	Colombo 	6.916666667 	79.833333 	LK 	Asia
Sudan 	Khartoum 	15.6 	32.533333 	SD 	Africa
Suriname 	Paramaribo 	5.833333333 	-55.166667 	SR 	South America
Svalbard 	Longyearbyen 	78.21666667 	15.633333 	SJ 	Europe
Swaziland 	Mbabane 	-26.31666667 	31.133333 	SZ 	Africa
Sweden 	Stockholm 	59.33333333 	18.05 	SE 	Europe
Switzerland 	Bern 	46.91666667 	7.466667 	CH 	Europe
Syria 	Damascus 	33.5 	36.3 	SY 	Asia
Taiwan 	Taipei 	25.03333333 	121.516667 	TW 	Asia
Tajikistan 	Dushanbe 	38.55 	68.766667 	TJ 	Asia
Tanzania 	Dar es Salaam 	-6.8 	39.283333 	TZ 	Africa
Thailand 	Bangkok 	13.75 	100.516667 	TH 	Asia
The Gambia 	Banjul 	13.45 	-16.566667 	GM 	Africa
Timor-Leste 	Dili 	-8.583333333 	125.6 	TL 	Asia
Togo 	Lome 	6.116666667 	1.216667 	TG 	Africa
Tokelau 	Atafu 	-9.166667 	-171.833333 	TK 	Australia
Tonga 	Nuku’alofa 	-21.13333333 	-175.2 	TO 	Australia
Trinidad and Tobago 	Port of Spain 	10.65 	-61.516667 	TT 	North America
Tunisia 	Tunis 	36.8 	10.183333 	TN 	Africa
Turkey 	Ankara 	39.93333333 	32.866667 	TR 	Europe
Turkmenistan 	Ashgabat 	37.95 	58.383333 	TM 	Asia
Turks and Caicos Islands 	Grand Turk 	21.46666667 	-71.133333 	TC 	North America
Tuvalu 	Funafuti 	-8.516666667 	179.216667 	TV 	Australia
Uganda 	Kampala 	0.316666667 	32.55 	UG 	Africa
Ukraine 	Kyiv 	50.43333333 	30.516667 	UA 	Europe
United Arab Emirates 	Abu Dhabi 	24.46666667 	54.366667 	AE 	Asia
United Kingdom 	London 	51.5 	-0.083333 	GB 	Europe
United States 	Washington, D.C. 	38.883333 	-77 	US 	Central America
Uruguay 	Montevideo 	-34.85 	-56.166667 	UY 	South America
US Minor Outlying Islands 	Washington, D.C. 	38.883333 	-77 	UM 	Australia
US Virgin Islands 	Charlotte Amalie 	18.35 	-64.933333 	VI 	North America
Uzbekistan 	Tashkent 	41.31666667 	69.25 	UZ 	Asia
Vanuatu 	Port-Vila 	-17.73333333 	168.316667 	VU 	Australia
Vatican City 	Vatican City 	41.9 	12.45 	VA 	Europe
Venezuela 	Caracas 	10.48333333 	-66.866667 	VE 	South America
Vietnam 	Hanoi 	21.03333333 	105.85 	VN 	Asia
Wallis and Futuna 	Mata-Utu 	-13.95 	-171.933333 	WF 	Australia
Western Sahara 	El-Aaiún 	27.153611 	-13.203333 	EH 	Africa
Yemen 	Sanaa 	15.35 	44.2 	YE 	Asia
Zambia 	Lusaka 	-15.41666667 	28.283333 	ZM 	Africa
Zimbabwe 	Harare 	-17.81666667 	31.033333 	ZW 	Africa
ENDTEXT
m.myvar=Strtran(m.myvar,Chr(9),',')

Local m.u, m.x1,m.x2,m.x3,m.x4,m.x5,m.x6
For i=1 To Memlines(m.myvar)
m.u=Mline(m.myvar,i)
m.x1=Getwordnum(m.u,1,',')
m.x2=Getwordnum(m.u,2,',')
m.x3=Getwordnum(m.u,3,',')
m.x4=Getwordnum(m.u,4,',')
m.x5=Getwordnum(m.u,5,',')
m.x6=Getwordnum(m.u,6,',')
Insert Into ycurs Values(m.x1,m.x2,m.x3,m.x4,m.x5,m.x6)
Endfor
*brow
Locate

_Screen.AddProperty("ystr","")
Publi m.yrep
m.yrep=Addbs(Justpath(Sys(16,1)))
Set Defa To (yrep)

Publi yform
yform=Newobject("ynavig")
yform.Show
Read Events
Retu

Define Class ynavig As Form
ShowWindow=2
AlwaysOnTop=.T.
MaxButton=.F.
MinButton=.F.
Width=160
Height=55
Top=30
Left=100
backcolor=rgb(212,210,208)
Caption="Capitals"
Name="ynavig"

Add Object ycom As CommandButton With;
left=107,;
top=2,;
height=22,;
width=45,;
fontsize=8,;
caption="Capture",;
backcolor=rgb(0,255,0),;
mousepointer=15,;
name="ycom"

Add object Tlat as textbox with;
left=5,;
top=30,;
width=50,;
value="33.68000",;
name="Tlat"

Add object Tlongi as textbox with;
left=56,;
top=30,;
width=50,;
value="1.02000",;
name="Tlongi"

Add Object ycom1 As CommandButton With;
left=107,;
top=30,;
width=40,;
height=22,;
caption="...",;
mousepointer=15,;
tooltiptext="Go",;
backcolor=rgb(0,255,0),;
name="ycom1"

Procedure ycom.Click
Try
  Run/N c:\Windows\sysnative\snippingtool.Exe
Catch
  Messagebox("an error was occured!",4+4096,'error',1300)
Endtry
Endproc

procedure ycom1.click
Thisform.ybuild(thisform.tLat.value,thisform.tLongi.value,"","")
endproc


Procedure Init
Sele ycurs
With This
  .caption=trans(reccount())+" Capitals"
  .AddObject("ycapitals", "ycapitals")
  .ycapitals.Visible=.T.
Endwith

Publi apie
apie=Newobject("internetexplorer.application")
Sele ycurs
Thisform.ybuild(lat,longi,capital,country)
Endproc

Procedure ybuild
Lparameters xlat,xlongi,xcapital,xcountry
local m.tit
m.tit=iif( !empty(xcapital),"Capital:"+xcapital,"")+"  "+iif(!empty(xcountry),"Country:"+xcountry,"")


Local m.myv
TEXT to m.myv textmerge noshow
<!DOCTYPE html>
<html>
<head>
<title>World capitals navigation</title>
<meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="ie=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<link rel="stylesheet" href="https://unpkg.com/leaflet@1.2.0/dist/leaflet.css" >
<script src="https://unpkg.com/leaflet@1.2.0/dist/leaflet.js" ></script>

<style>
.ycont {
width:100%;
position:fixed;
top:0px;
}
h2 {
height:25px;
background:#F0F0F0;
border:1px solid #CCC;
width:100%px;
margin:0px auto;
}
#mapid {
width:100%;
height: 2000px;
margin: 0px auto;
}
</style>
</head>
<body scroll="no" oncontextmenu="return false;">
<div class="ycont">
<center><h2 style="color:maroon;"> <<m.tit>>    (lat=<<allt(xlat)>> longi=<<allt(xlongi)>>)</h2></center>
<div id="mapid"  style="width=800px;height:900px;"></div>
</div>

<script>
var mymap = L.map('mapid').setView([<<allt(xlat)>>, <<allt(xlongi)>>], 15);
L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw', {
	maxZoom: 18,
	attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' +
		'<a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
		'Imagery © <a href="http://mapbox.com">Mapbox</a>',
	id: 'mapbox.streets',
}).addTo(mymap)
</script>
</body>
</html>
ENDTEXT

Local m.lcdest
m.lcdest=m.yrep+"ytemp.html"
Strtofile(m.myv,m.lcdest)

With apie
  .silent=.t.
  .Navigate(m.lcdest)
  .menubar=0
  .Toolbar=0
  .StatusBar=0
 * BringWindowToTop(.HWnd)
  .fullscreen=1
  *ShowWindow(.hwnd,3)  &&maximized

  =yhideonTaskbar(.HWnd)   &&hide the IE icon on taskbar
      Inke(2)
     bringwindowtotop(.hwnd)
.Visible=.T.
Endwith
Endproc
Enddefine

Define Class ycapitals As ComboBox
Height = 22
Left = 5
SpecialEffect = 2
Style = 2
ToolTipText = "Capitals"
Top = 2
Width = 100
DisplayCount = 20
Name = "ycapitals"

Procedure Init
With This
  .RowSourceType=6
  .RowSource="ycurs.capital"
  .ListIndex=4
  .Style=2
Endwith
Endproc

Procedure Click
Thisform.ybuild(lat,longi,capital,country)
Endproc

Procedure Destroy
Dele File ytemp*.html
Try
  apie.Quit
  apie.Release
  m.yrep=Null
  m.yrep.Release
Catch
Endtry
Clea Events
Endproc
Enddefine
*
*-- EndDefine:ycapitals

*http://yousfi.over-blog.com/2015/03/hide-any-application-icon-from-the-taskbar.html
Function yhideonTaskbar
  Lparameters HWnd
  Declare Integer Sleep In kernel32 Integer
  Declare Integer GetWindowLong In User32 Integer HWnd, Integer nIndex
  Declare Integer SetWindowLong In user32 Integer HWnd,;
    INTEGER nIndex, Integer dwNewLong
  Declare Long FindWindow In "user32" String lpClassName, String lpWindowName
  Declare Integer ShowWindow In user32;
    INTEGER HWnd,;
    INTEGER nCmdShow

  #Define GWL_STYLE -16
  #Define WS_CAPTION 0x00C00000
  #Define WS_THICKFRAME 0x00040000
  #Define WS_DLGFRAME 0x00400000

  *this extened style dont show any icon window (hwnd) on the taskbar
  #Define SW_HIDE 0
  #Define SW_SHOW 5
  #Define WS_EX_NOACTIVATE 0x08000000 &&L
  #Define GWL_EXSTYLE -20
  ShowWindow(HWnd, SW_HIDE) &&important hide/set/hide window
  SetWindowLong(HWnd, GWL_EXSTYLE , WS_EX_NOACTIVATE)
  ShowWindow(HWnd, SW_SHOW)
Endfunc


ie icon is hidden on taskbar in code.see how to work with collections as getElementsbyClassname
ie icon is hidden on taskbar in code.see how to work with collections as getElementsbyClassname
ie icon is hidden on taskbar in code.see how to work with collections as getElementsbyClassname
ie icon is hidden on taskbar in code.see how to work with collections as getElementsbyClassname

ie icon is hidden on taskbar in code.see how to work with collections as getElementsbyClassname

this is for making IE dont show very bad initial message for activex ("allow blocked contents")

this is for making IE dont show very bad initial message for activex ("allow blocked contents")

Click on code to select [then copy] -click outside to deselect


Some VFP and DOM interactions:
document is the object top of the DOM hierarchy.it can be accessible from vfp with apie or browser (shell.explorer.2)
but after passing the transitionnings (otherwise error is returned.it must exits to make it working)
in fast internet connection must stay nearly 5 sec to have the document object disponible.to make sure can use a loop (testing readystate#4).
can also make an interval of  3 sec to be sure the document object is built.(can use inkey(3) or api sleep(3000) ).

.document.getElementById(id_string)   &&unique Id (as sys(2015)) point to an object having this Id and can work with its properties...
for VFP this is an object as you can test : vartype(.document.getElementById(id_string))="O"

Get all elements with the specified class name:m.x= .document.getElementsByClassName("classname")  : its a collection of objects (elements) having the same classname.

to obtain the count of elements with specified class: n=  .document.getElementsByClassName("classname").length

to iterate in this collection from VFP better way is :
for each obj in m.x
obj.style.backgroundColor = "maroon"     && can execute any DOM code of element obj
next

.document.getElementsByTagName("p")   &&get all p elements another collection.
.document.getElementsByName("name_value")  &&get all elements having same name attribute.
you can see the code *1* with some live  interactions here.
can review : https://www.w3schools.com/js/js_htmldom_elements.asp


Click on code to select [then copy] -click outside to deselect


*3* created on Monday 12 of december 2017
*another free world zoomable/pannable map from  https://openlayers.org/
*its drived directly from vfp with a top level form and a combobox with options.
*i added script for the zoomslider and navigation to an Algerian town.can do that for any world point with its coordinates (lat,long)
*this is an animation effect on world map with many transitions (made by javascript easing code).
*just select the zomm in the zooslider and navigue in the combo.
*of course its a mix of javascript (https://openlayers.org/) and vfp code.see in particular the VFP oop to traverse javascript codes(createElement,getElementById,add script,add css style...)
*the IE icon is made hidden on taskbar.

Publi yform
yform=Newobject("openlayerMap")
yform.Show
Read Events
Retu
*
Define Class openLayerMap As Form
BorderStyle = 0
Top = -1
Left = 65
Height = 40
Width = 210
ShowWindow = 2
Caption = ""
MaxButton = .F.
MinButton = .F.
AlwaysOnTop = .T.
BackColor = Rgb(212,208,210)
Name = "Form1"

Add Object combo1 As ComboBox With ;
Height = 24, ;
Left = 12, ;
Top = 12, ;
Width = 192, ;
DisplayCount = 9, ;
Name = "Combo1"

Procedure Load
Declare Integer BringWindowToTop In user32 Integer HWnd
_Screen.WindowState=1
Local m.myvar
TEXT to m.myvar noshow
<!DOCTYPE html>
<html>
<head>
<title>View Animation</title>
<link rel="stylesheet" href="https://openlayers.org/en/v4.6.4/css/ol.css" type="text/css">
<!-- The line below is only needed for old environments like Internet Explorer and Android 4.x -->
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=requestAnimationFrame,Element.prototype.classList,URL"></script>
<script src="https://openlayers.org/en/v4.6.4/build/ol.js"></script>
</head>
<body>
<div id="map" class="map"></div>
<center><p style="color:lime;font-size:32px;font-family:script;">This example shows how to use the <code>view.animate()</code> method to run one or more animations. (original source from https://openlayers.org/à</p>
<button id="rotate-left" title="Rotate clockwise" style="visibility:hidden;"></button>
<button id="rotate-right" title="Rotate counterclockwise" style="visibility:hidden;"></button>
<button id="pan-to-london" style="visibility:hidden;"></button>
<button id="elastic-to-moscow"  style="visibility:hidden;"></button>
<button id="bounce-to-istanbul"  style="visibility:hidden;"></button></button>
<button id="spin-to-elbayadh"  style="visibility:hidden;"></button></button>
<button id="fly-to-bern"  style="visibility:hidden;"></button></button>
<button id="rotate-around-elbayadh"  style="visibility:hidden;"></button></button>
<button id="tour"  style="visibility:hidden;"></button></button>
<script>
  var london = ol.proj.fromLonLat([-0.12755, 51.507222]);
  var moscow = ol.proj.fromLonLat([37.6178, 55.7517]);
  var istanbul = ol.proj.fromLonLat([28.7319918,41.0055005]);
  var elbayadh = ol.proj.fromLonLat([1.0036082,33.6646082 ]);
  var bern = ol.proj.fromLonLat([7.4458, 46.95]);

  var view = new ol.View({
	center: elbayadh,
	zoom: 6
  });
  var map = new ol.Map({
	target: 'map',
	layers: [
	  new ol.layer.Tile({
		preload: 4,
		source: new ol.source.OSM()
	  })
	],

	// Improve user experience by loading tiles while animating. Will make
	// animations stutter on mobile or slow devices.
	loadTilesWhileAnimating: true,
	view: view
  });

  // A bounce easing method (from https://github.com/DmitryBaranovskiy/raphael).
  function bounce(t) {
	var s = 7.5625, p = 2.75, l;
	if (t < (1 / p)) {
	  l = s * t * t;
	} else {
	  if (t < (2 / p)) {
		t -= (1.5 / p);
		l = s * t * t + 0.75;
	  } else {
		if (t < (2.5 / p)) {
		  t -= (2.25 / p);
		  l = s * t * t + 0.9375;
		} else {
		  t -= (2.625 / p);
		  l = s * t * t + 0.984375;
		}
	  }
	}
	return l;
  }
  // An elastic easing method (from https://github.com/DmitryBaranovskiy/raphael).
  function elastic(t) {
	return Math.pow(2, -10 * t) * Math.sin((t - 0.075) * (2 * Math.PI) / 0.3) + 1;
  }

  function onClick(id, callback) {
	document.getElementById(id).addEventListener('click', callback);
  }
  onClick('rotate-left', function() {
	view.animate({
	  rotation: view.getRotation() + Math.PI / 2
	});
  });

  onClick('rotate-right', function() {
	view.animate({
	  rotation: view.getRotation() - Math.PI / 2
	});
  });
  onClick('rotate-around-elbayadh', function() {
	// Rotation animation takes the shortest arc, so animate in two parts
	var rotation = view.getRotation();
	view.animate({
	  center: elbayadh,
	  rotation: rotation + Math.PI,
	  anchor: elbayadh,
	  easing: ol.easing.easeIn
	}, {
	  rotation: rotation + 2 * Math.PI,
	  anchor: elbayadh,
	  easing: ol.easing.easeOut
	});
  });

  onClick('pan-to-london', function() {
	view.animate({
	  center: london,
	  duration: 2000
	});
  });

  onClick('elastic-to-moscow', function() {
	view.animate({
	  center: moscow,
	  duration: 2000,
	  easing: elastic
	});
  });

  onClick('bounce-to-istanbul', function() {
	view.animate({
	  center: istanbul,
	  duration: 2000,
	  easing: bounce
	});
  });

  onClick('spin-to-elbayadh', function() {
	// Rotation animation takes the shortest arc, so animate in two parts
	var center = view.getCenter();
	view.animate({
	  center: [
		center[0] + (elbayadh[0] - center[0]) / 2,
		center[1] + (elbayadh[1] - center[1]) / 2
	  ],
	  rotation: Math.PI,
	  easing: ol.easing.easeIn
	}, {
	  center: elbayadh,
	  rotation: 2 * Math.PI,
	  easing: ol.easing.easeOut
	});
  });

  function flyTo(location, done) {
	var duration = 2000;
	var zoom = view.getZoom();
	var parts = 2;
	var called = false;
	function callback(complete) {
	  --parts;
	  if (called) {
		return;
	  }
	  if (parts === 0 || !complete) {
		called = true;
		done(complete);
	  }
	}
	view.animate({
	  center: location,
	  duration: duration
	}, callback);
	view.animate({
	  zoom: zoom - 1,
	  duration: duration / 2
	}, {
	  zoom: zoom,
	  duration: duration / 2
	}, callback);
  }

  onClick('fly-to-bern', function() {
	flyTo(bern, function() {});
  });

  function tour() {
	var locations = [london, bern, elbayadh, moscow, istanbul];
	var index = -1;
	function next(more) {
	  if (more) {
		++index;
		if (index < locations.length) {
		  var delay = index === 0 ? 0 : 750;
		  setTimeout(function() {
			flyTo(locations[index], next);
		  }, delay);
		} else {
		  alert('Tour complete');
		}
	  } else {
		alert('Tour cancelled');
	  }
	}
	next(true);
  }
  onClick('tour', tour);
</script>
</body>
</html>
ENDTEXT
Publi apie
apie=Newobject("internetexplorer.application")
With apie
.Navigate("about:blank")
.fullscreen=1
Inkey(1)
.Document.Open()
.Document.Write(m.myvar)
.Document.Close()

Local m.myvar
TEXT to m.my1 noshow
/**
* The zoomslider in the second map shall be placed between the zoom-in and
* zoom-out buttons.
*/
#map .ol-zoom .ol-zoom-out {
margin-top: 204px;
}
#map .ol-zoomslider {
background-color: transparent;
top: 2.3em;
}
#map .ol-touch .ol-zoom .ol-zoom-out {
margin-top: 212px;
}
#map .ol-touch .ol-zoomslider {
top: 2.75em;
}

#map .ol-zoom-in.ol-has-tooltip:hover [role=tooltip],
#map .ol-zoom-in.ol-has-tooltip:focus [role=tooltip] {
top: 3px;
}
#map .ol-zoom-out.ol-has-tooltip:hover [role=tooltip],
#map .ol-zoom-out.ol-has-tooltip:focus [role=tooltip] {
top: 232px;
}
.fullscreen:-moz-full-screen {
height: 100%;
}
.fullscreen:-webkit-full-screen {
height: 100%;
}
.fullscreen:-ms-fullscreen {
height: 100%;
}
.fullscreen:fullscreen {
height: 100%;
}
.fullscreen {
margin-bottom: 10px;
width: 100%;
height: 100%;
}
.ol-rotate {
top: 3em;
}
.map {
width: 100%;
height:100%;
float: left;
}
ENDTEXT

With .Document
Local m.x,m.t
m.x = .createElement("STYLE")
m.t = .createTextNode(m.my1)
m.x.appendChild(m.t)
.Head.appendChild(m.x)
Endwith

Inke(1) &&transitionnings ...to adapt document object must be exist
.Document.body.Style.background="url('http://img.over-blog-kiwi.com/1/43/54/07/20171204/ob_5d61c1_stars-night.jpg');repeat;"

*adding the zoomslider contro to map
TEXT to m.my2 noshow
var  zoomslider = new ol.control.ZoomSlider();
map.addControl(zoomslider);
ENDTEXT
With .Document
Local m.script
m.script = .createElement("script")
m.script.Type="text/javascript"
m.script.innerhtml=m.my2
.body.appendChild(m.script)
Endwith

BringWindowToTop(.HWnd)
=yhideonTaskbar(.HWnd)   &&hide the IE icon on taskbar
.Visible=.T.
Endwith
Endproc

Procedure Destroy
Try
apie.Quit
Release apie
Catch
Endtry
Clea Events
Endproc

Procedure combo1.Click
With apie.Document
Do Case
Case This.Value=1
.getElementById("rotate-left").Click(.T.)
Case This.Value=2
.getElementById("rotate-right").Click(.T.)
Case This.Value=3
.getElementById("pan-to-london").Click(.T.)
Case This.Value=4
.getElementById("elastic-to-moscow").Click(.T.)
Case This.Value=5
.getElementById("elastic-to-moscow").Click(.T.)
Case This.Value=6
.getElementById("spin-to-elbayadh").Click(.T.)
Case This.Value=7
.getElementById("fly-to-bern").Click(.T.)
Case This.Value=8
.getElementById("rotate-around-elbayadh").Click(.T.)
Case This.Value=9
.getElementById("tour").Click(.T.)
Endcase
Endwith
Endproc

Procedure combo1.Init
With This
.AddItem("Rotate clockwise")
.AddItem("Rotate counterclockwise")
.AddItem("Pan to London")
.AddItem("Elastic to Moscow")
.AddItem("Bounce to Istanbul")
.AddItem("Spin to El bayadh")
.AddItem("Fly to Bern")
.AddItem("Rotate around El Bayadh")
.AddItem("Take a tour")
.ListIndex=1
.Value=1
.Style=2
Endwith
Endproc

Enddefine
*
*-- EndDefine: openLayerMap

*http://yousfi.over-blog.com/2015/03/hide-any-application-icon-from-the-taskbar.html
*hide IE icon from taskbar
Function yhideonTaskbar
Lparameters HWnd
Declare Integer Sleep In kernel32 Integer
Declare Integer GetWindowLong In User32 Integer HWnd, Integer nIndex
Declare Integer SetWindowLong In user32 Integer HWnd,;
INTEGER nIndex, Integer dwNewLong
Declare Long FindWindow In "user32" String lpClassName, String lpWindowName
Declare Integer ShowWindow In user32;
INTEGER HWnd,;
INTEGER nCmdShow

#Define GWL_STYLE -16
#Define WS_CAPTION 0x00C00000
#Define WS_THICKFRAME 0x00040000
#Define WS_DLGFRAME 0x00400000

*this extened style dont show any icon window (hwnd) on the taskbar
#Define SW_HIDE 0
#Define SW_SHOW 5
#Define WS_EX_NOACTIVATE 0x08000000 &&L
#Define GWL_EXSTYLE -20
ShowWindow(HWnd, SW_HIDE) &&important hide/set/hide window
SetWindowLong(HWnd, GWL_EXSTYLE , WS_EX_NOACTIVATE)
ShowWindow(HWnd, SW_SHOW)
Endfunc


select the zoom wanted on the zoomslider and navigue in the form.combo.
select the zoom wanted on the zoomslider and navigue in the form.combo.
select the zoom wanted on the zoomslider and navigue in the form.combo.

select the zoom wanted on the zoomslider and navigue in the form.combo.

Click on code to select [then copy] -click outside to deselect

 
*4* created on 12 of december 2017
*from free world maps https://openlayers.org.
*map with vertical slider and fullscreen capability (right top window)+ custom exit button
*see in particular from vfp :the style creation,the exit button,the zoomslider creation,the background image from web.

Declare Integer BringWindowToTop In user32 Integer HWnd
Local m.myvar
TEXT to m.myvar noshow
<!DOCTYPE html>
<html>
<head>
<title>Full Screen Control with extended source element</title>
<link rel="stylesheet" href="https://openlayers.org/en/v4.6.4/css/ol.css" type="text/css">
<!-- The line below is only needed for old environments like Internet Explorer and Android 4.x -->
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=requestAnimationFrame,Element.prototype.classList,URL"></script>
<script src="https://openlayers.org/en/v4.6.4/build/ol.js"></script>
</head>
<body>
<div id="fullscreen" class="fullscreen">
  <div id="map" class="map" width="800" height="580"></div>
</div>
</body>
ENDTEXT

Publi apie
apie=Newobject("internetexplorer.application")
With apie
.Navigate("about:blank")
*.fullscreen=0
.menubar=0
.Toolbar=0
.StatusBar=0
.Width=800
.Height=600
Inke(1)
.Document.Open()
.Document.Write(m.myvar)
.Document.Close()
Endwith

With apie.Document

*this create dynamically from vfp a button (ybutton) in "map" and fill it with code to exit.
TEXT to m.my noshow
<center><button id="yb"  style="margin-top:5px;padding:5px;background-color:cyan;color:red;cursor:pointer;" onclick="window.open('','_self');window.close();" >Exit</button></center>
ENDTEXT
Local m.ybutton
m.ybutton=.createElement("ybutton")
m.ybutton.innerhtml=m.my
.getElementbyId("map").appendChild(m.ybutton)

*this creates a style in head html section from vfp
Local m.myvar
TEXT to m.myvar noshow
 /**
   * The zoomslider in the second map shall be placed between the zoom-in and
   * zoom-out buttons.
   */
  #map .ol-zoom .ol-zoom-out {
	margin-top: 204px;
  }
  #map .ol-zoomslider {
	background-color: transparent;
	top: 2.3em;
  }

  #map .ol-touch .ol-zoom .ol-zoom-out {
	margin-top: 212px;
  }
  #map .ol-touch .ol-zoomslider {
	top: 2.75em;
  }
  #map .ol-zoom-in.ol-has-tooltip:hover [role=tooltip],
  #map .ol-zoom-in.ol-has-tooltip:focus [role=tooltip] {
	top: 3px;
  }
  #map .ol-zoom-out.ol-has-tooltip:hover [role=tooltip],
  #map .ol-zoom-out.ol-has-tooltip:focus [role=tooltip] {
	top: 232px;
  }
  .fullscreen:-moz-full-screen {
	height: 100%;
  }
  .fullscreen:-webkit-full-screen {
	height: 100%;
  }
  .fullscreen:-ms-fullscreen {
	height: 100%;
  }
  .fullscreen:fullscreen {
	height: 100%;
  }
  .fullscreen {
	margin-bottom: 10px;
	width: 100%;
	height: 100%;
  }
  .ol-rotate {
	top: 3em;
  }
  .map {
	width: 100%;
	height:100%;
	float: left;
  }
ENDTEXT

Local m.x,m.t
m.x = .createElement("STYLE")
m.t = .createTextNode(m.myvar)
m.x.appendChild(m.t)
.Head.appendChild(m.x)

*this add from vfp a background image from web.
.body.Style.background='url("http://img.over-blog-kiwi.com/1/43/54/07/20171204/ob_5d61c1_stars-night.jpg");repeat;'
Endwith

With apie
BringWindowToTop(.HWnd)
.Visible=.T.
Endwith

TEXT to m.myv noshow
  /**
   * Helper method for map-creation.
   *
   * @param {string} divId The id of the div for the map.
   * @return {ol.PluggableMap} The ol.Map instance.
   */
  var createMap = function(divId) {
	var source, layer, map, zoomslider;

	source = new ol.source.OSM();
	layer = new ol.layer.Tile({
	  source: source
	});
	map = new ol.Map({
	controls: ol.control.defaults().extend([
	  new ol.control.FullScreen({
		source: 'fullscreen'
	  })
	]),
	layers: [
	  new ol.layer.Tile({
		source: new ol.source.OSM()
	  })
	],
	  target: divId,
	  view: new ol.View({
		center: [33.6510,1.02],
		zoom: 4
	  })
	});
	zoomslider = new ol.control.ZoomSlider();
	map.addControl(zoomslider);
	return map;
  };
  var map = createMap('map');
ENDTEXT

With apie.Document
Local m.script
m.script = .createElement("script")
m.script.Type="text/javascript"
m.script.innerhtml=m.myv
.body.appendChild(m.script)
Endwith


Dynamic web world Maps drived from VFP

Click on code to select [then copy] -click outside to deselect


*5* created on tuesday 13 of december 2017
*create from vfp dom elements(style,canvas,button..)
*colorize countries with gradients and circles.view on apIE.
*can save the result image (snippingtool to embed or print screen key) or capture as previous posts.
*free maps from https://openlayers.org

Declare Integer BringWindowToTop In user32  Integer HWnd
Local m.myvar
TEXT to m.myvar pretext 7 noshow
<!DOCTYPE html>
<html>
  <head>
    <title>Styling feature with CanvasGradient or CanvasPattern</title>
    <link rel="stylesheet" href="https://openlayers.org/en/v4.6.4/css/ol.css" type="text/css">
    <!-- The line below is only needed for old environments like Internet Explorer and Android 4.x -->
    <script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=requestAnimationFrame,Element.prototype.classList,URL"></script>
    <script src="https://openlayers.org/en/v4.6.4/build/ol.js"></script>

  </head>
  <body oncontextmenu="return false;" >
    <div id="map" class="map"></div>
  </body></html>
ENDTEXT
Publi apie
apie =Newobject("internetexplorer.application")
With apie
  .Navigate("about:blank")
  Inke(1)  &&to adapt

  With .Document
    .Open()
    .Write(m.myvar)
    .Close()

    Local m.yst
    TEXT to m.yst pretext 7 textmerge noshow
      #map {     
  background-color: indigo;
  background: linear-gradient(to bottom, blue, indigo 50%, navy); }
      }
    ENDTEXT
    Local m.x,m.t
    m.x = .createElement("STYLE")
    m.t = .createTextNode(m.yst)
    m.x.appendChild(m.t)
    .Head.appendChild(m.x)

    Local m.my
    TEXT to m.my pretext 7 noshow
      var canvas = document.createElement('canvas');
      var context = canvas.getContext('2d');

      // Gradient and pattern are in canvas pixel space, so we adjust for the
      // renderer's pixel ratio
      var pixelRatio = ol.has.DEVICE_PIXEL_RATIO;

      // Generate a rainbow gradient
      function gradient(feature, resolution) {
        var extent = feature.getGeometry().getExtent();
        // Gradient starts on the left edge of each feature, and ends on the right.
        // Coordinate origin is the top-left corner of the extent of the geometry, so
        // we just divide the geometry's extent width by resolution and multiply with
        // pixelRatio to match the renderer's pixel coordinate system.
        var grad = context.createLinearGradient(0, 0,
            ol.extent.getWidth(extent) / resolution * pixelRatio, 0);
        grad.addColorStop(0, 'red');
        grad.addColorStop(1 / 6, 'orange');
        grad.addColorStop(2 / 6, 'yellow');
        grad.addColorStop(3 / 6, 'green');
        grad.addColorStop(4 / 6, 'aqua');
        grad.addColorStop(5 / 6, 'blue');
        grad.addColorStop(1    , 'purple');
        return grad;
      }

      // Generate a canvasPattern with two circles on white background
      var pattern = (function() {
        canvas.width = 11 * pixelRatio;
        canvas.height = 11 * pixelRatio;
        // white background
        context.fillStyle = 'white';
        context.fillRect(0, 0, canvas.width, canvas.height);
        // outer circle
        context.fillStyle = 'rgba(102, 0, 102, 0.5)';
        context.beginPath();
        context.arc(5 * pixelRatio, 5 * pixelRatio, 4 * pixelRatio, 0, 2 * Math.PI);
        context.fill();
        // inner circle
        context.fillStyle = 'rgb(0, 255, 0)';
        context.beginPath();
        context.arc(5 * pixelRatio, 5 * pixelRatio, 2 * pixelRatio, 0, 2 * Math.PI);
        context.fill();
        return context.createPattern(canvas, 'repeat');
      }());

      // Generate style for gradient or pattern fill
      var fill = new ol.style.Fill();
      var style = new ol.style.Style({
        fill: fill,
        stroke: new ol.style.Stroke({
          color: '#333',
          width: 2
        })
      });

      /**
       * The styling function for the vector layer, will return an array of styles
       * which either contains the aboove gradient or pattern.
       *
       * @param {ol.Feature} feature The feature to style.
       * @param {number} resolution Resolution.
       * @return {ol.style.Style} The style to use for the feature.
       */
      var getStackedStyle = function(feature, resolution) {
        var id = feature.getId();
        fill.setColor(id > 'J' ? gradient(feature, resolution) : pattern);
        return style;
      };

      // Create a vector layer that makes use of the style function above…
      var vectorLayer = new ol.layer.Vector({
        source: new ol.source.Vector({
          url: 'https://openlayers.org/en/v4.6.4/examples/data/geojson/countries.geojson',
          format: new ol.format.GeoJSON()
        }),
        style: getStackedStyle
      });

      // … finally create a map with that layer.
      var map = new ol.Map({
        layers: [
          vectorLayer
        ],
        target: 'map',
        view: new ol.View({
          center: ol.proj.fromLonLat([1.0036082,33.6646082]),
          zoom:2
        })
      });

    ENDTEXT


    Local m.script
    m.script = .createElement("script")
    m.script.Type="text/javascript"
    m.script.innerhtml=m.my
    .body.appendChild(m.script)

    *this create dynamically from vfp a button (ybutton) in "map" and fill it with code to exit.
    TEXT to m.myb noshow
<center><button id="yb"  style="margin-top:20px;padding:5px;background-color:cyan;color:red;cursor:pointer;" onclick="window.open('','_self');window.close();" >  Exit  </button></center>
    ENDTEXT
    Local m.ybutton
    m.ybutton=.createElement("ybutton")
    m.ybutton.innerhtml=m.myb
    .getElementbyId("map").appendChild(m.ybutton)


  Endwith
  .fullscreen=1
  BringWindowToTop(.HWnd)
  .Visible=.T.
Endwith



Dynamic web world Maps drived from VFP

                     

Yousfi Benameur


Important:All Codes above are tested on VFP9SP2 & windows 10 pro 64 bits version 1703 ( creator update) & IE11 emulation.

To be informed of the latest articles, subscribe:
Comment on this post