Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.
 Entire forum ➜ MUSHclient ➜ General ➜ Customising the scrollbar

Customising the scrollbar

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by KaVir   Germany  (117 posts)  Bio
Date Thu 02 Sep 2010 08:29 PM (UTC)
Message
Does anyone know how to customise the scrollbar? I did a quick search, and found some discussion about creating scrollbars for miniwindows, but what I was hoping to do is reposition the current scrollbar - the one for the main text window. I did find an old thread where it was mentioned, with a comment about it being "fiddly" - but presumably not impossible?

This is a doctered screenshot showing what I would like to do:

http://www.godwars2.org/images/plugin_with_scrollbar.png

As you can see, the text window is clearly separated from the rest of the interface - so I think it looks a bit strange for the scrollbar to appear on the far right.

It would be even nicer if I could also change the colours and the up/down icons. Is there any easy way to do this? Or is it going to require a special miniwindow?

Thanks in advance for any help!
Top

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #1 on Thu 02 Sep 2010 08:32 PM (UTC)
Message
As far as I am aware it is not currently possible. You certainly have a delicious UI though. :)

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
Top

Posted by Worstje   Netherlands  (899 posts)  Bio
Date Reply #2 on Thu 02 Sep 2010 09:03 PM (UTC)
Message
I think that would be really difficult to implement. If the MUSHclient output control is written in the way most Windows controls are written, that means it is based on a 'scrollable window' which has a handle. The OS takes care of the scrolling mechanic as it is part of the non-client area, which is why it is one of very few things in MUSHclient actually theming along with the rest of your PC while other things such as buttons and the input box are not.

Making the scrollbar stay with the output area definitely makes sense from a user standpoint, but implementing it would very likely take a lot of work, be it by splitting the display up into different parts so Windows can take care of scrolling after all, which would open the door to more focus issues than the ones we've had in the past, or Nick can draw his own and all that fancy schmancy stuff.

Imo, the effort is not worth the time it takes to implement.
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #3 on Thu 02 Sep 2010 09:05 PM (UTC)
Message
Why not measure how much space is taken by the GUI widgets, and request a resize of the text window to an appropriate value?

Of course, this might get tricky if you resize the whole window...

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Nick Gammon   Australia  (23,120 posts)  Bio   Forum Administrator
Date Reply #4 on Thu 02 Sep 2010 09:34 PM (UTC)
Message
The TextRectangle function resizes the text, the scrollbar stays in the same place. Worstje is right. :-)

To achieve what you want you probably need to do something like Fiendish's scrolling chat window and throw the main text window away (ie. put a miniwindow on top of it).

You then need to implement the scrollbar (but he did that). You also need to address the issue of getting reasonable performance, but that shouldn't be too bad as long as you don't intend to resize it all the time.

Then you can make the scrollbar look however you want.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by KaVir   Germany  (117 posts)  Bio
Date Reply #5 on Fri 03 Sep 2010 09:23 AM (UTC)
Message
I was really hoping to avoid losing the text window...but if I did go that route, could I hide the original scrollbar? Or would that remain on the right, and just be non-functional?

Is there perhaps a way to get and set the position of the scrollbar's thumb? If I could do that, then I could create a miniwindow scrollbar that acts as an interface for the real scrollbar, and continue using the text window as normal.
Top

Posted by Nick Gammon   Australia  (23,120 posts)  Bio   Forum Administrator
Date Reply #6 on Fri 03 Sep 2010 10:06 AM (UTC)
Message
Hmm - this is the first time I have been asked to make the scrollbar invisible, but I don't see any major objection, subject to looking at the code.

Or I suppose another approach is to move the scrollbar. I think Wortje is right about it being in the non-client area, but well, what's a client area between friends? Might have to look at the code for that too.

It's possible that MFC will "helpfully" not let me do that, but I'll look into that in the morning.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Worstje   Netherlands  (899 posts)  Bio
Date Reply #7 on Fri 03 Sep 2010 10:30 AM (UTC)
Message
If the scrollbar will actually start to move along with the TextRectangle (probably an improvement!), let me point out a few things I have experienced over the years involving scrollbars.

