User Tools

Site Tools


tooltips_20on_20the_20main_20output_20window

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
tooltips_20on_20the_20main_20output_20window [2018/03/31 13:19] – external edit 127.0.0.1tooltips_20on_20the_20main_20output_20window [2024/01/05 00:21] (current) – external edit 127.0.0.1
Line 1: Line 1:
 =====Tooltips on the main output window===== =====Tooltips on the main output window=====
  
-//by Richard Russell, May 2009//\\ \\ **Tooltips** (helpful information displayed in a small box when you 'hover' the mouse over a certain region) are usually associated with [[http://www.bbcbasic.co.uk/bbcwin/manual/bbcwing.html#addtooltips|toolbars]], [[/Adding%20tooltips%20to%20the%20status%20bar|status bars]], [[/Adding%20tooltips%20to%20a%20dialogue%20box|dialogue boxes]] or other Windows controls, and information on such uses can be found at the linked pages. However it is also possible to display tooltips on your main output window.\\ \\  To do this you first need to perform some declarations and initialisation:\\ \\ +//by Richard Russell, May 2009//\\ \\ **Tooltips** (helpful information displayed in a small box when you 'hover' the mouse over a certain region) are usually associated with [[http://www.bbcbasic.co.uk/bbcwin/manual/bbcwing.html#addtooltips|toolbars]], [[/Adding%20tooltips%20to%20the%20status%20bar|status bars]], [[/Adding%20tooltips%20to%20a%20dialogue%20box|dialogue boxes]] or other Windows controls, and information on such uses can be found at the linked pages. However it is also possible to display tooltips on your main output window.\\ \\  To do this you first need to perform some declarations and initialisation: 
 + 
 +<code bb4w>
         INSTALL @lib$+"WINLIB5"         INSTALL @lib$+"WINLIB5"
  
Line 27: Line 29:
         SYS "SetWindowPos", hwndTT%, HWND_TOPMOST, 0, 0, 0, 0, \         SYS "SetWindowPos", hwndTT%, HWND_TOPMOST, 0, 0, 0, 0, \
         \                   SWP_NOMOVE OR SWP_NOSIZE OR SWP_NOACTIVATE         \                   SWP_NOMOVE OR SWP_NOSIZE OR SWP_NOACTIVATE
-Each tool is associated with a rectangular region of the window; when the user hovers the mouse over that region the tooltip will be displayed:\\ \\ +</code> 
 + 
 +Each tool is associated with a rectangular region of the window; when the user hovers the mouse over that region the tooltip will be displayed: 
 + 
 +<code bb4w>
         tip$ = "This is a demo tooltip"+CHR$0         tip$ = "This is a demo tooltip"+CHR$0
         ti.cbSize% = DIM(ti{})         ti.cbSize% = DIM(ti{})
Line 38: Line 44:
         ti.lpszText% = !^tip$         ti.lpszText% = !^tip$
         SYS "SendMessage", hwndTT%, TTM_ADDTOOL, 0, ti{}         SYS "SendMessage", hwndTT%, TTM_ADDTOOL, 0, ti{}
-Here **left%**, **right%**, **top%** and **bottom%** define the rectangle associated with the tooltip; the coordinates are pixels with respect to the top left-hand corner of the window (client area).\\ \\  If you have more than one region in which you wish a tooltip to be displayed, you can either create multiple tools by duplicating the above code (with a different rectangle and string) or you can dynamically modify the rectangle and string, as follows:\\ \\ +</code> 
 + 
 +Here **left%**, **right%**, **top%** and **bottom%** define the rectangle associated with the tooltip; the coordinates are pixels with respect to the top left-hand corner of the window (client area).\\ \\  If you have more than one region in which you wish a tooltip to be displayed, you can either create multiple tools by duplicating the above code (with a different rectangle and string) or you can dynamically modify the rectangle and string, as follows: 
 + 
 +<code bb4w>
         newtip$ = "This is a new tooltip" + CHR$0         newtip$ = "This is a new tooltip" + CHR$0
         ti.lpszText% = !^newtip$         ti.lpszText% = !^newtip$
Line 47: Line 57:
         SYS "SendMessage", hwndTT%, TTM_UPDATETIPTEXT, 0, ti{}         SYS "SendMessage", hwndTT%, TTM_UPDATETIPTEXT, 0, ti{}
         SYS "SendMessage", hwndTT%, TTM_NEWTOOLRECT, 0, ti{}         SYS "SendMessage", hwndTT%, TTM_NEWTOOLRECT, 0, ti{}
-You will need to update the rectangle and tip text when the mouse enters the region of interest. This approach is more appropriate when there are a large number of different tooltip rectangles.\\ \\  On exit from your program the tooltip window should be closed:\\ \\ +</code> 
 + 
 +You will need to update the rectangle and tip text when the mouse enters the region of interest. This approach is more appropriate when there are a large number of different tooltip rectangles.\\ \\  On exit from your program the tooltip window should be closed: 
 + 
 +<code bb4w>
         hwndTT% += 0 : IF hwndTT% PROC_closewindow(hwndTT%) : hwndTT% = 0         hwndTT% += 0 : IF hwndTT% PROC_closewindow(hwndTT%) : hwndTT% = 0
-This code can most usefully be placed in a 'cleanup' routine called whenever your program terminates, including from the **ON CLOSE** and **ON ERROR** handlers.\\ \\  +</code> 
-===== __Important note__ ===== + 
- If your program also calls routines in the **WINLIB**, **WINLIB3**, **WINLIB5** or **MDILIB** libraries (in particular, routines which involve //subclassing// the main output window), you must ensure that the following versions (or later) of those libraries are used:\\ \\ +This code can most usefully be placed in a 'cleanup' routine called whenever your program terminates, including from the **ON CLOSE** and **ON ERROR** handlers. 
 + 
 +===== Important note ===== 
 + 
 +If your program also calls routines in the **WINLIB**, **WINLIB3**, **WINLIB5** or **MDILIB** libraries (in particular, routines which involve //subclassing// the main output window), you must ensure that the following versions (or later) of those libraries are used:
  
 | WINLIB.BBC\\ | Version 2.1\\ | | WINLIB.BBC\\ | Version 2.1\\ |
Line 58: Line 76:
 | WINLIB5A.BBC\\ | Version 1.7\\ | | WINLIB5A.BBC\\ | Version 1.7\\ |
 | MDILIB.BBC\\ | Version 1.4\\ | | MDILIB.BBC\\ | Version 1.4\\ |
 +
tooltips_20on_20the_20main_20output_20window.1522502386.txt.gz · Last modified: 2024/01/05 00:16 (external edit)