Any way to enable/disable tooltips?

Well I have no idea why you were having trouble. It took me 8 minutes to mock something up that works…

Download

So there’s two ways to use this. The first is to just make sure you call TooltipHelper.SetupTooltips in the Open/Opening event of your windows. The other way would be to use the Window/DesktopWindow subclasses that are in the project and then make your windows subclasses of those.

From then on, you can just do this:

Self.TooltipsEnabled = False // from within the window
Window1.TooltipsEnabled = True // from outside the window

The instantiation of the Tips dictionary is explained, you did it in the first call to the helper, I was unsure whether that would stay in scope once the helper is exited but I guess it does? Because after the snytax sugar is removed the helper is really just a method belonging to the window?

The rest of yours is very similar to mine in every important way. Except when in mine:

“ToolTipsEnable(Extends w As Window, Assigns value As Boolean)”

Results in the compile time error:

“This method extends class Window, but the base expression is Window1.Window1.”

Your exhaustive example (a big thanks for that!) shows me my other mistake, that I could not decode from the compile error. The super for Window1 is DesktopWindow, so I have to extend DesktopWindow. The code base I am modifying is couple of years old and was recently auto-converted to UI v2. If the compile message could have been “but the base expression is DesktopWindow”, then I might not have needed the magic decoder ring.

In your code, did you maybe refer to Window1 from within itself as Window1? That can cause weird things like this when implicit instances are turned on.

No, within the window it was referred to with Me. Outside as Window1. In both cases, the same compiler error.

I made my own Method long time ago. I’m a hobbyst and it may not be the bettest way to do that.
In every windows I have a Method:

Public Sub AffMasqHelpTag(CeCtrlNomId as String, CeCtrlHlpTg as String)
  
  Static MemRctCtrlNomHlpTgTxt(-1) as String ' Même Method partout
  
  MemRctCtrlNomHlpTgTxt = CmAffMasqHelpTag(Self, MemRctCtrlNomHlpTgTxt, CeCtrlNomId, CeCtrlHlpTg)
  
End Sub

I every projects I have an alias of the same Module which contains all the shares Methods.And the Method for Hide/Show ToolTips is:

