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 ➜ Miniwindows ➜ Multiple miniwindows in a plugin-issue.

Multiple miniwindows in a plugin-issue.

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Mr.lundmark   (51 posts)  Bio
Date Fri 29 Jul 2011 03:23 PM (UTC)

Amended on Fri 29 Jul 2011 06:00 PM (UTC) by Mr.lundmark

Message
Hi Nick (and the rest of you).

First off, thanks for coding a great mud-client.

As always, each time anyone has anything positive to say - they also want something from you ;)

When I run a Debug("summary") and look into my miniwindows, I get the following printout:
Window: 'KillCommands', at (0,0,187,64), shown: yes
width: 187, height: 64, position: 4, hotspots: 1, fonts: 1, images: 0
Window: 'Killers', at (0,0,109,16), shown: yes
width: 109, height: 16, position: 4, hotspots: 1, fonts: 1, images: 0
Window: 'StepInfo', at (0,0,70,48), shown: yes
width: 70, height: 48, position: 4, hotspots: 1, fonts: 1, images: 0


They are all from the same plugin.

As you can see, the heights of the windows are 64, 16 and 48. Still, they are all drawn as if they were 64 pixels high.

What is it that I'm doing wrong? I've tried with WindowDelete/windowCreate every time I rescale them, but it doesn't seem to help. I could provide with more information such as code or screenshots. Just let me know.

Edit: I'm running version 4.75.

Cheers,
Simon.
Top

Posted by Mr.lundmark   (51 posts)  Bio
Date Reply #1 on Fri 29 Jul 2011 10:26 PM (UTC)

Amended on Fri 29 Jul 2011 10:27 PM (UTC) by Mr.lundmark

Message
Add:

Since my windows are stacked top-right and I'm offsetting them towards the center, it seems as if my right-most window scales accordingly, but when I try to scale the mid or left one to a size smaller than a window that is more to the right, it fails.

Red squared means that the button is minimized. Blue that it's maximized.

This is when it works correctly:
http://i53.tinypic.com/33ath5z.jpg

This is when it works incorrectly:
http://i51.tinypic.com/169jhv9.jpg
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #2 on Fri 29 Jul 2011 11:14 PM (UTC)
Message
The code please? Can't help debug code without seeing it.

Quote:

... but when I try to scale the mid or left one to a size smaller than a window that is more to the right, it fails.


Fails, as in makes a bigger window than you expect?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Mr.lundmark   (51 posts)  Bio
Date Reply #3 on Sat 30 Jul 2011 12:05 AM (UTC)

Amended on Sat 30 Jul 2011 12:12 AM (UTC) by Nick Gammon

Message
The code of importance is:

for i, name in ipairs(data.windows) do
	WindowDelete(name)
	WindowCreate(name, offset_x, 0, data.x_size[i] + offset_x, data.y_size[i], 4, 0, ColourNameToRGB("black"))
	WindowFont(name, font, "Sylfaen", 8, false, false, false, false, 1, 0)
	WindowAddHotspot(name, name, offset_x, 0, data.x_size[i] + offset_x, 16, 
			"mouseOver",
			"cancelMouseOver",
			"mouseDown",
			"cancelMouseDown",
			"mouseUp",
			"Minimize/Maximize",
			1, 0)
	WindowShow(name, true)
	offset_x = offset_x + data.x_size[i]
end


