x


Gui.Button over Gui.TextArea does not work. Why?

I place a Gui.Button over a Gui.Textarea. And if i try to click it it always selects the Gui.Textarea under it.

Is there a way to solve this problem?

more ▼

asked Jun 27 '10 at 05:11 PM

Case23 gravatar image

Case23
441 17 21 30

(comments are locked)
10|3000 characters needed characters left

2 answers: sort newest

(really) hacky way to fix it quickly:

GUI.Button(blah);
GUI.TextArea(other blah);
GUI.Button(blah);

It uses the first button for input, the second to get drawn on top of the text box

The alternative is to handle the event catching yourself before the text box, use the event if it hits the button's position, and then call your if function and change the style of the button to make it look active

more ▼

answered Jun 27 '10 at 09:56 PM

Mike 3 gravatar image

Mike 3
30.5k 10 65 253

I managed it another way. draw a box for the background. and a smaller textarea above the box. So, where the button is there is no textarea anymore. But thanks for the hack. ;)

Jun 29 '10 at 12:38 PM Case23

Sounds good - overlapping controls do sound like a bad idea ;)

Jun 29 '10 at 12:51 PM Mike 3
(comments are locked)
10|3000 characters needed characters left

If your Button is in a separate OnGUI function, you could try playing around with GUI.depth. If it isn't, maybe you could try reordering which gets rendered first. You probably want the button after the textarea.

more ▼

answered Jun 27 '10 at 05:49 PM

Tetrad gravatar image

Tetrad
7.2k 27 37 89

It is in the same Gui call, and how my Gui Menu works, it would be not nice to put it outside of this. And the Button is called after the textfield. Becouse my textfield has a solid color background and if i wouldnt do it, i wouldnt see it. But the realy strange thing is, if it is behind the textfield, the button works fine. :/

Jun 27 '10 at 05:51 PM Case23

GUI.depth solved all my GUI.button/input conflicts, thank-you!!

Nov 18 '10 at 12:35 AM yoyo
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3688
x788
x55

asked: Jun 27 '10 at 05:11 PM

Seen: 1962 times

Last Updated: Jun 27 '10 at 05:11 PM