What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » HELP - Resizing a child window!

Pages: (2): « First « 1 [ 2 ] Last »
HELP - Resizing a child window!
Author: Message:
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
32 / Male / Flag
Joined: Apr 2004
RE: HELP - Resizing a child window!
quote:
Originally posted by whiz
I've done all that, and the parent/child windows are loaded, but as soon as I resize the window, the child disappears.  It leaves just an empty parent window...
That's odd... Can you pack your script and upload it so we can have a better look at it?
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
09-13-2009 10:10 AM
Profile E-Mail PM Web Find Quote Report
whiz
Senior Member
****


Posts: 568
Reputation: 8
– / – / Flag
Joined: Nov 2008
O.P. RE: HELP - Resizing a child window!
Attached.

.plsc File Attachment: Command Bar.plsc (7.01 KB)
This file has been downloaded 126 time(s).
09-13-2009 10:33 AM
Profile E-Mail PM Find Quote Report
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
30 / Male / Flag
Joined: Jul 2007
RE: HELP - Resizing a child window!
I do not exactly have time ATM, but still: you must place the PlaceHolderElement in the parent window, not the child window like you did ;)
09-14-2009 07:39 AM
Profile PM Find Quote Report
whiz
Senior Member
****


Posts: 568
Reputation: 8
– / – / Flag
Joined: Nov 2008
O.P. RE: HELP - Resizing a child window!
quote:
Originally posted by SmokingCookie
I do not exactly have time ATM, but still: you must place the PlaceHolderElement in the parent window, not the child window like you did ;)
Umm...
xml code:
<Window Id="WndCommandBar_Shell" Version="1">

    <Attributes>
        <Caption>Command Bar</Caption>
        <TopMost>true</TopMost>
        <ShowInTaskbar>false</ShowInTaskbar>
    </Attributes>
   
    <TitleBar>
        <AllowMinimize>false</AllowMinimize>
        <AllowClose>false</AllowClose>
    </TitleBar>
   
    <Position Width="186" Height="27">
        <IsAbsolute>true</IsAbsolute>
        <Resizeable Allowed="BothSides">
            <MinWidth>150</MinWidth>
            <MinHeight>27</MinHeight>
        </Resizeable>
    </Position>
   
    <WindowTmpl>
        <Borders Type="Simple"/>
    </WindowTmpl>
   
    <Elements>
        <Element xsi:type="PlaceHolderElement" Id="PhlChild">
            <Position Left="10" Top="0" Width="172" Height="26"/>
        </Element>
    </Elements>

</Window>
...I have, haven't I (the parent is actually second in the interface file - the first is the old one, to be ignored)?

EDIT: were you looking at the code in the first post?  :P

This post was edited on 09-14-2009 at 04:49 PM by whiz.
09-14-2009 03:55 PM
Profile E-Mail PM Find Quote Report
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
32 / Male / Flag
Joined: Apr 2004
RE: HELP - Resizing a child window!
Fixed it!
  • OnWndCommandBar_ShellEvent_MessageNotification always has to return something. Because we want all messages to be processed normally, we always return -1.
  • You defined the element in your XML as "PhlChild" but you're referencing it as "PlhChild"! This is why RetrievePos always gives 0 for position and size.
  • The place-holder needs to size with the window, so it needs anchoring.
  • The place-holder should be the same size as the child window it holds in order to make the child size properly.
Attached is the script package with these fixes included. You still need to resize the other child window as well. Here's a tip: only resize the currently displayed child window, so store the current child in some global variable, size that one when receiving WM_SIZE and swap it when the child changes (don't forget to resize the new child after swapping!).

.plsc File Attachment: Command Bar (fixed by Matti).plsc (7.03 KB)
This file has been downloaded 122 time(s).
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
09-14-2009 05:20 PM
Profile E-Mail PM Web Find Quote Report
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
30 / Male / Flag
Joined: Jul 2007
RE: HELP - Resizing a child window!
Like I said, I didn't have the time this morning. I had a few hours off at school, so I rush-finished some homework (still too late for school though :$ :P ).

Anyway, seems like I was confused by the window IDs. I'm used to a system like this:

JScript code:
//Some example code demonstrating Window IDs and child IDs

var PlusWnd = MsgPlus.CreateWnd("Wnd.xml","WndTest");
var ChildWnd = MsgPlus.CreateChildWnd(PlusWnd,"Wnd.xml","WndTest_Child",0,0,true);

You might wanna try this yourself ;)

And I think I've found the error:

XML code:
    <Elements>
        <Element xsi:type="PlaceHolderElement" Id="PhlChild"> <!-- Check the element ID here -->
            <Position Left="10" Top="0" Width="172" Height="26"/>
        </Element>
    </Elements>

JScript code:
function OnWndCommandBar_ShellEvent_MessageNotification(PlusWnd, Message, wParam, lParam)
{
    if (Message == 0x5)
    {
        var posChild = RetrievePos(WndCommandBar_Shell,"PlhChild"); // Check the element ID here too
        Interop.Call("user32","MoveWindow",WndCommandBar_CMain.Handle,posChild.x,posChild.y,posChild.Width,posChild.Height,true); // Thought this would solve it...
    }
}

That's one common error I've experienced MANY times.. ^0)

* Even more angry at Matti....
AGAIN!! :S :P

This post was edited on 09-14-2009 at 05:22 PM by SmokingCookie.
09-14-2009 05:20 PM
Profile PM Find Quote Report
whiz
Senior Member
****


Posts: 568
Reputation: 8
– / – / Flag
Joined: Nov 2008
O.P. RE: HELP - Resizing a child window!
Great, it works!  :P  Except that I installed the script and didn't think to copy all of the changes I had made with the actual workings of the script...  that I've now lost...  :D  Ah, well.

EDIT: I've managed to recover most of my changes from my online backup, which (luckily) hadn't synchronized that bit yet...  :)

This post was edited on 09-14-2009 at 06:00 PM by whiz.
09-14-2009 05:58 PM
Profile E-Mail PM Find Quote Report
Pages: (2): « First « 1 [ 2 ] Last »
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On