Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   GuiShowImgCtrl MouseDown (https://forums.graalonline.com/forums/showthread.php?t=134264186)

Emera 08-11-2011 11:38 PM

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?

Mark Sir Link 08-11-2011 11:41 PM

Control_One.onMouseDown()

Emera 08-11-2011 11:47 PM

xD Thank you.

fowlplay4 08-11-2011 11:51 PM

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.

Emera 08-12-2011 12:00 AM

Quote:

Originally Posted by fowlplay4 (Post 1663145)
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.


All times are GMT +2. The time now is 08:45 PM.

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