Public Function CmAffMasqHelpTag(CetteFenetr as DesktopWindow, CeTab() as String, CeCtrlNomId as String, CeCtrlHlpTg as String) As String()
  
  Dim iNbre, TampNbre as Int16 ' Même Method partout
  Dim TampNom, TpTab(-1) as String ' Envoyer  RectControl.Name  avec éventuellement son  Index  (si tableau de RadioButton par exemple) pour ne mettre que lui à jour
  Dim CeCtrl as DesktopControl '               Exemple : AffMasqHelpTag(StaticTextNbSpam.Name, "TextDuHelpTag")
  Dim CeRectCtrl as DesktopUIControl '            ou si index 1 : AffMasqHelpTag(StaticTextNbSpam.Name + "1", "TextDuHelpTag") ' ou  + str(index)
  
  If CeTab.LastIndex = -1 Then
    #If DebugBuild Then
      If not((CeCtrlNomId = "") and (CeCtrlHlpTg = "")) Then MessageBox "Tu t'es gourré Tom, CeCtrlNomId et CeCtrlHlpTg devraient être vide '' !" + EndOfLine + "'" + CeCtrlNomId + "'" + EndOfLine + "'" + CeCtrlHlpTg + "'"
    #EndIf
    For Each CeCtrl in CetteFenetr.Controls
      ' MessageBox CeCtrl.Name + EndOfLine + str(CeCtrl.Index) + EndOfLine + "DesktopUIControl ? : " + CStr(CeCtrl isa DesktopUIControl)
      If CeCtrl isa DesktopUIControl Then
        CeRectCtrl = DesktopUIControl(CeCtrl) ' Et NON RectControl(iNbre)
        TampNom = CeCtrl.Name
        #If DebugBuild Then
          If (not(CeRectCtrl.Index = CeCtrl.Index) and (CeRectCtrl.Name = TampNom)) Then MessageBox "Bizarre Tom, RectCtrl.Index ≠ Ctrl.Index :" + EndOfLine + str(CeRectCtrl.Index) + " ≠ " + str(CeCtrl.Index) + EndOfLine + "RectCtrl.Name ≠ Ctrl.Name :" + EndOfLine + str(CeRectCtrl.Name) + " ≠ " + str(TampNom)
        #EndIf
        If CeCtrl.Index > -1 Then TampNom = TampNom + str(CeCtrl.Index) ' ATTENTION Int32, si pas un tableau de control alors = -2147483648
        ' MessageBox " id = " + str(CeCtrl.Index) + " = " + str(CeRectCtrl.Index) + EndOfLine + TampNom
        TpTab.Add TampNom
        CeTab.Add CeRectCtrl.Tooltip ' On mémorise qu'il y en ait ou non
        If not AffHelpTag Then CeRectCtrl.Tooltip = "" ' Si à Vrai alors l'HelpTag reste à sa valeur
      End If ' RectControl
    Next CeCtrl
    TampNbre = TpTab.LastIndex
    For iNbre = 0 to TampNbre
      CeTab.Add TpTab(iNbre)
    Next iNbre '  CeTab  contient tous les HelpTags suivis de tous les noms des Controls
    
  Else ' On les a déjà mémorisés
    TampNbre = (CeTab.LastIndex + 1) / 2
    #If DebugBuild Then
      If not((TampNbre * 2) = (CeTab.LastIndex + 1)) Then MessageBox "Debug, CmAffMasqHelpTag :" + EndOfLine + "Il doit y avoir un nombre paire d'élements dans le tableau, TampNbre = " + str(TampNbre)
    #EndIf
    For Each CeCtrl in CetteFenetr.Controls
      ' MessageBox CeCtrl.Name + EndOfLine + str(CeCtrl.Index) + EndOfLine + "RectControl ? : " + CStr(CeCtrl isa RectControl)
      If CeCtrl isa DesktopUIControl Then
        CeRectCtrl = DesktopUIControl(CeCtrl) ' Et NON RectControl(iNbre)
        ' MessageBox str(CeRectCtrl.Index) + " = " + EndOfLine + str(CeCtrl.Index) + EndOfLine + CeRectCtrl.Name + EndOfLine + CeRectCtrl.Tooltip
        TampNom = CeCtrl.Name
        #If DebugBuild Then
          If (not(CeRectCtrl.Index = CeCtrl.Index) and (CeRectCtrl.Name = TampNom)) Then MessageBox "Bizarre Tom, RectCtrl.Index ≠ Ctrl.Index :" + EndOfLine + str(CeRectCtrl.Index) + " ≠ " + str(CeCtrl.Index) + EndOfLine + "RectCtrl.Name ≠ Ctrl.Name :" + EndOfLine + str(CeRectCtrl.Name) + " ≠ " + str(TampNom)
        #EndIf
        If CeCtrl.Index > -1 Then TampNom = TampNom + str(CeCtrl.Index) ' ATTENTION Int32, si pas un tableau de control alors = -2147483648
        ' MessageBox " id = " + str(CeCtrl.Index) + " = " + str(CeRectCtrl.Index) + EndOfLine + TampNom
        If CeCtrlNomId = "" Then ' On applique à tous
          If AffHelpTag Then
            iNbre = CeTab.IndexOf(TampNom, TampNbre) - TampNbre
            If iNbre > -1 Then ' Sinon  IndexOf  retourne -1 donc = -1 - TampNbre
              ' MessageBox TampNom + EndOfLine + "iNbre = " + str(iNbre)
              CeRectCtrl.Tooltip = CeTab(iNbre) ' S'il n'y en avait pas ça reste à ""
            Else
              #If DebugBuild Then ' On aura l'alerte pour  LabBlockUI  puisqu'on aura pas forcément créé  LabBlockUI(1)  au moment de la mémorisation des HelpTags
                If not(TampNom.Left(10) = "LabBlockUI") Then MessageBox "Bizarre Tom, AffMasqHelpTag. On n'a pas trouvé '" + TampNom + "'" + EndOfLine + "iNbre = -1"
              #EndIf
            End If
          Else
            CeRectCtrl.Tooltip = ""
          End If
        ElseIf CeCtrlNomId = TampNom Then ' On applique qu'à lui
          iNbre = CeTab.IndexOf(TampNom, TampNbre) - TampNbre ' ou CeCtrlNomId
          If iNbre > -1 Then ' Sinon  IndexOf  retourne -1 donc = -1 - TampNbre
            ' MessageBox CeCtrlNomId + EndOfLine + "iNbre = " + str(iNbre)
            CeTab(iNbre) = CeCtrlHlpTg ' On met à jour la mémoire du helptag
            If AffHelpTag Then
              CeRectCtrl.Tooltip = CeCtrlHlpTg ' On met à jour le helptag lui-même
            Else
              If not(CeRectCtrl.Tooltip = "") Then MessageBox "Error ! Please contact the authors, AffMasqHelpTag :" + EndOfLine + CeCtrlNomId + "' helptag should be empty '' :" + EndOfLine + "'" + CeRectCtrl.Tooltip + "'"
            End If
          Else
            MessageBox "Error ! Please contact the authors, AffMasqHelpTag :" + EndOfLine + CeCtrlNomId + EndOfLine + "iNbre = -1"
          End If
        End If ' On applique à tous
      End If ' RectControl
    Next CeCtrl
    
  End If ' CeTab.LastIndex = -1
  
  Return CeTab
  
End Function

I added the possibility to modify a single control passing CeCtrlNomId as String, CeCtrlHlpTg as String but I don’t think I use it. It is a shared Method do if I have to modify it, I don’t have to correct all my windows in all my projects.

You can downloaf my source code on my webpage, you can have a look in “ScreenCaptCoord” , you have to download the shared Method “Zx_External”. The two folders have to be placed in the same parent folder as explain here. (I think you know but if others persons read this forum, I prefer explain).