1. Please try to stick to the OS look, including the resizing thumb and hopefully theme awareness. While I know the former has more use than the latter, I believe it is time for MUSHclient to start playing nice with themes on an as-we-modify-stuff basis. Themes have been around since 2001. 2011 is coming up. If you design it properly from the start, you can just use the theming APIs and such to draw the scrollbar as opposed to reinventing the wheel.

2. Add some kind of global option of 'Scrollbar does not stick with TextRectangle', which by default would be turned off. Reason is that in the past, I've been on plenty of computers with the worst mouse drivers in history. Rather than implementing scrolling as sending a WM_MOUSEWHEEL message saying to go up or down, they would momentarily make the mouse jump to the topright or bottomright corner, simulate a click, and move it back. Yeah, I could actually see the mouse flicker to those locations. :(

3. Implement the new scrollbar so it is WITHIN the text rectangle area, not right outside of it. (Probably a no-brainer, but saying it just to be certain it has been mentioned.)

4. Not sure how well MUSHclient plays with RTL languages/locales at this time, but I believe MUSHclient is used in such places. I'm sure those people would appreciate having their scrollbar on the left side where appropriate. (Not really something I care about, but some things are better implemented at the start than added when someone complains about it.)
Top

Posted by KaVir   Germany  (117 posts)  Bio
Date Reply #8 on Fri 03 Sep 2010 02:44 PM (UTC)
Message
Nick Gammon said:
It's possible that MFC will "helpfully" not let me do that, but I'll look into that in the morning.

Thanks, I appreciate you looking into it - if it isn't too fiddly, it could make a nice addition to the Aardwolf plugins as well.

Worstje said:
1. Please try to stick to the OS look, including the resizing thumb and hopefully theme awareness

I don't really mind what the defaults are, but I'd very much like the option to customise the scrollbar for my theme. Even the command window lets you customise the colours, after all (although I don't think you can do that directly from a plugin?).

Worstje said:
2. Add some kind of global option of 'Scrollbar does not stick with TextRectangle', which by default would be turned off.

Personally I would suggest that the scrollbar doesn't stick with TextRectangle by default - otherwise it may cause formatting issues with existing plugins. As long as the flag can be easily set within your plugin, it shouldn't be any trouble to add it.

Worstje said:
3. Implement the new scrollbar so it is WITHIN the text rectangle area, not right outside of it.

Or allow it to be defined independently of the TextRectangle, via another function? Eg:

long TextScrollbar(BSTR WindowName, long Left, long Top, long Right, long Bottom, long BorderColour, long BorderWidth, long FillColour, long ThumbColour, long ThumbStyle, long ButtonColour, long ButtonStyle, long Flags);

flag 0: scrollbar sticks to the right of the window (like now)
flag 1: scrollbar sticks to the TextRectangle
flag 2: scrollbar can be freely positioned

Or maybe that's too complex...if you could draw a miniwindow over the top, perhaps that would be enough to handle whatever cosmetic customisations were required.
Top

Posted by Nick Gammon   Australia  (23,120 posts)  Bio   Forum Administrator
Date Reply #9 on Fri 03 Sep 2010 11:45 PM (UTC)
Message
OK, well the client is starting to look like a cat that someone wants to behave like a chicken, but as far as possible I am trying to accomodate these requests without things getting out of hand.

I am experimenting with a new function SetScroll that lets you do two things:


  • Hide the existing scroll bar if desired
  • Set the "scroll position" in the output window


The first feature (hiding the scroll bar) lets you, well, hide it, so that you can draw your own wherever you want (eg. with a themed miniwindow somewhere near where the text appears).

The second lets your code scroll the text around (so you can still use the existing output buffer) in response to the player clicking and dragging on "your" thumb, or arrows.

So for example, to hide the scroll bar, and go to the top of the screen:


SetScroll (0, false)


To scroll to the bottom (-1 is a special case):


SetScroll (-1, false)


Scrolling up and down in pages is a case of finding the current scroll position, and adding to it by an appropriate amount.


- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Nick Gammon   Australia  (23,120 posts)  Bio   Forum Administrator
Date Reply #10 on Sat 04 Sep 2010 07:27 AM (UTC)

Amended on Sat 04 Sep 2010 07:36 AM (UTC) by Nick Gammon

Message
This is what his image looks like, in case the link goes down:


- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


32,222 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.