Tooltips
BlitzPlus Forums/BlitzPlus Programming/Tooltips
| ||
Could of sworn I already created this topic... Anyways, is there some userlib out there that will allow you to create tooltips for gadgets? |
| ||
Function CreateTooltip(msg$, x%, y%) MouseXSpeed():MouseYSpeed() buffer% = GraphicsBuffer() SetBuffer DesktopBuffer() Local window = CreateWindow("", x%, y%, StringWidth(msg$) + 6, 20, Desktop(), 16) Local canvas = CreateCanvas(0, 0, ClientWidth(window), ClientHeight(window), window) SetBuffer CanvasBuffer(canvas) While Abs(MouseXSpeed() + MouseYSpeed()) = 0 Color 255, 255, 225 Rect 1, 1, ClientWidth(canvas) - 2, ClientHeight(canvas) - 2 Color 0, 0, 0 Text 3, ClientHeight(canvas) / 2, msg$, False, True FlipCanvas canvas Wend FreeGadget window If buffer% SetBuffer buffer% Else SetBuffer DesktopBuffer() End Function |
| ||
I was looking more towards a fully setup system to check if the cursor was over a gadget, or a defined area.. But I guess I can just modify this.. |
| ||
I know that toolbar's have builtin tooltips, but haven't seen it elsewhere. |
| ||
I did this under 2 hours. Fully functional :) Tooltip Example.bb Tooltips.bb |
| ||
Very good, but sad that the main window blinks |
| ||
Yeah, I'll have to come up with a way to do it without using a window. |
| ||
you can try drawing directly to DesktopBuffer() and before you draw there anything you'll copy the background of it and when you want to remove it then you'll just draw the background on the tooltip. |
| ||
Yeah I figured that would be the best way to go, I'll probably come up with another version of it sometime later next week. |
| ||
Voila! Tooltips.bb Example.bb |
| ||
Super! You should add it to code archives :) |
| ||
I shall :) |