Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Ronsen on Sun 07/04/2013 23:02:04

Title: Ignore or don't display text on GUI Buttons (SOLVED!)
Post by: Ronsen on Sun 07/04/2013 23:02:04
Hello Everyone,

for some reasons I need to set some text to my GUI buttons, but this text should not be displayed on the button itself, it just should display the button-image.
I realized when the button-text is set to "New Button" or something that starts with "(IN*)" for example (INVSHR) or (INVENTORY),
that AGS is going to NOT display the text on the button. Is there some kind of internal ignore-check for some "keywords"? If yes, could I modify/extend this list?

Thank you ;)

me <- noob sry!
Title: Re: Ignore or don't display text on GUI Buttons
Post by: Khris on Sun 07/04/2013 23:18:31
AGS has some special keywords for button text, but you cannot modify this list without altering the engine.

How about you explain why you want to put text on a button when you don't want it to be displayed?
I'm fairly certain there's a better way of achieving what you want, whatever it is.
Title: Re: Ignore or don't display text on GUI Buttons
Post by: Slasher on Mon 08/04/2013 08:06:16
Do you only want text to display under certain conditions?

You could set the Button to display nothing and then let it display text when it's appropriate.

Code (AGS) Select
BStart.Text=""; // Shows no text on the Button (BStart).
----------------------------------------------
BStart.Text="Start"; // Will display the word 'Start' on the Button (BStart) or whatever you want it to display.




Title: Re: Ignore or don't display text on GUI Buttons
Post by: Ronsen on Mon 08/04/2013 10:32:56
Hi,
thanks for your response, actually I'm using SSH's "Description Module 1.06" to display text for objects, items, hotspot stuff and
I thought it might be good to display some text/hints for some of my buttons as well i.e. Inventory (Description.ButtonswithFont).

Well, I could set some blanks in the text field to move it "out of the way", like
Code (AGS) Select
btnInv.Text = "            Inventory";
and then fiddle around with the x,y coordinates to get the description overlay back in the right place, but hell thats dirty ;)

I'm happy for any other suggestion ...
Title: Re: Ignore or don't display text on GUI Buttons
Post by: Khris on Mon 08/04/2013 11:14:10
I see, here's what I'd do:
Code (ags) Select
String ButtonName() {
  GUIControl* gc = GUIControl.GetAtScreenXY(mouse.x, mouse.y);
  if (gc == null) return "";
  Button* b = gc.AsButton;
  if (b == null) return "";
  if (b == btnLoadGame) return "Load Game";
  if (b == btnInv) return "Inventory";
  ...
}


You can now use this to "teach" the Description Module to use those custom strings whenever the mouse is over a button.
Something like:
Code (ags) Select
  // module's repeatedly_execute
  String btn = ButtonName();
  if (btn.Length > 0) description_string = btn;
  else {
    ... // usual behavior
  }
Title: Re: Ignore or don't display text on GUI Buttons
Post by: Ronsen on Mon 08/04/2013 12:20:05
You did it! :-)