Ignore or don't display text on GUI Buttons (SOLVED!)

Started by Ronsen, Sun 07/04/2013 23:02:04

Previous topic - Next topic

Ronsen

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!

Khris

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.

Slasher

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
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.





Ronsen

#3
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
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 ...

Khris

I see, here's what I'd do:
Code: ags
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
  // module's repeatedly_execute
  String btn = ButtonName();
  if (btn.Length > 0) description_string = btn;
  else {
    ... // usual behavior
  }


SMF spam blocked by CleanTalk