Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Message
| You have put things in a really weird order. These lines:
local font_height = WindowFontInfo (win, font, 1)
local max_width = WindowTextWidth (win, font, "Report")
local window_width = max_width + 10
local window_height = font_height * (#report + 2) + 10
-- make window correct size
tprint(windowinfo)
--WindowCreate (win,
-- windowinfo.window_left,
-- windowinfo.window_top,
-- window_width, window_height, -- width, height
-- windowinfo.window_mode,
-- windowinfo.window_flags,
-- ColourNameToRGB "#373737")
WindowRectOp (win, 5, 0, 0, 0, 0, 5, 15 + 0x1000)
-- add the drag handler so they can move the window around
movewindow.add_drag_handler (win, 0, 0, 0, font_height)
-- Tables --
All = {} --table will contain all info gotten from bid item#
flags = {} --table for working with ill,so,reson
--Other variables--
s = "" --string containing the output from the mud
a = 0
... are not inside any function and are thus executed before anything else.
For example, you are trying to find the font height, before you have created the window. And you are using windowinfo before OnPluginInstall is called, and thus it won't be valid. You have to move that stuff inside OnPluginInstall.
More correct is this:
function OnPluginInstall ()
print("OnPluginInstall")
-- install the window movement handler, get back the window position
windowinfo = movewindow.install (win, 6) -- default to 6 (on top right)
-- make window so I can grab the font info
WindowCreate (win, 0, 0, 0, 0, 1, 0, 0)
tprint(windowinfo)
-- add the font
WindowFont (win, font, "Lucida Console", 9)
font_height = WindowFontInfo (win, font, 1)
max_width = WindowTextWidth (win, font, "Report")
local window_width = max_width + 10
local window_height = font_height * (#report + 2) + 10
-- make window correct size
WindowCreate (win,
windowinfo.window_left,
windowinfo.window_top,
window_width, window_height, -- width, height
windowinfo.window_mode,
windowinfo.window_flags,
ColourNameToRGB "#373737")
WindowRectOp (win, 5, 0, 0, 0, 0, 5, 15 + 0x1000)
-- add the drag handler so they can move the window around
movewindow.add_drag_handler (win, 0, 0, 0, font_height)
-- Tables --
All = {} --table will contain all info gotten from bid item#
flags = {} --table for working with ill,so,reson
--Other variables--
s = "" --string containing the output from the mud
a = 0
end -- OnPluginInstall
At least that displays this:
OnPluginInstall
"dragrelease"=function: 02E03BB0
"window_flags"=0
"preprocess":
"mousedown"=function: 02E05BF0
"window_left"=0
"window_mode"=6
"window_top"=0
"cancelmousedown"=function: 02E06320
"check_map_position"=function: 02E056B0
"mouseover"=function: 02E06440
"cancelmouseover"=function: 02E063B0
"win"="7cc9d7720077333c01c21372_ident"
"dragmove"=function: 02E04F30
"mouseup"=function: 02E00040
"window_friend_deltas":
"window_friends":
"margin"=20
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|