Where X/Y sizes vary. As the applied "failed" screenshot describe (http://i51.tinypic.com/169jhv9.jpg), the mid-window (named "Killers") should be only 17 pixels in Y (which is what I set it to) and yet it is being displayed as much bigger.

So the answer to your question is Yes, the mid-window becomes larger than expected. So does the left one if it is attempted to be smaller (in height) than the mid/right ones.

Does that explain my issue?

[EDIT] Edited by Nick to "escape" square brackets.
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #4 on Sat 30 Jul 2011 12:16 AM (UTC)
Message
Mr lundmark said:

... the mid-window (named "Killers") should be only 17 pixels in Y (which is what I set it to) and yet it is being displayed as much bigger.


I don't actually see that number 17. I only see data.y_size[i], whatever that might be.

You need to show each value being passed to WindowCreate, but I am guessing that data.y_size[i] isn't what you think it is.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Mr.lundmark   (51 posts)  Bio
Date Reply #5 on Sat 30 Jul 2011 08:11 AM (UTC)

Amended on Sat 30 Jul 2011 12:08 PM (UTC) by Mr.lundmark

Message
Nick Gammon said:

Mr lundmark said:

... the mid-window (named "Killers") should be only 17 pixels in Y (which is what I set it to) and yet it is being displayed as much bigger.


I don't actually see that number 17. I only see data.y_size[i], whatever that might be.

You need to show each value being passed to WindowCreate, but I am guessing that data.y_size[i] isn't what you think it is.


Mr lundmark said:

When I run a Debug("summary") and look into my miniwindows, I get the following printout:
Window: 'KillCommands', at (0,0,187,64), shown: yes
width: 187, height: 64, position: 4, hotspots: 1, fonts: 1, images: 0
Window: 'Killers', at (0,0,109,16), shown: yes
width: 109, height: 16, position: 4, hotspots: 1, fonts: 1, images: 0
Window: 'StepInfo', at (0,0,70,48), shown: yes
width: 70, height: 48, position: 4, hotspots: 1, fonts: 1, images: 0


According to your Debug("summary"), it's "16". Look at the middle window called "Killers". It says that it's 16 (I changed that to 17 later). When I debug-write the value every time I draw the window, I get that number (the code added to the for loop is a simple "print("Window " .. name .. " height: " .. data.y_size[ i ])"), and the output is:
Window StepInfo height: 48
Window Killers height: 17
Window KillCommands height: 64

The middle window is set to 17.
Top

Posted by Mr.lundmark   (51 posts)  Bio
Date Reply #6 on Sat 30 Jul 2011 08:27 AM (UTC)

Amended on Sat 30 Jul 2011 12:09 PM (UTC) by Mr.lundmark

Message
I made a new plugin (much simpler than the old one) to demonstrate the issue.


<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on söndag, oktober 10, 2010, 8:15  -->
<!-- MuClient version 4.63 -->

<!-- Plugin "StatusMonitor" generated by Plugin Wizard -->

<muclient>
<plugin
   name="DebugDrawing"
   author="Simon Lundmark"
   id="aaa419bdde4edec0668f7aaa"
   language="Lua"
   date_written="2010-10-10 08:14:31"
   requires="4.63"
   version="1.0"
   >

</plugin>

<!--  Get our standard constants -->

<script>
<![CDATA[

local data = {
	windows = {
		"StepInfo",
		"Killers",
		"KillCommands",
	},
	y_size = {
		100,
		15,
		100,
	},
	
	x_size = {
		100,
		50,
		100,
	},
}

function clearWindow()
	local offset_x = 0
	for i, name in ipairs(data.windows) do
		WindowDelete(name)
		WindowCreate(name, offset_x, 0, data.x_size[i] + offset_x, data.y_size[i], 4, 0, ColourNameToRGB("red"))
		WindowShow(name, true)
		offset_x = offset_x + data.x_size[i]
	end
end
	
function OnPluginEnable()
	clearWindow()
end

function OnPluginInstall() 
	clearWindow()
end
	
function OnPluginClose() 
	for i, name in ipairs(data.windows) do
		WindowDelete(name)
	end
end

function OnPluginTick()
	clearWindow()
end
	
]]>
</script>


</muclient>



NOTE: This is definetly not any way that anyone should update their miniwindow, this is not at all performance-friendly.

Edit: Changed to escape bracket-sequences.
Top

Posted by Fiendish   USA  (2,534 posts)  Bio   Global Moderator
Date Reply #7 on Sat 30 Jul 2011 11:42 AM (UTC)

Amended on Sat 30 Jul 2011 12:34 PM (UTC) by Fiendish

Message
data.x_size and data.y_size are tables. WindowCreate expects numbers. Perhaps you meant data.x_size[i] or something?

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Mr.lundmark   (51 posts)  Bio
Date Reply #8 on Sat 30 Jul 2011 12:05 PM (UTC)

Amended on Sat 30 Jul 2011 12:11 PM (UTC) by Mr.lundmark

Message
Actually I'm accessing them by using array/table indexing in lua, but the forum seems to parse them away.


Edit: Fixxed that by adding escape-sequence to the brackets.
Top

Posted by Fiendish   USA  (2,534 posts)  Bio   Global Moderator
Date Reply #9 on Sat 30 Jul 2011 01:04 PM (UTC)
Message
Ok, I see two problems.

First, WindowCreate's 4th and 5th parameters are width/height not right-x, bottom-y, so use

data.x_size[i]

instead of

data.x_size[i] + offset_x


And second, you're not using the flag to specify that you want exact positioning. The 7th parameter should be 2 instead of 0.

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Mr.lundmark   (51 posts)  Bio
Date Reply #10 on Sat 30 Jul 2011 01:43 PM (UTC)
Message
That fixxed my problems!

Thanks a bunch!
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.


25,451 views.

It is now over 60 days since the last post. This thread is closed.     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.