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).