BindMapGadget and SetActiveGadget(-1) workaround, and new screenshot
This commit is contained in:
33
PBMap.pb
33
PBMap.pb
@@ -51,6 +51,7 @@ DeclareModule PBMap
|
|||||||
Declare SaveOptions(PreferencesFile.s = "PBMap.prefs")
|
Declare SaveOptions(PreferencesFile.s = "PBMap.prefs")
|
||||||
Declare.i AddMapServerLayer(LayerName.s, Order.i, ServerURL.s = "http://tile.openstreetmap.org/", TileSize = 256, ZoomMin = 0, ZoomMax = 18)
|
Declare.i AddMapServerLayer(LayerName.s, Order.i, ServerURL.s = "http://tile.openstreetmap.org/", TileSize = 256, ZoomMin = 0, ZoomMax = 18)
|
||||||
Declare DeleteLayer(Nb.i)
|
Declare DeleteLayer(Nb.i)
|
||||||
|
Declare BindMapGadget(Gadget.i)
|
||||||
Declare MapGadget(Gadget.i, X.i, Y.i, Width.i, Height.i)
|
Declare MapGadget(Gadget.i, X.i, Y.i, Width.i, Height.i)
|
||||||
Declare SetLocation(latitude.d, longitude.d, Zoom = -1, mode.i = #PB_Absolute)
|
Declare SetLocation(latitude.d, longitude.d, Zoom = -1, mode.i = #PB_Absolute)
|
||||||
Declare Drawing()
|
Declare Drawing()
|
||||||
@@ -1804,8 +1805,7 @@ Module PBMap
|
|||||||
MyDebug( JSONErrorMessage() + " at position " +
|
MyDebug( JSONErrorMessage() + " at position " +
|
||||||
JSONErrorPosition() + " in line " +
|
JSONErrorPosition() + " in line " +
|
||||||
JSONErrorLine() + " of JSON web Data", 1)
|
JSONErrorLine() + " of JSON web Data", 1)
|
||||||
EndIf
|
ElseIf JSONArraySize(JSONValue(0)) > 0
|
||||||
If JSONArraySize(JSONValue(0)) > 0
|
|
||||||
Protected object_val = GetJSONElement(JSONValue(0), 0)
|
Protected object_val = GetJSONElement(JSONValue(0), 0)
|
||||||
Protected object_box = GetJSONMember(object_val, "boundingbox")
|
Protected object_box = GetJSONMember(object_val, "boundingbox")
|
||||||
Protected bbox.BoundingBox
|
Protected bbox.BoundingBox
|
||||||
@@ -2053,6 +2053,15 @@ Module PBMap
|
|||||||
EndIf
|
EndIf
|
||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
|
; Could be called directly to attach our map to an existing canvas
|
||||||
|
Procedure BindMapGadget(Gadget.i)
|
||||||
|
PBMap\Gadget = Gadget
|
||||||
|
BindGadgetEvent(PBMap\Gadget, @CanvasEvents())
|
||||||
|
AddWindowTimer(PBMap\Window, PBMap\Timer, PBMap\Options\TimerInterval)
|
||||||
|
BindEvent(#PB_Event_Timer, @TimerEvents())
|
||||||
|
EndProcedure
|
||||||
|
|
||||||
|
; Creates a canvas and attach our map
|
||||||
Procedure MapGadget(Gadget.i, X.i, Y.i, Width.i, Height.i)
|
Procedure MapGadget(Gadget.i, X.i, Y.i, Width.i, Height.i)
|
||||||
If Gadget = #PB_Any
|
If Gadget = #PB_Any
|
||||||
PBMap\Gadget = CanvasGadget(PBMap\Gadget, X, Y, Width, Height, #PB_Canvas_Keyboard) ;#PB_Canvas_Keyboard has to be set for mousewheel to work on windows
|
PBMap\Gadget = CanvasGadget(PBMap\Gadget, X, Y, Width, Height, #PB_Canvas_Keyboard) ;#PB_Canvas_Keyboard has to be set for mousewheel to work on windows
|
||||||
@@ -2060,9 +2069,7 @@ Module PBMap
|
|||||||
PBMap\Gadget = Gadget
|
PBMap\Gadget = Gadget
|
||||||
CanvasGadget(PBMap\Gadget, X, Y, Width, Height, #PB_Canvas_Keyboard)
|
CanvasGadget(PBMap\Gadget, X, Y, Width, Height, #PB_Canvas_Keyboard)
|
||||||
EndIf
|
EndIf
|
||||||
BindGadgetEvent(PBMap\Gadget, @CanvasEvents())
|
BindMapGadget(PBMap\Gadget)
|
||||||
AddWindowTimer(PBMap\Window, PBMap\Timer, PBMap\Options\TimerInterval)
|
|
||||||
BindEvent(#PB_Event_Timer, @TimerEvents())
|
|
||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
Procedure InitPBMap(Window)
|
Procedure InitPBMap(Window)
|
||||||
@@ -2209,6 +2216,14 @@ CompilerIf #PB_Compiler_IsMainFile
|
|||||||
StringGadget(#StringGeoLocationQuery, 530, 450, 150, 20, "")
|
StringGadget(#StringGeoLocationQuery, 530, 450, 150, 20, "")
|
||||||
SetActiveGadget(#StringGeoLocationQuery)
|
SetActiveGadget(#StringGeoLocationQuery)
|
||||||
AddKeyboardShortcut(#Window_0, #PB_Shortcut_Return, 1)
|
AddKeyboardShortcut(#Window_0, #PB_Shortcut_Return, 1)
|
||||||
|
;*** TODO : code to remove when the SetActiveGadget(-1) will be fixed
|
||||||
|
CompilerIf #PB_Compiler_OS = #PB_OS_Linux
|
||||||
|
define Dummy = ButtonGadget(#PB_Any, 0, 0, 1, 1, "Dummy")
|
||||||
|
HideGadget(Dummy, 1)
|
||||||
|
CompilerElse
|
||||||
|
Define Dummy = -1
|
||||||
|
CompilerEndIf
|
||||||
|
;***
|
||||||
|
|
||||||
Define Event.i, Gadget.i, Quit.b = #False
|
Define Event.i, Gadget.i, Quit.b = #False
|
||||||
Define pfValue.d
|
Define pfValue.d
|
||||||
@@ -2301,7 +2316,9 @@ CompilerIf #PB_Compiler_IsMainFile
|
|||||||
Case #PB_Event_Menu
|
Case #PB_Event_Menu
|
||||||
Select EventMenu()
|
Select EventMenu()
|
||||||
Case 1
|
Case 1
|
||||||
SetActiveGadget(-1)
|
;*** TODO : code to change when the SetActiveGadget(-1) will be fixed
|
||||||
|
SetActiveGadget(Dummy)
|
||||||
|
;***
|
||||||
EndSelect
|
EndSelect
|
||||||
EndSelect
|
EndSelect
|
||||||
Until Quit = #True
|
Until Quit = #True
|
||||||
@@ -2312,8 +2329,8 @@ CompilerIf #PB_Compiler_IsMainFile
|
|||||||
CompilerEndIf
|
CompilerEndIf
|
||||||
|
|
||||||
; IDE Options = PureBasic 5.50 (Windows - x64)
|
; IDE Options = PureBasic 5.50 (Windows - x64)
|
||||||
; CursorPosition = 1156
|
; CursorPosition = 57
|
||||||
; FirstLine = 1144
|
; FirstLine = 48
|
||||||
; Folding = ----------------
|
; Folding = ----------------
|
||||||
; EnableThread
|
; EnableThread
|
||||||
; EnableXP
|
; EnableXP
|
BIN
screenshot.png
BIN
screenshot.png
Binary file not shown.
Before Width: | Height: | Size: 374 KiB After Width: | Height: | Size: 286 KiB |
Reference in New Issue
Block a user