Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Lua ➜ How to Mini Window Docked?

How to Mini Window Docked?

You need to log onto the forum to reply or create new threads.

  Refresh page


Posted by Errigour   USA  (48 posts)  Bio
Date Sat 13 Jun 2026 10:43 PM (UTC)

Amended on Sun 14 Jun 2026 12:06 PM (UTC) by Errigour

Message
I have successfully created a miniwindow but I don't see an option to make it a docked window. Is there a way to do this?

function init()
    local width = GetInfo(281)   -- main window width
    local height = GetInfo(280)  -- main window height

    WindowCreate(
        "chatwin",
        0, 0, width, 150,   -- left, top, width, height=150px
        2,
        2,
        0x000000
    )

    -- Draw a border so you can SEE it
    WindowRectOp("chatwin", miniwin.rect_frame, 0, 0, 0, 0, 0x777777)

    -- Force a repaint
    WindowShow("chatwin", true)
end
Top

Posted by Errigour   USA  (48 posts)  Bio
Date Reply #1 on Sun 14 Jun 2026 11:58 AM (UTC)
Message
Also i cant seem to get the scrolling to work with hotspots what am i doing wrong?

    WindowScrollwheelHandler("chatwin", "hs1", "wheel_move")
    WindowAddHotspot(
        "chatwin",
        "hs1",
        0, 0, width, 150,   -- FULL WINDOW
        0,
        0,
        "",
        "",
        "",
        miniwin.cursor_hand,
        0,
        0
    )
Top

Posted by Errigour   USA  (48 posts)  Bio
Date Reply #2 on Sun 14 Jun 2026 01:16 PM (UTC)

Amended on Sun 14 Jun 2026 01:34 PM (UTC) by Errigour

Message
Alright guys here is some of my code, uhm I got it to work but I still don't know how to dock the window.

chat_buffer = {}
chat_max_lines = 200   -- how many lines to keep
chat_line_height = 14  -- pixel height per line
chat_scroll = 0   -- 0 = bottom, positive = scroll up
function wheel_move(flags, hotspot_id)
    -- wheel down (towards you)
    if bit.band(flags, 0x100) ~= 0 then
        chat_scroll = chat_scroll - 1
    else
        -- wheel up (away from you)
        chat_scroll = chat_scroll + 1
    end
    if chat_scroll < 0 then chat_scroll = 0 end
    if chat_scroll > #chat_buffer - 1 then
        chat_scroll = #chat_buffer - 1
    end
    chat_redraw()
    return 0
end
function init()
    local width = GetInfo(281)   -- main window width
    local height = GetInfo(280)  -- main window height

    WindowCreate(
        "chatwin",
        0, 0, width, 150,   -- left, top, width, height=150px
        2,
        0,
        0x000000
    )
    -- Draw a border so you can SEE it
    WindowRectOp("chatwin", miniwin.rect_frame, 0, 0, 0, 0, 0x777777)

    -- Force a repaint
    WindowShow("chatwin", true)
    WindowAddHotspot(
        "chatwin",
        "hs1",
        0, 0, width, 150,   -- FULL WINDOW
        "", -- mouse over script to call
        "", -- cancel mouse over
        "", -- mouse down
        "", -- cancel mouse down
        "", -- mouse up
        "Hovering Over", -- Tooltip text
        0,
        0
    )
    WindowScrollwheelHandler("chatwin", "hs1", "wheel_move")
end
function chat_redraw()
    if #chat_buffer == 0 then
        WindowShow("chatwin", true)
        return
    end

    local width = GetInfo(281)
    local height = 150

    WindowResize("chatwin", width, height, 0x000000)
    WindowRectOp("chatwin", miniwin.rect_fill, 0, 0, width, height, ColourNameToRGB("black"))

    local fi = WindowFontInfo("chatwin", "chatfont", 1)

    if not fi then
        WindowFont("chatwin", "chatfont", "Consolas", 9)
    end

    local start_index = math.max(1, #chat_buffer - chat_scroll)
    local y = height - chat_line_height

    for i = start_index, 1, -1 do
        WindowText("chatwin", "chatfont", chat_buffer, 5, y, 0, 0, 0xFFFFFF)
        y = y - chat_line_height
        if y < 0 then break end
    end

    WindowShow("chatwin", true)
end
function chat_add(text)
    table.insert(chat_buffer, text)

    -- trim buffer
    if #chat_buffer > chat_max_lines then
        table.remove(chat_buffer, 1)
    end

    chat_redraw()
end
function hide_chat()
    WindowShow("chatwin", false)
end
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


53 views.

You need to log onto the forum to reply or create new threads.

  Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.