SUGGESTION: Button.Click()

Started by Alynn, Tue 08/11/2005 01:10:17

Previous topic - Next topic

Alynn

This suggestion came to me when trying to map the arrow keys to the gui arrow keys for my game, which is in first person view.

Being OO as I am I tried this first

Code: ags

if (gUpbutton.Visible == true && keycode == 372){
    gUpbutton.Controls[0].AsButton.Click();
  }


Which of course doesn't work, because Click doesn't exist. I can work around it by calling

ButtonUp_Click(gUpbutton.Controls[0], eMouseLeft);

EDIT: It seems I'll have to adjust where my functions lie because the ButtonUp_Click function is after the on key press function... which is really a pain so the button.click is still my best bet :)

Now... we could add something like Click(int mouseButton) just so the correct mouse button is passed, but thats for you to decide.

I'm sure other interesting things could be come up with for other gui controls, but I can't think of any off the top of my head right now...

Thanks :)

Gilbert

Hehe this is extremely easy to do before OO though, just call interface_click() directly. ;)

strazer

Yeah, I think a Button.RunInteraction(CursorMode) function similar to those of Characters and Objects is a good idea.

monkey0506



monkey0506

#5
Sorry for dragging this back up, but I've suddenly realized how much I need it if I'm not just going to use interface_click.  You see, in the MI GUI, pressing Enter (13) is the same as left-clicking the mouse, and Tab (9) is the same as right-clicking.

So, in order to allow that, I would have to check if there was GUI beneath the mouse, and then call the appropriate click function, but I can't do it if they are all spread out and named based on the GUI's name.

[EDIT:]

Even if an optional parameter could be added to ProcessClick to make it not ignore GUIs, that would solve my problem.

The main reason I'm bringing it back up is to ask if it can get implemented soon.  Not necessarily the next beta, but by the next official version please?

[EDIT:]

Actually I think I just realized that this only asks about Buttons.  I would find it much more intuitive for it to be implemented for GUIs and all the GUIControl types.

Pumaman

There is a technical reason for this not being implemented yet, however it's something I'll need to overcome at some point so I'll look into it.

monkey0506

#7
Well for now I'll just have to use interface click then, because I need to be able to click on GUIs with the enter key.  Thanks anyway.

[EDIT:]

Actually, after considering it for a moment, I could leave the OO functions in place, move interface_click after them, and then use interface_click to call the appropriate function.

SMF spam blocked by CleanTalk