Shoutbox

[Help] EditControl scroll bar - 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: [Help] EditControl scroll bar (/showthread.php?tid=74081)

[Help] EditControl scroll bar by Paril on 05-01-2007 at 04:10 PM

Whenever I add a text to an edit box (it has a 10 line size, multiline and VScroll) the scroll bar focuses itself to the top of the box.. is there any way to force the bar down?

-Paril


RE: [Help] EditControl scroll bar by Paril on 05-01-2007 at 06:36 PM

I tried this as well, as taken from MSDN help and such:

Window1.SendControlMessage ("Test", EM_SCROLL, SB_PAGEDOWN);

But, it said EM_SCROLL and SB_PAGEDOWN are undefined...

-Paril


RE: [Help] EditControl scroll bar by vikke on 05-01-2007 at 06:54 PM

Yes, you will need to define those in your JS. I suggest you to make them public (put them over all other code):

code:
var EM_SCROLL = 181;
var SB_PAGEDOWN = 3;

Those are defined in "windows.h", a C/C++ header file. I have given you the right values, so just enjoy it! :-)

To find windows messages out yourself, I suggest you to download the Platform SDK (if you don't already have it), and open "winuser.h" or "windows.h", and find the value you are looking for.

Also, make sure you send this message to the richedit/edit, not the whole PlusWnd.

Edit: windows.h is a C header file. :P

Edit2: In order to make this work, you will have to call like this:
code:
Window1.SendControlMessage("Test", EM_SCROLL, SB_PAGEDOWN, 0);
);

RE: [Help] EditControl scroll bar by Paril on 05-01-2007 at 06:57 PM

Oh, lawl, I see.

Yeah, I know, I work with C, I just didn't decide to go looking in my library files.. thanks.

EDIT: Perfect! Exactly what I needed.
While I'm here, is there a way to hide buttons from the script?

-Paril


RE: [Help] EditControl scroll bar by vikke on 05-01-2007 at 06:58 PM

Please check Edit2 in my other post, which I just did add. It's rather important to get it to work. ;)


RE: [Help] EditControl scroll bar by Paril on 05-01-2007 at 07:00 PM

Yes, I figured that since MSDN told me to set it to zero either way. Read my edit above, please.

-Paril


RE: [Help] EditControl scroll bar by matty on 05-01-2007 at 07:24 PM

Use the ShowWindow API with SW_SHOW and SW_HIDE.


RE: [Help] EditControl scroll bar by Paril on 05-01-2007 at 07:25 PM

Not the whole window, I mean a single control.. unless that's what you mean?
Example please?

-Paril


RE: [Help] EditControl scroll bar by J-Thread on 05-01-2007 at 09:53 PM

Get the handle of the control and send the SW_HIDE message to the control instead of the window. That should work.


RE: [Help] EditControl scroll bar by Paril on 05-01-2007 at 11:16 PM

I still don't really understand how to 'send the message', I tried this:

Window1.SendControlMessage ("Btnid1", SW_HIDE, 0, 0);

but it did nothing.. I don't know the args, if any..

EDIT: Oh, wait, do you mean from a seperate C DLL?

EDIT TWO: I see now that ShowWindow is a JScript func.. but this doesn't work:

        var handle = Window.Handle;
       
        ShowWindow (handle, SW_HIDE);

I do have SW_HIDE defined and the Window as well...

-Paril


RE: [Help] EditControl scroll bar by deAd on 05-01-2007 at 11:42 PM

to call an API function, use Interop::Call. Since ShowWindow is in User32.dll, use this:

Interop.Call("User32.dll", "ShowWindow", handle, SW_HIDE);


RE: [Help] EditControl scroll bar by Paril on 05-02-2007 at 12:06 AM

Ooh! That makes more sense.. thanks

EDIT: Perfect, exactly what I need. Thanks.

-Paril


RE: [Help] EditControl scroll bar by Matti on 05-02-2007 at 12:30 PM

quote:
Originally posted by deAd
to call an API function, use Interop::Call. Since ShowWindow is in User32.dll, use this:

Interop.Call("User32.dll", "ShowWindow", handle, SW_HIDE);
...and since you want to hide a control, you might want to know you can do this:
code:
var Wnd = MsgPlus.CreateWnd("Windows.xml", "MyWindow"); //Just to tell you that Wnd is a PlusWnd object, I think you already created the window before
var handle = Wnd.GetControlHandle("Btn1"); //The magic part: returns the handle of the control, since controls are in fact child windows in the window. ;)
Interop.Call("User32.dll", "ShowWindow", handle, SW_HIDE); //Make sure SW_HIDE = 0


RE: [Help] EditControl scroll bar by Paril on 05-02-2007 at 11:04 PM

That's exactly what I did. :)

-Paril