Page 1 of 1

open a webpage

PostPosted: Mon Apr 09, 2018 8:04 pm
by Silvio.Falconi
Can I open a webpage into a dialog with style ( .nor. 4) inserted on Main window Not MDI ?

Re: open a webpage

PostPosted: Tue Apr 10, 2018 2:57 am
by Busmatic_wpb
Estimado Silvio.
Lograste por fin darle seguimiento en tiempo real de la flotilla de buses
Mira logre crear seguimiento en tiempo real a la flota de autobuses mira el link, si deses mas informacion te paso como lo hice paso a paso
y podras ponerlo en tu proyecto

http://www.busmaticcr.com/index.php/2-u ... nformacion

Oscar Chacon
http://www.Busmaticcr.com
http://www.Situcr.com

Re: open a webpage

PostPosted: Tue Apr 10, 2018 6:47 am
by Silvio.Falconi
Busmatic_wpb wrote:Estimado Silvio.
Lograste por fin darle seguimiento en tiempo real de la flotilla de buses
Mira logre crear seguimiento en tiempo real a la flota de autobuses mira el link, si deses mas informacion te paso como lo hice paso a paso
y podras ponerlo en tu proyecto

http://www.busmaticcr.com/index.php/2-u ... nformacion

Oscar Chacon
http://www.Busmaticcr.com
http://www.Situcr.com


I'm not interested you dear sir for too long is bothering me with these messages humbly I ask Antonio Linares to do something to the purpose that this gentleman does not bother me anymore

Re: open a webpage

PostPosted: Tue Apr 10, 2018 9:01 am
by Otto
Hello Oscar,
>como lo hice paso a paso
I hope I understand your offer well.
Please post some code here. I am very interested in it.
Thanks in advance
Otto

Re: open a webpage

PostPosted: Tue Apr 10, 2018 2:29 pm
by karinha
https://www.4shared.com/zip/S6DYic1Kca/WEBMAP.html

Code: Select all  Expand view

#Include "FiveWin.ch"

#Define CLR_MENTA      nRGB( 221, 255, 238 )
#Define CLR_HMENTA     nRGB( 000, 128, 000 )

// Ideia original:
// http://www.pctoledo.com.br/forum/viewto ... =1&t=15482
// Special thanks ao autor do topico: Billy1943.  - 01/10/2014
FUNCTION Google_Rua()

   LOCAL oWnd, oActiveX, oFnt, oFont, nKey := VK_RETURN
   LOCAL cEvents := ""
   LOCAL oMapa, mde_uf, mpara_uf, mde_cid, mpara_cid, mde_rua, mpara_rua
   LOCAL oGet1, oGet2, oGet3, oGet4, oBusca, oSaida
   LOCAL nEnde := "", nCid := "", nPais := ""

   TestWebMapFw( nEnde, nCid, nPais )

RETURN NIL

