Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Mouse wheel scrolling (https://forums.graalonline.com/forums/showthread.php?t=84615)

cbk1994 03-11-2009 03:51 AM

Mouse wheel scrolling
 
I'm creating an inventory, and I'm using a GuiScrollCtrl to display the items. The problem I'm having is that the mouse scroll wheel scrolls at some odd number, whereas I'd like to control it.

I've tried changing 'mousescrolllines' (which has an effect, but can't be set to zero or to a decimal). I've also tried setting 'active' to false, but this makes all the controls in it un-clickable.

Basically, I would like a way to scroll the control manually when the scroll wheel is moved.

Does anyone have any ideas? I've never needed to do this before.

Crow 03-11-2009 05:13 PM

I suggest using control.onMouseWheelDown(), control.onMouseWheelUp() and control.scrolldelta() if you can somehow manage to disable the default mousewheel scrolling behavior of the control. I have no idea how you could possibly disable that though, didn't have any similar problems before. I will probably try it when I have some time later today.

Edit: Okay, I played around with that a bit. I couldn't disable the default scroll stuff, and the onMouseWheelDown() and onMouseWheelUp() events don't trigger in the main part of the scroll control. Guess I can't help here.

Dan 03-11-2009 11:15 PM

Quote:

Originally Posted by cbk1994 (Post 1473049)
Does anyone have any ideas? I've never needed to do this before.

Can you post part of the code?

Tigairius 03-11-2009 11:19 PM

If you're talking about the mouse wheel scrolling too many times upon on tick, you can do this to fix:
PHP Code:

function GuiControl.onMouseWheelDown() {
  
this.mouseticks ++;
  if (!(
this.mouseticks 2))
    return;
  
dostuff;


If you mean that the scroll bar is scrolling too fast, use

PHP Code:

function GuiControl.onScrolled(newxnewydeltaxdeltay) {
  
GuiScrollCtrl.scrollto(intint);


and create your own scrolling functionality.

I don't think you can *disable* the default scrolling, which has been a problem for me quite a few times, but if you want to scroll to decimal points, then scrollto should accomplish it fine.

cbk1994 03-11-2009 11:26 PM

Quote:

Originally Posted by Tigairius (Post 1473221)
PHP Code:

function Control.onScrolled(newxnewydeltaxdeltay) {
  
GuiScrollCtrl.scrollto(intint);


and create your own scrolling functionality.

This is the problem, but when I do this, it is very jumpy. I really need a way to just disable mouse wheel scrolling, but it doesn't seem possible.

Tigairius 03-11-2009 11:34 PM

Quote:

Originally Posted by cbk1994 (Post 1473228)
This is the problem, but when I do this, it is very jumpy. I really need a way to just disable mouse wheel scrolling, but it doesn't seem possible.

When scripting my tile editor I had to draw the contents of the scroll manually (like so):
PHP Code:

function GuiControl.onScrolled(nxnydxdy) {
  
ShowImg1.drawimagerectangle(destination x,destination ysource imagesource xsource y,width,height);


Not sure what you're using the scroll control for, but you could possibly do this.

cbk1994 03-11-2009 11:38 PM

Quote:

Originally Posted by Tigairius (Post 1473231)
When scripting my tile editor I had to draw the contents of the scroll manually (like so):
PHP Code:

function GuiControl.onScrolled(nxnydxdy) {
  
ShowImg1.drawimagerectangle(destination x,destination ysource imagesource xsource y,width,height);


Not sure what you're using the scroll control for, but you could possibly do this.

Thanks, I'll try this out and let you know if I have any problems.

Tigairius 03-11-2009 11:45 PM

Quote:

Originally Posted by cbk1994 (Post 1473232)
Thanks, I'll try this out and let you know if I have any problems.

You could probably move the the control inside of the scrollcontrol's x/y if you're not using a showimg. For example:

PHP Code:

function GuiScrollControl.onScrolled(nxnydxdy) {
  
OtherControl.nx;
  
OtherControl.ny;




All times are GMT +2. The time now is 11:42 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.