xml window position |
Author: |
Message: |
scutterman
Junior Member
-- Scutterman avatar from Runescape
Posts: 21
– / /
Joined: Jul 2007
|
O.P. xml window position
How can I change the position of an xml window on the screen.
Is there something in xml that will let me control it or is there something in mpls to control window position?
I've tried searching but I can't find anything
TIA
~~Scutterman~~
Of course the world doesn't make sense
Its only purpose is to be somewhere that
humans can stand around in complaining
that the world doesn't make sense
|
|
08-29-2007 07:35 PM |
|
|
matty
Scripting Guru
Posts: 8336 Reputation: 109
39 / /
Joined: Dec 2002
Status: Away
|
RE: xml window position
When Creating the Window using MsgPlus.CreateWnd the 3rd parameter if you set it to 1 will cause the window to not show on the screen. What you can do with this is then use the MoveWindow api to move it where you want to then call the ShowWindow api to show it. Other then that there is nothing in the XML that will allow you to set positions.
|
|
08-29-2007 07:50 PM |
|
|
scutterman
Junior Member
-- Scutterman avatar from Runescape
Posts: 21
– / /
Joined: Jul 2007
|
O.P. RE: xml window position
Thanks, I'll look into MoveWindow()
Am I right in thinking that I will need to hide the window again before I can move it to another position, then show it again?
Thanks
~~Scutterman~~
Of course the world doesn't make sense
Its only purpose is to be somewhere that
humans can stand around in complaining
that the world doesn't make sense
|
|
08-29-2007 07:53 PM |
|
|
markee
Veteran Member
Posts: 1622 Reputation: 50
36 / /
Joined: Jan 2006
|
RE: xml window position
You can move it while the window is visable, but if you are moving it initially then it looks better if you don't display the window until it is in the position that you were initially wanting.
|
|
08-29-2007 11:27 PM |
|
|
scutterman
Junior Member
-- Scutterman avatar from Runescape
Posts: 21
– / /
Joined: Jul 2007
|
O.P. RE: xml window position
Ok, thanks for all of your help
Of course the world doesn't make sense
Its only purpose is to be somewhere that
humans can stand around in complaining
that the world doesn't make sense
|
|
08-30-2007 08:58 AM |
|
|
scutterman
Junior Member
-- Scutterman avatar from Runescape
Posts: 21
– / /
Joined: Jul 2007
|
O.P. RE: xml window position
ok, I've tried MoveWindow() but I can't seem to get it to work. If I have the last parameter in quotes, or left out I get an "object expected" error but if I have it out of quotes it comes up with "'FALSE' is undefined". Can someone give me an example MPL script please?
code:
function OnEvent_ChatWndReceiveMessage(oChatWnd, sOrigin, sMessage, nMessageKind)
{
if (sMessage == "Testing")
{
// MsgPlus.DisplayToast("","Testing, Testing, 1, 2, 3")
var Wnd = MsgPlus.CreateWnd("InterfaceTest.xml", "WndTest",1);
var WndHandle = Wnd.Handle
MoveWindow(WndHandle, 100, 100, 100, 100, FALSE);
}
}
Thanks
~~Scutterman~~
Of course the world doesn't make sense
Its only purpose is to be somewhere that
humans can stand around in complaining
that the world doesn't make sense
|
|
08-30-2007 09:37 AM |
|
|
Spunky
Former Super Mod
Posts: 3658 Reputation: 61
36 / /
Joined: Aug 2006
|
RE: xml window position
change FALSE to false or replace it with a 0 (zero)
<Eljay> "Problems encountered: shit blew up"
|
|
08-30-2007 10:17 AM |
|
|
scutterman
Junior Member
-- Scutterman avatar from Runescape
Posts: 21
– / /
Joined: Jul 2007
|
O.P. RE: xml window position
Thanks
~~Scutterman~~
Of course the world doesn't make sense
Its only purpose is to be somewhere that
humans can stand around in complaining
that the world doesn't make sense
|
|
08-30-2007 11:26 AM |
|
|
scutterman
Junior Member
-- Scutterman avatar from Runescape
Posts: 21
– / /
Joined: Jul 2007
|
O.P. RE: xml window position
GRRRRRRRRRRRRR
I changed the value to "false" and it's still saying "object expected"
any ideas
~~Scutterman~~
Of course the world doesn't make sense
Its only purpose is to be somewhere that
humans can stand around in complaining
that the world doesn't make sense
|
|
08-30-2007 11:34 AM |
|
|
Matti
Elite Member
Script Developer and Helper
Posts: 1646 Reputation: 39
32 / /
Joined: Apr 2004
|
RE: xml window position
MoveWindow is a Win32 API function in user32.dll. You should use Interop.Call(DllName, FunctionName, Param1, ...) to call it!
Source: MoveWindow on MSDN
code: var Result = Interop.Call(
"user32.dll", /* DLL name, you can find this on the MSDN page under Function Information */
"MoveWindow", /* Function name */
WndHandle, /* hWnd */
100, /* X-position */
100, /* Y-position */
100, /* Width */
100, /* Height */
true /* bRepaint, set this to false if you're going to repaint the window yourself (which you better don't) */
);
Debug.Trace("MoveWindow result: "+Result);
The result of MoveWindow is zero if it failed. So, if you want to check if it failed, use if(Result == 0) ... and do whatever you want. (show error box, tell the debugger something, ...)
Of course, it's not needed that you place all these comments in your function call. It's just to let you know what each parameter stands for. Something like this can be used if you don't need all these comments:
code: var Result = Interop.Call("user32.dll", "MoveWindow", WndHandle, 100, 100, 100, 100, true);
But I think you could've figured that out yourself too.
quote: Originally posted by SpunkyLoveMuff
change FALSE to false or replace it with a 0 (zero)
Sorry, but that won't make any difference. FALSE is false. And false as parameter in an Interop.Call equals 0 too, the documentation explains:
quote: Originally posted by Messenger Plus! Live Scripting Documentation
Here is how the data will be sent to the function depending on its type:
- If the parameter is a plain number (positive or negative), it is sent as is.
- If the parameter is a floating point number, it is rounded up and sent as a plain number.
- If the parameter is a boolean, a number is sent: 1 for true, 0 for false.
- If the parameter is null, 0 is sent.
- If the parameter is a string, a pointer to a Unicode string is sent.
- If the parameter is a DataBloc object, a pointer to its underlying data is sent.
- If the parameter is any other object, a pointer to its IDispatch interface is sent. The reference count of the object is not increased.
This post was edited on 08-30-2007 at 12:19 PM by Matti.
|
|
08-30-2007 12:19 PM |
|
|
Pages: (2):
« First
[ 1 ]
2
»
Last »
|
|