FUNCTION Testwebmapfw( nEnde, nCid, nPais )

   local oDlg, oActiveX, oFnt, oFont
   local aWhatsNear
   Local cStreet, cCity, cCountry
   Local cStreet2, cCity2
   Local cStreet3, cCity3
   Local cStreet4, cCity4
   Local cStreet5, cCity5
   Local cWhatsNear
   Local nZoomLevel

   default cStreet := "AV PAULISTA, 1313", ;
   cCity      := "SAO PAULO", ;
   cCountry   := "BRASIL", ;
   cStreet2   := SPACE( 80 ), ;
   cCity2     := SPACE( 80 ), ;
   cStreet3   := SPACE( 80 ), ;
   cCity3     := SPACE( 80 ), ;
   cStreet4   := SPACE( 80 ), ;
   cCity4     := SPACE( 80 ), ;
   cStreet5   := SPACE( 80 ), ;
   cCity5     := SPACE( 80 )
   cWhatsNear := ''
   nZoomLevel := 0

   aWhatsNear := { ;
      '', ;
      'Hotel', ;
      'Posto de Gasolina', ;
      'Praça de Alimentação', ;
      'Parque', ;
      'Peças e Acessórios de Carros', ;
      'Peças de Caminhões', ;
      'Ferrovias' ;
      }

   SetBalloon( .T. ) // Balloon shape required for tooltips
   SkinButtons()     // Botoes Coloridos nas novas versoes
   SetGetColorFocus( CLR_MENTA )  // COR NO GET - ADD EM: 15/07/2013
   tGet():lDisColors  := .F.
   tGet():nClrTextDis := CLR_BLUE
   tGet():nClrPaneDis := CLR_HRED   //SOFTYELLOW

   DEFINE FONT oFnt    NAME "Ms Sans Serif" SIZE 00, -12 BOLD
   DEFINE FONT oFont   NAME "Ms Sans Serif" SIZE 00, -14 BOLD

   DEFINE DIALOG oDlg RESOURCE "MAP" COLORS CLR_BLACK, CLR_WHITE TRANSPARENT

   oDlg:lHelpIcon := .F.

   REDEFINE GET cStreet ID 200 OF oDlg UPDATE

   REDEFINE GET cCity ID 300 OF oDlg UPDATE

   REDEFINE GET cCountry ID 400 OF oDlg UPDATE

   REDEFINE COMBOBOX cWhatsNear ITEMS aWhatsNear ID 140 OF oDlg UPDATE

   REDEFINE GET cStreet2 ID 202 OF oDlg UPDATE

   REDEFINE GET cCity2   ID 302 OF oDlg UPDATE

   REDEFINE GET cStreet3 ID 203 OF oDlg UPDATE

   REDEFINE GET cCity3   ID 303 OF oDlg UPDATE

   REDEFINE GET cStreet4 ID 204 OF oDlg UPDATE

   REDEFINE GET cCity4   ID 304 OF oDlg UPDATE

   REDEFINE GET cStreet5 ID 205 OF oDlg UPDATE

   REDEFINE GET cCity5   ID 305 OF oDlg UPDATE

   REDEFINE GET nZoomLevel ID 141 OF oDlg UPDATE

   REDEFINE BUTTON ID 1 OF oDlg ;
            ACTION ShowInWin(cStreet,cCity,cCountry,cStreet2,cCity2,cStreet3,cCity3,cStreet4,cCity4,cStreet5,cCity5,cWhatsNear,nZoomLevel)

   REDEFINE BUTTON ID 150 OF oDlg ;
            ACTION ShowFull(cStreet,cCity,cCountry,cStreet2,cCity2,cStreet3,cCity3,cStreet4,cCity4,cStreet5,cCity5,cWhatsNear,nZoomLevel)

   SET FONT OF oDlg TO oFnt

   ACTIVATE DIALOG oDlg CENTERED

   oFnt:End()
   oFont:End()

RETURN NIL

function ShowFull(cStreet,cCity,cCountry,cStreet2,cCity2,cStreet3,cCity3,cStreet4,cCity4,cStreet5,cCity5,cWhatsNear,nZoomLevel)

   local oWnd, oActiveX, oBar
   local cEvents := ""
   local oWebMap

   oWebMap := WebMap():new()
   oWebMap:AddStopSep( cStreet, cCity,,, cCountry )
   // you can format address yourself or just
   // type address string like in google maps
   // using :AddStop() instead of :AddStopSep()
   //
   // oWebMap:AddStop( alltrim( cStreet )+','+;
   //    alltrim( cCity )+' '+alltrim( cCountry ) )
   // or
   // oWebMap:AddStop( 'My Address Info' )
   oWebMap:AddStopSep( cStreet2, cCity2 )
   oWebMap:AddStopSep( cStreet3, cCity3 )
   oWebMap:AddStopSep( cStreet4, cCity4 )
   oWebMap:AddStopSep( cStreet5, cCity5 )

   oWebMap:cWhatsNear := cWhatsNear
   oWebMap:nZoomLevel := nZoomLevel
   oWebMap:GenLink()

   if .not. empty( oWebMap:cLink )

      ShellExecute( 0, "open", oWebMap:cLink,,, 5 )

      // You can also use this for more control
      /*
      oActiveX := TOleAuto():New("InternetExplorer.Application")
      oActiveX:Visible := .T.
      oActiveX:Toolbar := .T.
      oActiveX:Statusbar :=.T.
      oActiveX:MenuBar := .T.
      oActiveX:Navigate( oWebMap:cLink )
      */


      sysrefresh()

   endif

return nil

