Game Development Community

GuiControl Questions

by Nick Zafiris · in Torque Game Engine · 08/02/2004 (6:34 am) · 5 replies

Hey everyone I got a few questions if you could help me. Here it goes.

1. I am displaying an image using GuiBitmapCtrl and I'm trying to issue a "command" when you click on the image (I want it to disappear when you click on it). However, the command does not get called but if I use a GuiBitmapButtonCtrl, then it works.

The problem is, I don't need all the button states required with GuiBitmapButtonCtrl because then I would have to store 5 copies of the same image (image_h, image_i, etc.)
Is there a way to just use a single bitmap (GuiBitmapCtrl)?

2. Also, any ideas on how I should start if I want to drag a bitmap around and place it in a box using script?

3. And finally, is there somekind of guide that shows what each Gui control provided by the engine does? Cause there are many and I'd like to take advantage of some.

Thanks in advance,
Nick

#1
08/02/2004 (7:26 am)
1. Actually, if it can't find an image, it will just use the base/what it can find. You shouldn't need to store more than one. GuiBitmapCtrl is just for displaying stuff.

2. Look at how the GuiEditor does it?

3. Unfortunately, there is not. It is on our todo list but we're focusing on more important things (like the overall scripting reference!) first. With a bit of experimentation (and/or study of the C++) you should be able to get up and running with what's there.
#2
08/02/2004 (1:44 pm)
Thanks for your reply Ben. Here's what I've got.

1. I was able to just use one image like you said (image_n.png) with GuiBitmapButtonCtrl, however I get errors in the console every time I display it saying that it cannot find the other four image files. The errors don't affect the game, they just fill up the console.

2. Looking at how it is done in the GuiEditor is a good idea, I'll try that. I could use some pointers though on how to make them snap into place when I drag them over a box. Just like in an inventory gui or like the cards in Solitaire.

Thanks again.
Nick
#3
08/02/2004 (1:59 pm)
1. Yes, that's true. We've been trying to find a good way to deal with that situation, but nothing really great has come to mind. Sometimes you want to know the error and other times you don't, but it's hard to distinguish from code.

2. There are some drag and drop resources, I think.

Best of luck!
#4
08/03/2004 (12:05 am)
Thanks again Ben!
I did do a quick grep though and couldn't find which file produces those error messages. Maybe I'll just leave it like that.

I was aware of the drag and drop resource but I thought I might wanna try myself and learn a few things but it's not easy.

Nick
#5
08/04/2004 (6:44 am)
Ok for number 1 in my first post I found out after playing around with the C++ code that you can have a simple GuiBitmapCtrl and make it's "command" field functional.

You need to add "onMouseDown" and "onMouseUp" GuiEvent functions.
Within the onMouseUp function add an "onAction()" call.

The key word is onAction. This tells the control that when the mouse button is released after it has been pressed to execute whatever is in the "command" field.

Now I know a little more about how GUI controls work!

Nick