Right: I've got a textbox and an associated button next to it. Is there any other way to call the button_click function on hitting enter than trickstering around with the key_press function and if - Structures?
I don't think there is, but it isn't a big deal...
if (keycode == 13) { // was enter, I think. Double-check that, though.
Ã, if (gTextbox.Visible == true) {
Ã, Ã, button_click();
Ã, }
}
You just need to make sure the button_click function is before the on_key_press function for this to work.
If there's a TextBox on the GUI, on_key_press AFAIK won't run - the TextBox claims all keypresses. Just call the Button's control function from the TextBox's, e.g.:
function btnText_Click(GUIControl *control, MouseButton button) {
DoStuff();
}
function txtText_Activate(GUIControl *control) {
btnText_Click(txtText, eMouseLeft);
}
It shouldn't matter what parameters you use when you call it, provided they're there.
Thanks Ashen, my problem is solved :)