function ShowInWin(cStreet,cCity,cCountry,cStreet2,cCity2,cStreet3,cCity3,cStreet4,cCity4,cStreet5,cCity5,cWhatsNear,nZoomLevel)

   local oWnd, oActiveX, oBar
   local cEvents := ""
   local oWebMap

   oWebMap := WebMap():new()
   oWebMap:AddStopSep( cStreet, cCity,,, cCountry )
   oWebMap:AddStopSep( cStreet2, cCity2 )
   oWebMap:AddStopSep( cStreet3, cCity3 )
   oWebMap:AddStopSep( cStreet4, cCity4 )
   oWebMap:AddStopSep( cStreet5, cCity5 )
   oWebMap:cWhatsNear := cWhatsNear
   oWebMap:nZoomLevel := nZoomLevel
   oWebMap:GenLink()

   if .not. empty( oWebMap:cLink )

      DEFINE WINDOW oWnd TITLE "Google Map Localização" ;
         FROM 0, 0 TO 600, 800 pixel

      oActiveX = TActiveX():New( oWnd, "Shell.Explorer" )
      // oActiveX = TOleAuto():New("InternetExplorer.Application")

      // oActivex:Silent := .T.  // Para Evitar: Erro de Script na Pagina.

      oWnd:oClient = oActiveX // To fill the entire window surface

      // these setprop options do not work?
      oActiveX:SetProp( "Visible", .T. )
      oActiveX:SetProp( "Toolbar", .T. )
      oActiveX:SetProp( "Statusbar", .T. )
      oActiveX:SetProp( "MenuBar", .F. )

      oActiveX:Do( "Navigate", oWebMap:cLink )
      sysrefresh()
      // MsgInfo( oActiveX:GetProp( "StatusBar" ) )

      ACTIVATE WINDOW oWnd

      sysrefresh()
   endif

return nil

function EventInfo( event, aParams, pParams, oActiveX )

   local cMsg := "Event: " + cValToChar( event ) + CRLF
   local n

   cMsg += "Params: " + CRLF

   for n = 1 to Len( aParams )
      cMsg += cValToChar( aParams[ n ] ) + CRLF
   next

   if event == "BeforeNavigate2"
      //MsgInfo( aParams[ 2 ] )
      //SetEventParam( pParams, 7, .t. ) // Comment this to allow navigation
   endif

return cMsg + CRLF

// #include "FiveWin.ch"

#include "Hbclass.ch"

CREATE CLASS WebMap

   VAR aAddress
   VAR nZoomLevel
   VAR cMapType    // 'MAP' = regular map, 'ROUTE' = route
   VAR oIe
   VAR cLink
   VAR cWhatsNear
   METHOD New
   METHOD AddStop
   METHOD AddStopSep
   METHOD GenLink

END CLASS

METHOD New( xAddress, nZoomLevel )

   if nZoomLevel == nil
      // default to 0 for auto calc size
      ::nZoomLevel := 0
   else
      ::nZoomLevel := nZoomLevel
   endif

   ::cLink := ''
   ::cWhatsNear := ''

   // Initialize address array
   do case
      case xAddress == nil
         ::aAddress := {}
      case valtype( xAddress ) == 'A'
         ::aAddress := xAddress
      otherwise
         ::aAddress := { xAddress }
   endcase

   // if address passed on command line lets auto create link string
   if len( ::aAddress ) > 0
      ::GenLink()
   endif

RETURN( self )

//////////////////////////////////////////
////// Method AddStop
//////////////////////////////////////////
// Purpose - To add a pre-formatted address
//            to ::aAddress
//
METHOD AddStop( cAddress )
   if cAddress != nil
      // convert spaces to +
      aadd( ::aAddress, strtran( trim( cAddress ),' ', '+' ) )
   endif
RETURN nil

//////////////////////////////////////////
////// Method AddStopSep
//////////////////////////////////////////
// Purpose - To add an address to ::aAddress
//           when you have seperate street,
//           city, zip etc that need to be
//           formated into Google Map format
// Note - You can format address yourself or just
//        type address string like in google maps
//        using :AddStop() instead of :AddStopSep()
//
METHOD AddStopSep( cStreet, cCity, cState, cZip, cCountry )
   local cAddr2

   *   default( @cStreet, '' )
   *   default( @cCity, '' )
   *   default( @cState, '' )
   *   default( @cZip, '' )
   *   default( @cCountry, '' )
   DEFAULT cStreet:= ""
   DEFAULT cCity:= ""
   DEFAULT cState:= ""
   DEFAULT cZip:= ""
   DEFAULT cCountry:= ""

   cAddr2 := ltrim( trim( cCity )+' ' )
   cAddr2 += ltrim( trim( cState )+' ' )
   cAddr2 += ltrim( trim( cZip )+' ' )
   cAddr2 += ltrim( trim( cCountry ) )

   if at( ',', cAddr2 ) > 0
      // Remove commas from this portion of address
      cAddr2 := strtran( cAddr2,',', ' ' )
      // Remove extra spaces if any
      cAddr2 := strtran( cAddr2,'  ', ' ' )
   endif

   do case
      case .not. empty( cStreet ) .and. .not. empty( cAddr2 )
         ::AddStop( trim( cStreet)+', '+cAddr2 )
      case empty( cStreet ) .and. .not. empty( cAddr2 )
         ::AddStop( cAddr2 )
      case .not. empty( cStreet ) .and. empty( cAddr2 )
         ::AddStop( trim( cStreet) )
   endcase

