Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   GUIs in a QMenu (https://forums.graalonline.com/forums/showthread.php?t=73791)

cbk1994 05-03-2007 01:59 AM

GUIs in a QMenu
 
I made a Q Menu which uses GuiShowImgCtrls to show the images. It all works fine, except I need to make a dropping system. There's no way to tell if the item is being dragged! Any suggestions?

Rapidwolve 05-03-2007 02:00 AM

Why would you make it with GUI controls, just curious...

godofwarares 05-03-2007 02:01 AM

Quote:

Originally Posted by cbkbud (Post 1305148)
I made a Q Menu which uses GuiShowImgCtrls to show the images. It all works fine, except I need to make a dropping system. There's no way to tell if the item is being dragged! Any suggestions?

Use GuiShowImg controls to make the images to begin with, and you can use thiso.catchevent(this.name, "onMouseDrag", "onDragItem"); or something. The first parameter should be the variable the GuiShowImg is represented by.

Quote:

Originally Posted by Rapidwolve
Why would you make it with GUI controls, just curious...

I made mine on Niromia with GUI Controls, and I usually make image-based GUIs using GuiDrawingPanel. Although in this case, I would agree that using a showimg would be much better.

cbk1994 05-03-2007 02:03 AM

Quote:

Originally Posted by Rapidwolve (Post 1305149)
Why would you make it with GUI controls, just curious...

How do you propose I do it?

godofwarares 05-03-2007 02:07 AM

Quote:

Originally Posted by cbkbud (Post 1305151)
How do you propose I do it?

PHP Code:

showimg(1000"image.png"00).layer 4

... Would show an image at (0, 0) on the screen layer.
Thats basically how GUIs themselves are made :P

Rapidwolve 05-03-2007 02:09 AM

Quote:

Originally Posted by cbkbud (Post 1305151)
How do you propose I do it?

showimg()

cbk1994 05-03-2007 02:13 AM

Quote:

Originally Posted by Rapidwolve (Post 1305154)
showimg()

eww.

xXziroXx 05-03-2007 02:34 AM

Quote:

Originally Posted by Rapidwolve (Post 1305149)
Why would you make it with GUI controls, just curious...

I made mine on Mythic using GUI controls too y'know.

Rapidwolve 05-03-2007 02:45 AM

Quote:

Originally Posted by cbkbud (Post 1305155)
eww.

Its ew but apparently you have no other choice, unless you wanted to script your own function which would be quite simple.

Inverness 05-03-2007 11:45 PM

showimg() is simply exists for compatibility and is really just creating a TShowImg object. The GuiShowImgCtrl object extends GuiControl then implements TShowImg which adds support for offset inside of the control itself and interactions with other GUI Controls.

The findimg() function creates a new image (TShowImg) of the specified ID if one cannot be found. However, objects that extend GuiControl are all static and can be changed from distant objects, this might or might not be useful in your case.

In the end, I would suggest using GuiShowImgCtrl because it inherits all features of GuiControl, obviously designed for GUIs. Using showImg() will not give you these features.

cbk1994 05-04-2007 03:05 AM

Quote:

Originally Posted by Inverness (Post 1305330)
showimg() is simply exists for compatibility and is really just creating a TShowImg object. The GuiShowImgCtrl object extends GuiControl then implements TShowImg which adds support for offset inside of the control itself and interactions with other GUI Controls.

The findimg() function creates a new image (TShowImg) of the specified ID if one cannot be found. However, objects that extend GuiControl are all static and can be changed from distant objects, this might or might not be useful in your case.

In the end, I would suggest using GuiShowImgCtrl because it inherits all features of GuiControl, obviously designed for GUIs. Using showImg() will not give you these features.

I know, that's why I use it. What I need to know is how to tell if it is being dragged. I can't find any variable, and there's no event for this.

Inverness 05-04-2007 06:35 AM

Quote:

Originally Posted by cbkbud (Post 1305359)
I know, that's why I use it. What I need to know is how to tell if it is being dragged. I can't find any variable, and there's no event for this.

Well for one, I don't think you should be dragging the GUI image itself, but rather when the mouse is held down on it you create a second separate icon that follows the position of the mouse on screen.

But there is an event that might help you.
Quote:

Originally Posted by Graal Bible
onMouseDragged(keymodifier,mousescreenx,mousescree ny) - the mouse is moved while the left mouse button is pressed

http://wiki.graal.net/index.php/Crea...ent/GuiControl

middo 05-04-2007 10:53 AM

there is an onMove event you can listen for if you want. But that's not really what you want.

All I did was check the onMouseUp event (not exact name..) and checked to see if the new x was same as old x kinda thing.

cbk1994 05-05-2007 01:11 AM

Quote:

Originally Posted by Inverness (Post 1305392)
Well for one, I don't think you should be dragging the GUI image itself, but rather when the mouse is held down on it you create a second separate icon that follows the position of the mouse on screen.

But there is an event that might help you.

http://wiki.graal.net/index.php/Crea...ent/GuiControl

Okay, thanks.

When I first looked at that, I must have misread it, or skipped over it by accident.


All times are GMT +2. The time now is 05:42 PM.

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