Shoutbox

[?] Weirdness. Evolved. - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: [?] Weirdness. Evolved. (/showthread.php?tid=76496)

[?] Weirdness. Evolved. by Matti on 08-02-2007 at 07:05 PM

Okay, so I was working on my top secret script project (*evil laugh*), but then I stumbled onto something VERY weird... Here's the situation.

I've got a parent window, the Preferences window. It contains some bottom bar buttons and links to the various preferences child windows. When the user clicks a such link, the associated child window becomes visible while the others are hidden. Using a simple piece of code, the child windows get resized along with the parent when the parent is resizing:

code:
function OnWndPrefEvent_MessageNotification(PlusWnd, Message, wParam, lParam) {
   if(Message == /* WM_SIZE */ 0x5) {
      //MSDN told me that the width and height are in the lParam, so let's make use of it
      var wWidth = lParam & 0xFFFF; //Get low-order word
      var wHeight = (lParam >> 16); //Get high-order word
      //Now, we need to crop the area for the child windows
      cWidth = wWidth - 15;
      cHeight = wHeight - 117;
      //Finally, resize the child windows
      Interop.Call("User32", "SetWindowPos", Wnd["WndPrefGeneral"].Handle, 0, 0, 0, cWidth, cHeight, 18);
      Interop.Call("User32", "SetWindowPos", Wnd["WndPrefLanguage"].Handle, 0, 0, 0, cWidth, cHeight, 18);
   }
   //Let the window do its stuff too (don't know what, but who cares)
   return -1;
}
(The values I subtract from the size are found out by trying out, changing and re-try. No special maths were used for it.)
The above code worked flawless, everything resized perfectly... except one thing I found out today.

While I was working on the Languages child window, I found out that a specific combination of a ListViewControl with LargeIconView and a LinkControl with a BottomFixed Anchor attribute can cause a glitch, making the LinkControl return to the original position, before the window got resized. A quick compiled image should clarify this:
[Image: attachment.php?pid=840560]
As you can see, the LinkControl jumps to it's original position. When I try to resize the window vertically then, the control moves from that position. So, if I resize the parent 10 pixels upwards, the control moves 10 pixels upwards, meaning that it actually took a new position.

If you want to reproduce this, create a window, create a child window with a ListViewControl with LargeIconView and a LinkControl with BottomFixed. Make the parent resizable and use the above code for the child window resizing. Add 2 items to the ListViewControl and follow the instructions.

Now, I'd like to know: can this glitch be fixed with a piece of code or is it caused by Plus! itself? Or is there any other reason which might cause this happening?

Specifications:
Windows Vista Ultimate x64
Windows Live Messenger 8.1.0178 (skinned with Windows Aero Messenger)
Messenger Plus! Live 4.23.0.276
RE: [?] Weirdness. Evolved. by Matti on 08-04-2007 at 11:34 AM

Update:
This only happens if you change the text of the LinkControl when the ListViewControl's selection changes (using OnWndIdEvent_LstViewSelStateChanged). However, I still wonder why this happens...

I can't seem to set the position of the LinkControl using SetWindowPos neither... probably because it's anchored, but then how can I fix this? I need some help here! :(

I can now confirm that when PlusWnd.SetControlText() is called, the position is restored. When I added Wnd["WndPrefLanguage"].SetControlText("LnkWebsite", "http://") to the resize event, I could clearly see how it always jumps to the start position while the window resizes. So, OR it's the way my event is built, OR it's SetControlText causing this.


RE: [?] Weirdness. Evolved. by matty on 08-04-2007 at 01:03 PM

Sounds like a bug in your anchoring in your xml file.

Try using this

code:
<Anchor Vertical="TopBottomFixed" />


code:
<Anchor Vertical="BottomFixed" />

It isn't documented but i think it works...
Confirmed, it works
RE: [?] Weirdness. Evolved. by Matti on 08-04-2007 at 01:13 PM

^o)

I don't think you get it... I want it to be bottom fixed (so I set <Anchor Vertical="BottomFixed">), but it jumps back to the original position when the ListViewControl's selection changes. This is because I call PlusWnd.SetControlText on the LinkControl in that event, but I don't know why it's doing this.


RE: [?] Weirdness. Evolved. by ShawnZ on 08-04-2007 at 01:28 PM

i don't see any difference between screenshot 2 and 3...


RE: [?] Weirdness. Evolved. by Matti on 08-04-2007 at 01:41 PM

quote:
Originally posted by ShawnZ
i don't see any difference between screenshot 2 and 3...
The link moved...
* Matti gives ShawnZ some trendy glasses. 8-|
RE: [?] Weirdness. Evolved. by matty on 08-04-2007 at 02:21 PM

I did some testing when you change the text of a LinkControl when it has an Anchor the control moves to its original position.

Does this with SetControlText, WM_SETTEXT, SetWindowTextW.