RETURN nil

//////////////////////////////////////////
////// Method GenLink
//////////////////////////////////////////
// Purpose - To generate link string that
//           can be passed to Internet Explorer
//           Shell or link string can be emailed
METHOD GenLink()

   local nCounter, nFor

   ::cLink := 'http://maps.google.com/maps?'

   do case
      case len( ::aAddress ) = 0
         // this will just display country map
         ::cMapType := 'MAP'
      case len( ::aAddress ) > 1
         // must be route so update map type
         ::cMapType := 'ROUTE'
      otherwise
         ::cMapType := 'MAP'
   endcase

   for nFor := 1 to len( ::aAddress )
      do case
         case nFor = 1
            if ::cMapType = 'ROUTE'
               ::cLink += 'saddr='+::aAddress[ nFor ]
            else
               // In order to use info near address
               // Must be in map mode and not route mode
               if empty( ::cWhatsNear )
                  ::cLink += 'q='+::aAddress[ nFor ]
               else
                  ::cLink += 'q='+trim(::cWhatsNear)
                  ::cLink += chr(38)+'near='+::aAddress[ nFor ]
               endif
            endif
         case nFor = 2
            ::cLink += chr(38)+'daddr='+::aAddress[ nFor ]
         otherwise
            ::cLink += ',+to:'+::aAddress[ nFor ]
      endcase
   next

   if .not. empty( ::cLink )
      // Extra options.
      // I have commented out some of the ones that are not required
      // ::cLink += chr(38)+'hl=en'
      // ::cLink += chr(38)+'mra=pi'
      // ::cLink += chr(38)+'mrcr=1'
      // ::cLink += chr(38)+'sll=31.244355,-95.99896'
      // ::cLink += chr(38)+'sspn=2.934965,5.108643'
      // ::cLink += chr(38)+'ie=UTF8'
      if ::nZoomLevel > 0
         ::cLink += chr(38)+'z='+ltrim( str( ::nZoomLevel ) )
      endif
      // ::cLink += chr(38)+'om=1'
   endif

RETURN( ::cLink )


// WEBMAP.RC
/*
MAP DIALOG 170, 66, 315, 215
STYLE DS_ABSALIGN | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Google Maps Localização"
FONT 8, "MS Sans Serif"
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
{
 EDITTEXT 200, 8, 17, 302, 12, WS_BORDER | WS_TABSTOP
 EDITTEXT 300, 8, 42, 150, 12, WS_BORDER | WS_TABSTOP
 EDITTEXT 400, 160, 42, 150, 12, WS_BORDER | WS_TABSTOP
 CONTROL "Near", 140, "COMBOBOX", CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 8, 71, 167, 67
 EDITTEXT 141, 189, 71, 22, 12, WS_BORDER | WS_TABSTOP
 DEFPUSHBUTTON "&Mostrar no Navegador", 150, 19, 190, 110, 14
 PUSHBUTTON "Mostrar &Dentro do Sistema", 1, 132, 190, 110, 14
 PUSHBUTTON "&Saida", 2, 245, 190, 50, 14
 EDITTEXT 202, 10, 122, 190, 12, ES_WANTRETURN | WS_BORDER | WS_TABSTOP
 EDITTEXT 302, 209, 122, 100, 12, ES_WANTRETURN | WS_BORDER | WS_TABSTOP
 EDITTEXT 203, 10, 138, 190, 12, WS_BORDER | WS_TABSTOP
 EDITTEXT 303, 209, 138, 100, 12, WS_BORDER | WS_TABSTOP
 EDITTEXT 204, 10, 155, 190, 12, WS_BORDER | WS_TABSTOP
 EDITTEXT 304, 209, 155, 100, 12, WS_BORDER | WS_TABSTOP
 EDITTEXT 205, 10, 171, 189, 12, WS_BORDER | WS_TABSTOP
 EDITTEXT 305, 209, 171, 100, 12, WS_BORDER | WS_TABSTOP
 LTEXT "Endereço e Número", -1, 8, 6, 190, 8
 LTEXT "Cidade ou CEP", -1, 8, 32, 92, 8
 LTEXT "País", -1, 159, 32, 92, 8
 LTEXT "Extras que estão perto do endereço acima", -1, 8, 60, 170, 8
 LTEXT "Para mais direções digite mais endereços", -1, 8, 96, 190, 8
 LTEXT "Endereço e Número", -1, 10, 111, 189, 9
 LTEXT "Cidade ou CEP", -1, 209, 112, 92, 8
 LTEXT "Nível de Zoom ", -1, 189, 60, 100, 8
 LTEXT "0 ou em branco = Melhor Ajuste", -1, 214, 73, 100, 8
}
*/

 

