[Module] ToolTipEx - Module (all OS)

Applications, Games, Tools, User libs and useful stuff coded in PureBasic
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

[Module] ToolTipEx - Module (all OS)

Post by Thorsten1867 »

Extended ToolTip - Gadget (all OS / 64Bit / DPI)

Thanks to the mk-soft code, ToolTips for gadgets other than the CanvasGadget can now also be displayed.

Improved tooltips for all gadgets.
  • multiline tooltips (#LF$)
  • optional title bar
  • possibility to define an area on the gadget

Code: Select all

; ToolTip::Gadget()       - Add tooltip gadget
; ToolTip::SetAttribute() - similar to SetGadgetAttribute()
; ToolTip::SetColor()     - similar to SetGadgetColor()
; ToolTip::SetContent()   - set tooltip text & title and define tooltip area
; ToolTip::SetFont()      - similar to SetGadgetFont()
; ToolTip::SetState()     - activates/deactivates tooltip
Download: ToolTipExModule.pbi
Last edited by Thorsten1867 on Sat Nov 23, 2019 3:15 pm, edited 1 time in total.
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Re: [Module] ToolTipEx - Module (all OS)

Post by Thorsten1867 »

Update: ToolTip is now a separate window and not just a gadget
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Re: [Module] ToolTipEx - Module (all OS)

Post by Thorsten1867 »

Bugfixes
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
Cyllceaux
Enthusiast
Enthusiast
Posts: 457
Joined: Mon Jun 23, 2014 1:18 pm
Contact:

Re: [Module] ToolTipEx - Module (all OS)

Post by Cyllceaux »

I made some tests with it.

If I close my program, it needs ~1-2 Seconds. I think, its the thread which pause the closing.
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Re: [Module] ToolTipEx - Module (all OS)

Post by Thorsten1867 »

I suppose so, too.
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
Cyllceaux
Enthusiast
Enthusiast
Posts: 457
Joined: Mon Jun 23, 2014 1:18 pm
Contact:

Re: [Module] ToolTipEx - Module (all OS)

Post by Cyllceaux »

Can't create a tooltip in a ContainerEx.
If I try, ContainerEx dies on line 532
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Re: [Module] ToolTipEx - Module (all OS)

Post by Thorsten1867 »

Please check if the problem is fixed.
Important: ToolTipEx must be defined outside the container.
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
User avatar
lgb-this
User
User
Posts: 28
Joined: Sat Aug 30, 2014 9:00 pm
Location: Switzerland
Contact:

Re: [Module] ToolTipEx - Module (all OS)

Post by lgb-this »

PB 5.71 x64, TooltipExModule.pbi 08.12.2019

I see only the last created ToolTip in my example.

Code: Select all

XIncludeFile "TooltipExModule.pbi"

OpenWindow(0, 50, 50, 600, 400, "Test")

SpinGadget(10,20,20,60,20,0,100,#PB_Spin_Numeric|#ES_RIGHT)
SetGadgetState(10,33)
ToolTip::Create(10,0)
ToolTip::SetContent(10,"ToolTip SpinGadget","")

CheckBoxGadget(20,20,50,100,20,"CheckBoxGadget")
ToolTip::Create(20,0)
ToolTip::SetContent(20,"ToolTip CheckBoxGadget","")

StringGadget(30,20,80,120,14,"Test")
GadgetToolTip(30,"StringGadget 30")

Repeat
  EventID = WaitWindowEvent(1) 
Until EventID = #PB_Event_CloseWindow

CloseWindow(0)
I see only the tooltip of the CheckBoxGadget. The tooltip of the SpinGadget is not visible. Why ?
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Re: [Module] ToolTipEx - Module (all OS)

Post by Thorsten1867 »

Bugfixes
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
User avatar
lgb-this
User
User
Posts: 28
Joined: Sat Aug 30, 2014 9:00 pm
Location: Switzerland
Contact:

Re: [Module] ToolTipEx - Module (all OS)

Post by lgb-this »

Thanks for the bugfix. My example-code works fine now.
User avatar
PB_Rainer
User
User
Posts: 80
Joined: Fri Jun 07, 2019 1:56 pm

Re: [Module] ToolTipEx - Module (all OS)

Post by PB_Rainer »

Hi Thorsten,

first, thanks for this great module.

Sorry, but I have a little problem to use it in my program with ImageButtons.

I wrote a procedure to set the different Fonts using in the ToolTip:

Code: Select all

Procedure CreateTT_Mess_Fonts()
	LoadFont(#MyFont_Normal, "Arial", 9, #PB_Font_HighQuality)
  LoadFont(#MyFont_Bold, "Arial", 9, #PB_Font_Bold)
  LoadFont(#MyFont_BoldItalic, "Arial", 10, #PB_Font_Bold | #PB_Font_Italic)
  LoadFont(#MyFont_BoldUnderline, "Arial", 9, #PB_Font_Bold | #PB_Font_Underline)
  LoadFont(#MyFont_BoldItalicUnderline, "Arial", 9, #PB_Font_Bold | #PB_Font_Italic | #PB_Font_Underline)
EndProcedure
I wrote a procedure to create a ToolTip:

Code: Select all

Procedure MakeToolTip(ForGadget.i, ForWindow.i, TT_Image.i, TT_Text.s, TT_Title.s)
	
	If ToolTip::Create(ForGadget, ForWindow)
		ToolTip::SetContent(ForGadget, TT_Text, TT_Title)
		ToolTip::SetFont(ForGadget, #MyFont_BoldItalic, ToolTip::#Title) 
		ToolTip::SetColor(ForGadget, ToolTip::#BorderColor,      $800000)
		ToolTip::SetColor(ForGadget, ToolTip::#BackColor,        $FFFFFA)
		ToolTip::SetColor(ForGadget, ToolTip::#TitleBorderColor, $800000)
		ToolTip::SetColor(ForGadget, ToolTip::#TitleBackColor,   $B48246)
		ToolTip::SetColor(ForGadget, ToolTip::#TitleColor,       $FFFFFF)
		ToolTip::SetFont(ForGadget,  #MyFont_Normal, ToolTip::#Text)
		If TT_Image > 0
			ToolTip::SetImage(ForGadget, TT_Image, #PB_Default, #PB_Default, ToolTip::#Border)
		EndIf
	EndIf	
EndProcedure
I wrote a procedure to create all ToolTips for all gadgets:

Code: Select all

Procedure MakeAllToolTips()
	; 	MainWindow
	MakeToolTip(ButtonImage_OpenDesign, Window_Main, 0, "Load a design as base for a diagonal crossstitch-design.", "Load design")
	MakeToolTip(ButtonImage_Big_Cross, Window_Main, 0, "Select crossstich-size." + #DoubleLF$ + "This is a 9 point crossstitch.", "Big cross-stitch")
	MakeToolTip(ButtonImage_Small_Cross, Window_Main, 0, "Select crossstich-size." + #DoubleLF$ + "This is a 6 point crossstitch.", "Small cross-stitch")
	MakeToolTip(ButtonImage_LongFloatBindings,Window_Main, 0, "Add longfloating and flat bindings to crossstitch-design.", "Add binding points")
	MakeToolTip(ButtonImage_Palette, Window_Main, 0, "Organize color-palette in crosstitch-design.", "Organize palette")
	MakeToolTip(ButtonImage_Save, Window_Main, 0,"Save crossstitch-design.", "Save")
	MakeToolTip(ButtonImage_Print, Window_Main, 0, "Print cross-stitch-design.", "Print")
	MakeToolTip(ButtonImage_Exit, Window_Main, 0, "Exit program.", "Exit")	
	MakeToolTip(Image_OutlineColor, Window_Main, 0, "Right-click here to select color for the outline." + #DoubleLF$ + "Selected color must be totally different from any color" + #LF$ + "used in the design and taped-hem-color!" + #DoubleLF$ + "Left-double-click to use default-color!", "Outline-color")
	MakeToolTip(Image_TapedHemColor, Window_Main, 0, "Right-click here to select color for the taped-hem." + #DoubleLF$ + "Selected color must be totally different from any color" + #LF$ + "used in the design and from outline-color!" + #DoubleLF$ + "Left-double-click to use default-color!", "Taped-hem-color")
	MakeToolTip(Spin_TapedHemWidth, Window_Main, 0, "Setup the width for the taped-hem." + #DoubleLF$ + "Width can be between 20 and 40 pixels.", "Taped-hem-width")
	MakeToolTip(ScrollArea_OriginalDesign,Window_Main, 0, "The original-Design will be shown here." + #LF$ + "The selected zoomfactor is used.", "Original design")
	MakeToolTip(ScrollArea_CrossStitch, Window_Main, 0, "In this area the cross-stitch-design will be shown," + #LF$ + "using the selected zoomfactor.", "Cross-stitch-design")
	MakeToolTip(TrackBar_Zoom, Window_Main, 0, "Select zoomfactor for original-design and cross-stitch-design.", "Zoom")
	; 	Palette
; 	MakeToolTip(ForGadget.i, ForWindow.i, 0, "", "")
; 	MakeToolTip(ForGadget.i, ForWindow.i, 0, "", "")
; 	MakeToolTip(ForGadget.i, ForWindow.i, 0, "", "")
; 	MakeToolTip(ForGadget.i, ForWindow.i, 0, "", "")
; 	MakeToolTip(ForGadget.i, ForWindow.i, 0, "", "")
; 	MakeToolTip(ForGadget.i, ForWindow.i, 0, "", "")
EndProcedure
The eventLoop for all gadgets / ImageButtons is:

Code: Select all

Procedure Window_Main_Events(Event)
  Select Event
    Case #PB_Event_SizeWindow
      ResizeGadgetsWindow_Main()
    Case #PB_Event_CloseWindow
      ProcedureReturn #True

    Case #PB_Event_Menu
      Select EventMenu()
      EndSelect

    Case #PB_Event_Gadget
    	Select EventGadget()
    		Case ButtonImage_OpenDesign
    			ButtonImage_OpenDesign()
    		Case ButtonImage_Big_Cross
    			ButtonImage_Big_Cross()
				Case ButtonImage_Small_Cross
					ButtonImage_Small_Cross()
				Case ButtonImage_LongFloatBindings
					ButtonImage_LongFloatBindings()
				Case ButtonImage_Save
					ButtonImage_Save()	
				Case ButtonImage_Palette
					ButtonImage_Palette()
				Case ButtonImage_Print
					ButtonImage_Print()
				Case TrackBar_Zoom
					CrossStitchDesign_Zoom_TrackBar()
				Case Image_OutlineColor
					If EventType() = #PB_EventType_RightClick
						Image_OutlineColor()
					ElseIf EventType() = #PB_EventType_LeftDoubleClick
						Image_OutlineColorDefault()
					EndIf
				Case Image_TapedHemColor
					If EventType() = #PB_EventType_RightClick
						Image_TapedHemColor()
					ElseIf EventType() = #PB_EventType_LeftDoubleClick
						Image_TapedHemColorDefault()
					EndIf
				Case ButtonImage_Exit
					ButtonImage_Exit()
					ProcedureReturn #True
			EndSelect
  EndSelect
  ProcedureReturn #False
EndProcedure
All this works well when using the ToolTips with an Image, ScrollArea, SpinEdit. But using this ToolTips with an ImageButton it does not work as aspected. Moving the mouse over the ImageButton the ToolTip will not be shown, instead of this the button will be clicked (avtivated) directly 2 times only when hoovered by the mouse!

I searched and tried a lot, but I did not find the mistake.

Thanks in advance for your help and

regards
Rainer
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Re: [Module] ToolTipEx - Module (all OS)

Post by Thorsten1867 »

I'm afraid I need a simple code that will allow me to reproduce the problem.
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
User avatar
PB_Rainer
User
User
Posts: 80
Joined: Fri Jun 07, 2019 1:56 pm

Re: [Module] ToolTipEx - Module (all OS)

Post by PB_Rainer »

Thorsten1867 wrote:I'm afraid I need a simple code that will allow me to reproduce the problem.
Hi Thorsten, where to send the sources?

Its about 1500 lines and som BMP's.

Regards Rainer
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Re: [Module] ToolTipEx - Module (all OS)

Post by Thorsten1867 »

You disabled responses on PM.

Gesendet von meinem Aquaris X2 mit Tapatalk
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
User avatar
PB_Rainer
User
User
Posts: 80
Joined: Fri Jun 07, 2019 1:56 pm

Re: [Module] ToolTipEx - Module (all OS)

Post by PB_Rainer »

Thorsten1867 wrote:You disabled responses on PM.

Gesendet von meinem Aquaris X2 mit Tapatalk
Hi Thorsten, please send pm again. I have changed the settings.

Regards Rainer
Post Reply