[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Miniwindows
. . -> [Subject]  Multiple miniwindows in a plugin-issue.

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?
(New message)
Subject: Multiple miniwindows in a plugin-issue.
Name:
Your forum user name.
Register forum user name
Password:
Your forum password.
Forgotten password?
Message:
Message to be posted (in English, please).
Forum codes:
Check this if your message uses 'forum codes' or templates (auto-detected for new posts).
Forum codes Templates

Save this message ...


Subject review (reverse sequence)

Posted by Mr.lundmark   (35 posts)  [Biography] bio
Date Sat 30 Jul 2011 01:43 PM (UTC)  quote  ]
Message
That fixxed my problems!

Thanks a bunch!
[Go to top] top

Posted by Fiendish   USA  (849 posts)  [Biography] bio   Global Moderator
Date Sat 30 Jul 2011 01:04 PM (UTC)  quote  ]
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.

http://aardwolfclientpackage.googlecode.com/
[Go to top] top

Posted by Mr.lundmark   (35 posts)  [Biography] bio
Date Sat 30 Jul 2011 12:05 PM (UTC)  quote  ]

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.
[Go to top] top

Posted by Fiendish   USA  (849 posts)  [Biography] bio   Global Moderator
Date Sat 30 Jul 2011 11:42 AM (UTC)  quote  ]

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?

http://aardwolfclientpackage.googlecode.com/
[Go to top] top

Posted by Mr.lundmark   (35 posts)  [Biography] bio
Date Sat 30 Jul 2011 08:27 AM (UTC)  quote  ]

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.
[Go to top] top

Posted by Mr.lundmark   (35 posts)  [Biography] bio
Date Sat 30 Jul 2011 08:11 AM (UTC)  quote  ]

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.
[Go to top] top

Posted by Nick Gammon   Australia  (18,772 posts)  [Biography] bio   Forum Administrator
Date Sat 30 Jul 2011 12:16 AM (UTC)  quote  ]
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
[Go to top] top

Posted by Mr.lundmark   (35 posts)  [Biography] bio
Date Sat 30 Jul 2011 12:05 AM (UTC)  quote  ]

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.
[Go to top] top

Posted by Nick Gammon   Australia  (18,772 posts)  [Biography] bio   Forum Administrator
Date Fri 29 Jul 2011 11:14 PM (UTC)  quote  ]
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
[Go to top] top

Posted by Mr.lundmark   (35 posts)  [Biography] bio
Date Fri 29 Jul 2011 10:26 PM (UTC)  quote  ]

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
[Go to top] top

Posted by Mr.lundmark   (35 posts)  [Biography] bio
Date Fri 29 Jul 2011 03:23 PM (UTC)  quote  ]

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.
[Go to top] 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.


1,528 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]