Re: open a webpage

PostPosted: Tue Apr 10, 2018 7:39 pm
by Silvio.Falconi
Dear karinha,
I wish open a webPage into a Dialog havng style nOR( WS_CHILD, 4 ) and this dialog is on window not Mdi
or
the webpage must be load into the Main window not Mdi

I Know well How load a webpage ( I open regulkar webpage into window mdi ( oWndclient) but I need a particular situation . I need to open a webpage into a Mainwindow Not Mdi

Dear Otto,
A long time ago I was looking for an example program to create a ticket office for a fleet of buses and the gentleman who calls himself Oscar Chacon for a long time promises to send me sources that I have never seen and received and in every message I put in forum he writes the same thing and not responding to the topic of the treaty on the forum that I have opened.

I'm tired of being taken for a ride by people who only waste time and nothing else

Re: open a webpage

PostPosted: Tue Apr 10, 2018 7:57 pm
by karinha
OK.

Sorry, I do not understand your question.

Sorry, I do not have anything like that.

Re: open a webpage

PostPosted: Tue Apr 10, 2018 9:57 pm
by Busmatic_wpb
Muy respetable Señor Silvio.
Se le agradece su comentario.

Si compartir en Foro Fivetech nuestros codigos y enviarle una ayuda acorde a lo que usted una vez publico es algo que lo molesta pues se le pide diculpas, pero creo que este foro es abierto y todos estamos aqui para ayudarnos mutamente. Si usted es una persona delicada a que se comparta los que los demas hacen, pues bueno que lo publique como lo ha hecho conmigo que se lo agratadezco por su sinceridad.

En los años que llevo en este foro todas las personas han sido amables y hemos sido parte del crecimiento de una familia muy grande que es FW que afinal esta comunidad se ha destacado por el respeto en comun entre todos. Si tratar de compartir lo que algunos buscan o postean es molestar creo entonces que el que esta MAL soy YO.

Pero bueno estimado nunca le he faltado a usted el respeto y por tratar compartir un poco de codigo con usted .Yo nunca he fraternizado o sociabilizado como ustded lo dije antes. Pero bueno se le agradece profundamente su sinceridad.

/PSD
Si le envie los archivos que habia hablado con usted y tambien te envie una invitacion de google drive donde estaba el proyecto completo de 8 MEGAS y de echo todavia esta el subdirectorio donde los desposite. Pero eran demaciados archivos para compartirlos en este medio que creo que no era lo correcto.
Oscar Chacon
http://WWW.SITUCR.COM

Re: open a webpage

PostPosted: Tue Apr 10, 2018 10:15 pm
by Busmatic_wpb
Mr. Otto You understood perfectly.
I will send a invitation Google drive to download btkserver.zip
Send me an email to busmatic@gmail.com I'll give you the files you need to see in real time the units that have a GPS. First to go giving a preliminary something is used 4 files with the Firefox browser because it is one of some that can load .xml files from Local PC.
 
These are :

SitUserver.htm is a web page, which is the file that you open with a browser like Mozilla Firefox, I recommend.

SitUserver.css is a stylesheet, used to define how to display images and texts, only for formats.

SitUserver.js is JavaScript, this is where the source code is.

Basically what it does is look for a SitUServer_RT.xml file every 30 seconds and load the positions and data of each bus from there to show it in Google Maps.

Now I mean the XML file is very easy. You just have to generate a text file with a content like the one I show you and save it with an XML extension

The other thing is you can create this file of labels with the data of the cars or units.

Oscar Chacon.
http://www.SITU.COM

Re: open a webpage

PostPosted: Wed Apr 11, 2018 9:37 am
by Silvio.Falconi
I could never see a program of your bus prg
It is not true absolutely nothing dear Sir Oscar has also sent to my email the promise that you would send your source but never sent anything except once a file in exe format that could not even open because it gave error, so dear Mr. Oscar avoids to talk about crap.