Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 08-11-2011, 11:38 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
GuiShowImgCtrl MouseDown

I was wondering how I would detect if I have clicked the image in the GuiShowImgCtrl so that I can use it as a button.
PHP Code:
//#CLIENTSIDE
function onCreated() {
  new 
GuiShowImgCtrl("Control_One") {
    
1300;
    
50;
    
width 35;
    
height 35;
    
image "bubble_icon.png";
    
hint "This is a button.";
  }

I want to be able to click the image, and make something happen, but I don't know how to do that. Can anybody help out? Is it matter of checking if the mouse is over the image and then using onMouseDown?
__________________
Reply With Quote
  #2  
Old 08-11-2011, 11:41 PM
Mark Sir Link Mark Sir Link is offline
Kevin Azite
Mark Sir Link's Avatar
Join Date: Sep 2005
Posts: 1,489
Mark Sir Link is just really niceMark Sir Link is just really nice
Send a message via AIM to Mark Sir Link
Control_One.onMouseDown()
Reply With Quote
  #3  
Old 08-11-2011, 11:47 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
xD Thank you.
__________________
Reply With Quote
  #4  
Old 08-11-2011, 11:51 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
All of these events are also usable by GuiShowImgCtrl because it inherits the functionality of GuiControl.

PHP Code:
onAdd() - is invoked when the control is added to another control (addcontrol function) 

onRemove() - is invoked when the control is removed from its parent 

onShow
() - is invoked when the control is shown or gets awakened while being 'visible' 

onHide() - is invoked when the control is made hidden 

onWake
() - is invoked when the control is awakened and becomes visible on the screen 

onSleep
() - is invoked for windows when a dialog window is removed from the screen 

onMove
(newx,newy) - is invoked when the control is moved 

onResize
(newwidth,newheight) - is invoked when the control is resized 

onAction
() - is invoked when a button control is pressedyou press the enter-key in a text edit control, or move a slider control

onDialogPush() - is invoked when a dialog control is placed on the screen (using pushDialog(control)) 

onDialogPop() - is invoked when a dialog control is removed from the screen again (using popDialog()) 

onKeyDown(keycode,keystring,scancode) - a key has been pressed while the control had the input focus (makeFirstResponder()) 

onKeyUp(keycode,keystring,scancode) - the key has been released 

onMouseYawPitch
(xaxis,yaxis) - mouse event in Graal3D when the mouse has been turned off 

onMouseDown
(keymodifier,mousescreenx,mousescreeny,clickcount) - the left mouse button has been pressed inside this control 

onMouseUp
(keymodifier,mousescreenx,mousescreeny) - the left mouse button has been released 

onMouseEnter
(keymodifier,mousescreenx,mousescreeny) - the mouse moved inside this control 

onMouseLeave
(keymodifier,mousescreenx,mousescreeny) - the mouse left the control 

onMouseDragged
(keymodifier,mousescreenx,mousescreeny) - the mouse is moved while the left mouse button is pressed 

onMouseMove
(keymodifier,mousescreenx,mousescreeny) - the mouse has been moved 

onRightMouseDown
(keymodifier,mousescreenx,mousescreeny,clickcount) - the right mouse button has been pressed

onRightMouseUp
(keymodifier,mousescreenx,mousescreeny) - the right mouse button has been released 

onRightMouseDragged
(keymodifier,mousescreenx,mousescreeny) - the mouse has been moved while the right mouse button is pressed 

onMouseWheelUp
(keymodifier) - the mouse wheel has been scrolled up 

onMouseWheelDown
(keymodifier) - the mouse wheel has been scrolled down 
Source: http://wiki.graal.net/index.php/GuiControl

The GUI Documentation is actually quite decent on the gBible. I would recommend checking there before anything else.
__________________
Quote:
Reply With Quote
  #5  
Old 08-12-2011, 12:00 AM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
Quote:
Originally Posted by fowlplay4 View Post
All of these events are also usable by GuiShowImgCtrl because it inherits the functionality of GuiControl.

PHP Code:
onAdd() - is invoked when the control is added to another control (addcontrol function) 

onRemove() - is invoked when the control is removed from its parent 

onShow
() - is invoked when the control is shown or gets awakened while being 'visible' 

onHide() - is invoked when the control is made hidden 

onWake
() - is invoked when the control is awakened and becomes visible on the screen 

onSleep
() - is invoked for windows when a dialog window is removed from the screen 

onMove
(newx,newy) - is invoked when the control is moved 

onResize
(newwidth,newheight) - is invoked when the control is resized 

onAction
() - is invoked when a button control is pressedyou press the enter-key in a text edit control, or move a slider control

onDialogPush() - is invoked when a dialog control is placed on the screen (using pushDialog(control)) 

onDialogPop() - is invoked when a dialog control is removed from the screen again (using popDialog()) 

onKeyDown(keycode,keystring,scancode) - a key has been pressed while the control had the input focus (makeFirstResponder()) 

onKeyUp(keycode,keystring,scancode) - the key has been released 

onMouseYawPitch
(xaxis,yaxis) - mouse event in Graal3D when the mouse has been turned off 

onMouseDown
(keymodifier,mousescreenx,mousescreeny,clickcount) - the left mouse button has been pressed inside this control 

onMouseUp
(keymodifier,mousescreenx,mousescreeny) - the left mouse button has been released 

onMouseEnter
(keymodifier,mousescreenx,mousescreeny) - the mouse moved inside this control 

onMouseLeave
(keymodifier,mousescreenx,mousescreeny) - the mouse left the control 

onMouseDragged
(keymodifier,mousescreenx,mousescreeny) - the mouse is moved while the left mouse button is pressed 

onMouseMove
(keymodifier,mousescreenx,mousescreeny) - the mouse has been moved 

onRightMouseDown
(keymodifier,mousescreenx,mousescreeny,clickcount) - the right mouse button has been pressed

onRightMouseUp
(keymodifier,mousescreenx,mousescreeny) - the right mouse button has been released 

onRightMouseDragged
(keymodifier,mousescreenx,mousescreeny) - the mouse has been moved while the right mouse button is pressed 

onMouseWheelUp
(keymodifier) - the mouse wheel has been scrolled up 

onMouseWheelDown
(keymodifier) - the mouse wheel has been scrolled down 
Source: http://wiki.graal.net/index.php/GuiControl

The GUI Documentation is actually quite decent on the gBible. I would recommend checking there before anything else.
Oh wow. Thank you very much. I will rep you when I get a rep refill.
__________________
Reply With Quote
Reply


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 11:34 PM.


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