Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 03-11-2009, 03:51 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
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.
__________________
Reply With Quote
  #2  
Old 03-11-2009, 05:13 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
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.
__________________

Last edited by Crow; 03-11-2009 at 08:50 PM..
Reply With Quote
  #3  
Old 03-11-2009, 11:15 PM
Dan Dan is offline
Daniel
Join Date: Oct 2007
Posts: 383
Dan is an unknown quantity at this point
Send a message via MSN to Dan
Quote:
Originally Posted by cbk1994 View Post
Does anyone have any ideas? I've never needed to do this before.
Can you post part of the code?
__________________
Reply With Quote
  #4  
Old 03-11-2009, 11:19 PM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
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.
__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
  #5  
Old 03-11-2009, 11:26 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by Tigairius View Post
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.
__________________
Reply With Quote
  #6  
Old 03-11-2009, 11:34 PM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
Quote:
Originally Posted by cbk1994 View Post
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.
__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
  #7  
Old 03-11-2009, 11:38 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by Tigairius View Post
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.
__________________
Reply With Quote
  #8  
Old 03-11-2009, 11:45 PM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
Quote:
Originally Posted by cbk1994 View Post
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;

__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 10:07 AM.


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