Hello.
I have questions again … I have a lot of them, but I will solve them gradually.
I need to disabled ZoomIn and ZoomOut of the map.
By default, zoom is available on the mouse wheel and keyboard Ctrl +
How can I make sure that after reaching a certain scale Map1.CurrentScale zoom could be disabled everywhere in ZoomBar and on hot keys?
I saw a similar topic, but did not quite understand … maybe there the author solved other problems.
When using ZoomBar … ZoomBarMaxZoom works correctly, but ZoomBarMinZoom is not applied. Which is also not clear.
Can you tell me something?
Nothing happens. ZoomBarMaxZoom is applied, and the value ZoomBarMinZoom remains the same.
But even if it works… it’s all the same to act only on the ZoomBar? The mouse wheel will still work, I understand? Map events I found, here is a sample code:
… OnExtentsChanged;
{
if EzMap1.CurrentScale < 1200 then
EzMap1.DISABLEZOOM = True
}
This is a very interesting solution, but gives an error inside MapWinGIS: not enough resources to complete the operation.
The restriction works on the contrary:
… OnExtentsChanged;
{
if EzMap1.CurrentScale > 1200 then
EzMap1.CurrentScale = 1200
}
but the event is called every time the mouse wheel moves and the map does not behave beautifully… shivers, and shifts every time.
The short answer is that the map does not natively support this. Ideally it would be handled internally so that you don’t have the side affects of adjusting the scale AFTER it has already gone beyond your limit. We could add it as an enhancement request. Map.MinAllowedScale, Map.MaxAllowedScale
I went back and looked at some old VB6 code and I had handled it using similar code to above, but also incorporating a flag. As I’m sure you realize, by re-setting the scale in the handler, it generates another ExtentsChanged event, and you risk a looping echo affect.
I had used a flag to prevent the re-execution of the ExtentsChanged event. There was a bit more to it, so I can’t display the whole of it, but you may be able to try something like:
private boolean ResettingScale = False
… OnExtentsChanged;
{
if not ResettingScale then
{
if EzMap1.CurrentScale < 1200 then
{
ResettingScale = True
EzMap1.CurrentScale = 1200
}
}
else
{
ResettingScale = False
}
}