(EDIT: MUSHclient v4.44)
First, see this snippet of script:
The first window (cg) was created using my widget framework, though it could have been a regular window. The second is simply a window created to copy the first window into. If I were to call cg:Show(), the widget would look like [1] (large blue square w/ small green square). Running the above code, the 'w' window appears like [2] (large red square w/ small black square).
Notice that I made the 'w' window larger than 'cg', and colored it red. Even though I had drawn the image onto the window, which apparently maintained the differently-colored smaller square, for some reason everything (except the black square) is red.
If I just change the initial WindowCreate() to (w, 0, 0, 1, 1, 0, 0, 0), or move the WindowImageFromWindow() call to after the second WindowCreate(), it appears like [3] (large blue square w/ small green square and thin red border), which is the correct and expected view.
It seems like there is some issue with preloading an image into a 0x0 window, because the drawing operation itself didn't need to be moved in order to achieve the correct view. This seems strange to me, because the image doesn't depend on the window for its size, at least not until it's actually drawn onto the window. And preloading fonts into a 0x0 window works perfectly fine.
I could avoid this issue altogether by simply using a 1x1 dummy window for preloading resources, but the results of using 0x0 were strange and confusing enough that I'd rather make you aware of it.
[1]: http://img31.imageshack.us/img31/811/22047230.png
[2]: http://img13.imageshack.us/img13/2623/win1d.png
[3]: http://img13.imageshack.us/img13/5536/win2.png
First, see this snippet of script:
cg = CharacterGrid.new(3, 3)
cg:BackColor(0xFF0000)
cg:Anchor(12)
cg:Cell(1,1).backcolor = 0x00FF00
cg:Repaint()
w = "w"
WindowCreate(w, 0, 0, 0, 0, 0, 0, 0)
WindowImageFromWindow(w, "cg", cg.name)
WindowCreate(w, 0, 0, cg.width+4, cg.height+4, 12, 0, 0x0000FF)
WindowDrawImage(w, "cg", 2, 2, 0, 0, 1)
WindowShow(w)
The first window (cg) was created using my widget framework, though it could have been a regular window. The second is simply a window created to copy the first window into. If I were to call cg:Show(), the widget would look like [1] (large blue square w/ small green square). Running the above code, the 'w' window appears like [2] (large red square w/ small black square).
Notice that I made the 'w' window larger than 'cg', and colored it red. Even though I had drawn the image onto the window, which apparently maintained the differently-colored smaller square, for some reason everything (except the black square) is red.
If I just change the initial WindowCreate() to (w, 0, 0, 1, 1, 0, 0, 0), or move the WindowImageFromWindow() call to after the second WindowCreate(), it appears like [3] (large blue square w/ small green square and thin red border), which is the correct and expected view.
It seems like there is some issue with preloading an image into a 0x0 window, because the drawing operation itself didn't need to be moved in order to achieve the correct view. This seems strange to me, because the image doesn't depend on the window for its size, at least not until it's actually drawn onto the window. And preloading fonts into a 0x0 window works perfectly fine.
I could avoid this issue altogether by simply using a 1x1 dummy window for preloading resources, but the results of using 0x0 were strange and confusing enough that I'd rather make you aware of it.
[1]: http://img31.imageshack.us/img31/811/22047230.png
[2]: http://img13.imageshack.us/img13/2623/win1d.png
[3]: http://img13.imageshack.us/img13/5536/win2.png