T13856

FitAll AddIn Glitch

Discussion created by T13856 on Apr 11, 2012
Latest reply on Apr 11, 2012 by andreas

I created an AddIn that sets the zoom of a display to "FitAll" upon activation as well as double click on blank space.

 

here is my code:

 
Dim WithEvents PBapp As PBObjLib.Application
Dim WithEvents PBdisplay As PBObjLib.Display

Private Sub PBapp_DisplayActivate(ByVal aDisplay As PBObjLib.Display) Handles PBapp.DisplayActivate
        Try

            PBdisplay = CType(aDisplay, PBObjLib.Display)

            PBdisplay.Zoom = "FitAll"
            
        Catch ex As Exception
            MsgBox("Exception on Display Activate : " & ex.Message)
        End Try
End Sub

Private Sub PBdisplay_BeforeDoubleClick(ByRef bCancelDefault As Boolean, ByVal lvarX As Integer, ByVal lvarY As Integer) Handles PBdisplay.BeforeDoubleClick
        Try

            If PBdisplay.SelectedSymbols.Count = 0 Then

                PBdisplay.Zoom = "FitAll"

            End If

        Catch ex As Exception
            MsgBox("Exception on Display Double Click : " & ex.Message)
        End Try
End Sub

 

 

 

 

However there are a series of issues with this:

 

1. The first time a dislay is opened from a PIW the zoom does not get set to "FitAll" it goes to something like 25%.

 

2. If you double click on the display the zoom is set to "FitAll" but the text contained withina trend becomes very small

 

3. If that display is shut down and then another display is opened (or the same one again) the display opens and the zoom gets set to "FitAll" and the text is unnaffected. The addin works the way it should.

 

Does anybody know why these errors are occurring? Any help on making this work properly would be greatly appreciated

Outcomes