Posted by
| Nick Gammon
Australia (23,046 posts) Bio
Forum Administrator |
Message
| I tested with this alias:
<aliases>
<alias
match="hst"
enabled="y"
send_to="12"
sequence="100"
>
<send>
win = "test_" .. GetPluginID () -- get a unique name, ensure not empty if outside plugin
WindowDelete (win)
WindowCreate (win, 0, 0, 700, 700, miniwin.pos_center_right, 0, ColourNameToRGB("white")) -- create window
WindowShow (win, true) -- show it
size = 5
offset = 6
function mouseover (flags, hotspot_id)
SetStatus ("Over " .. hotspot_id)
end -- mouseover
start = utils.timer ()
for x = 1, 110 do
for y = 1, 110 do
WindowRectOp(win, miniwin.rect_frame, x * offset, y * offset, x * offset + size, y * offset + size, 0)
WindowAddHotspot(win, string.format ("hotspot_x%%d_y%%d", x, y),
x * offset, y * offset, x * offset + size, y * offset + size, -- rectangle
"mouseover",
nil, -- "cancelmouseover",
nil, -- "mousedown",
nil, -- "cancelmousedown",
nil, -- "mouseup",
"Click here for fun times", -- tooltip text
miniwin.cursor_hand, 0) -- hand cursor
end
end
finish = utils.timer ()
print (string.format ("Took %%0.3f seconds to do that", finish - start))
</send>
</alias>
</aliases>
Running that takes around 119 milliseconds:
Took 0.119 seconds to do that
That is deleting and re-creating 12100 hotspots. Doesn't seem to be affected if the mouse is over the miniwindow. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|