What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [?] Creating menu's

Pages: (2): « First [ 1 ] 2 » Last »
[?] Creating menu's
Author: Message:
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
32 / Male / Flag
Joined: Apr 2004
O.P. [?] Creating menu's
Right...

So, I was working on another script which I want to be translatable. A lot of scripts use XML rewriting for that, but I think that method is getting overused, while the Win32 API has great functions to do that. So far, I managed to create tooltips using the _ToolTip class (thanks Eljay!!) but now I'm trying to develop an alternative for MenuButtonControls. I was thinking of a child window in the parent window which would be made visible by clicking on a button and be hidden by clicking somewhere else. But there seem to be a catch...

I first create the window with MsgPlus.CreateWnd and open it unactivated using a flag. Then, I set the parent of that child window to the main window. After that, I position the window so it's placed just beneath the button. And then, for testing purpose, I make it visible. But, the child window gets partially hidden by the underlaying window controls: the child is not on the top Z-index in the window. A screenshot to clarify:
[Image: attachment.php?pid=808469]

Now my question is: how can I set the child window to be on top of the other window controls? SetForegroundWindow and BringWindowToTop fail to do this... I understand that this is a very tricky method I'm trying, but if you could possibly help me, please do so! :)

.png File Attachment: menu_notontop.png (4.72 KB)
This file has been downloaded 373 time(s).
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
04-14-2007 08:49 AM
Profile E-Mail PM Web Find Quote Report
vikke
Senior Member
****

Avatar

Posts: 900
Reputation: 28
31 / Male / Flag
Joined: May 2006
RE: [?] Creating menu's
I don't know if it'll work, but you should be able to try "Always on top".
code:
// Declares Put this on top of code
var HWND_TOPMOST = -1;
var SWP_NOMOVE = &H2; // No idea if those will work.
var SWP_NOSIZE = &H1;

// Function Note: Handle is HWND (window handle)
function AlwaysOnTop (Handle)
{
      // Also try HWND_TOP
      Interop.Call("user32.dll", "SetWindowPos", Handle, HWND_TOPMOST, 0, 0, 0, SWP_NOMOVE || SWP_NOSIZE);
}

4 8 15 16 23 42
04-14-2007 09:21 AM
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
O.P. RE: [?] Creating menu's
The topmost flag doesn't seem to be accepted for child windows. I'll keep it on HWND_TOP (0x0).

The weird thing is that it's actually on top of the controls, only it doesn't get drawn on top. To prove this: when I mouse-over the Preferences button where it should be behind the window, it doesn't light up. I have to move the mouse out of the menu area to make it light up. :S

Maybe I should try to set the Z-order of the 2 buttons... but how?!

This post was edited on 04-14-2007 at 09:38 AM by Matti.
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
04-14-2007 09:32 AM
Profile E-Mail PM Web Find Quote Report
vikke
Senior Member
****

Avatar

Posts: 900
Reputation: 28
31 / Male / Flag
Joined: May 2006
RE: [?] Creating menu's
But the menu is not a child of the window right?
There should not be any problem.

How does your bottom bar XML code look like?
4 8 15 16 23 42
04-14-2007 09:42 AM
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
O.P. RE: [?] Creating menu's
code:
      <DialogTmpl>
         <BottomBar Style="Plain">
            <LeftControls>
               <Control xsi:type="ButtonControl" Id="BtnPref">
                  <Position Left="0" Top="0" Width="80"></Position>
                  <Image Margin="5"><Name>panel-scripts</Name></Image>
                  <Caption>&amp;Preferences</Caption>
               </Control>
               <Control xsi:type="ButtonControl" Id="BtnHelp">
                  <Position Left="0" Top="0" Width="20"></Position>
                  <Image><Name>info-small</Name></Image>
                  <Caption/>
               </Control>
            </LeftControls>
            <RightControls>
               <Control xsi:type="ButtonControl" Id="BtnCancel">
                  <Position Left="0" Top="0" Width="60"></Position>
                  <Image Margin="5"><Name>sounds-delete2</Name></Image>
                  <Caption>&amp;Close</Caption>
               </Control>
            </RightControls>
         </BottomBar>
      </DialogTmpl>

You think that's it's because the bottom bar is always on top? Sounds likely, but how should I fix that? :S And how did Plus! get her (*) menu's on top then? Or maybe... those aren't child windows? :O

It seems like I'm having more luck with making it a stand-alone window. I'll now try to make it destroy when it gets deactivated.

This post was edited on 04-14-2007 at 09:56 AM by Matti.
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
04-14-2007 09:47 AM
Profile E-Mail PM Web Find Quote Report
vikke
Senior Member
****

Avatar

Posts: 900
Reputation: 28
31 / Male / Flag
Joined: May 2006
RE: [?] Creating menu's
This won't not help but I would use:
code:
<Position Left="0" Top="0" Width="60" />
instead of:
code:
<Position Left="0" Top="0" Width="60"></Position>

But if you have a look at the screenshot, the bottombar is under the menu, but the buttons is not, so it's something with the buttons. I think this is a bug. :(
4 8 15 16 23 42
04-14-2007 09:56 AM
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
O.P. RE: [?] Creating menu's
That was because there was an <Anchor> element there once... I simply didn't noticed.

I now need to find a message which is been send to the window when it loses its activated state... any ideas?

Gotcha! WM_ACTIVATE saved me! :D I'll now work this thing out...

I'm happy to tell you all that I've managed to do it. The menu gets created when the window loads, hides and will be shown when the button is clicked. Then, the position is re-calculated and the menu pops up. When the menu is deactivated, it hides again.

Now, one last thing: can someone tell me if there's a function which calculates the bounding box of a text in a specified font, like PHP's imagettfbbox(). I'd like to use this to resize the menu to fit the messages inside.

This post was edited on 04-14-2007 at 11:29 AM by Matti.
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
04-14-2007 10:07 AM
Profile E-Mail PM Web Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: [?] Creating menu's
Take a look at this.

_tray_icon_0.3.plsc
It shows you how to create a menu at runtime (allowing you to change the text as needed) and create a tray icon, not really needed for you but the first part is.
04-14-2007 02:57 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
O.P. RE: [?] Creating menu's
Matty, you rock! (H)
I've analyzed your code, took the parts I needed and BANG! It works like a charm! :D

I can't thank you enough! Now, we don't have to use MenuButtonControls anymore! :D
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
04-15-2007 09:26 AM
Profile E-Mail PM Web Find Quote Report
deAd
Scripting Contest Winner
*****

Avatar

Posts: 1060
Reputation: 28
– / Male / Flag
Joined: Jan 2006
RE: RE: [?] Creating menu's
quote:
Originally posted by Mattike
Now, we don't have to use MenuButtonControls anymore! :D

Why don't you want to use MenuButtonControls :P?
04-15-2007 02:48 PM
Profile 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