[Gambas-user] MapView "Proxy" Property override

Benoît Minisini g4mba5 at gmail.com
Tue Feb 12 15:51:18 CET 2019


Le 12/02/2019 à 15:21, gen braga a écrit :
> Things become easier with example code :-D
> 
> Attached modified sources only, from gb.map . Everything else from Git.
> 
> Problem is in MapView.class, line 19:
> 
> Property Read Proxy1 As Proxy
> 
> should be something like:
> 
> Property Read Proxy As _Proxy
> 
> but I get an override error...
> 
> Gen.
> 

Ha, sorry I forgot the Proxy property inherited from UserControl...

I suggest you add the Proxy property to the Map class instead. Something 
like that:

--8<--------------------------------------------------

' Map.class

Public _Proxy as _MapProxy

Property Read Proxy As _MapProxy

Private Sub Proxy_Read() as _MapProxy

   If Not _Proxy Yhen _Proxy = New _MapProxy
   Return _Proxy

End

' _MapProxy.class

Public Auth As Integer
Public Host As String
Public Password As String
Public Type As Integer
Public User As String

' _MapLayer.class

Public Sub _new(Optional CacheName As String)

   ...

   For I = 0 To $aClients.Max
     hClient = New HttpClient As "Client"
     ...
     With GetMap()
       If ._Proxy Then
         hClient.Proxy.Auth = ._Proxy.Auth
         hClient.Proxy.Host = ._Proxy.Host
         ' ... and so on
      Endif
   Next

End

--8<--------------------------------------------------

@Fabien: why do _get() and _next() return Object instead of _MapLayer?

-- 
Benoît Minisini


More information about the User mailing list