GUI button click does not work [SOLVED]

Started by spook1, Thu 16/03/2006 22:33:24

Previous topic - Next topic

spook1

I created my own GUI and want to see a lable change value as I click a button.
When I click the button nothing happens though.

I am obviously missing something trivial, but what???

I have aÃ,  GUI with button: High_up


#sectionstart High_up_ClickÃ,  // DO NOT EDIT OR REMOVE THIS LINE
function High_up_Click(GUIControl *control, MouseButton button) {
Ã,  if (HV < 296) { HV = HV + 5;}
}
#sectionend High_up_ClickÃ,  // DO NOT EDIT OR REMOVE THIS LINE

The int HV is exported to my room.
In the repeatedly execute of the room I call:

function room_b() {
Ã,  // script for Room: Repeatedly execute
Ã,  Ã, 
Ã,  String buf = String.Format("%d", HV);
Ã,  High_value.Text = buf;
Ã, 
}
#sectionend room_bÃ,  // DO NOT EDIT OR REMOVE THIS LINE

Ashen

#1
The obvious things to check:
  • Have you assigned the High_up_Click function to the button, in the editor?
  • Is HV less than 296?
  • Are you in the right room? (The one with the rep_ex code.)

    Assuming you've got those out of the way:
    Try adding a Display command or two to High_up_Click, to check if it's running at all, e.g.:
    Code: ags
    
    function High_up_Click(GUIControl *control, MouseButton button) {
      Display("Button Pressed.");
      if (HV < 296) { 
        HV = HV + 5;
        Display("HV Changed.");
      }
    }
    


    That'd give a better idea where the problem is. If both display but the label still doesn't update, try moving the rep_ex code into High_up_Click.
I know what you're thinking ... Don't think that.

spook1

Wow, thats fast! Thanks!

I have tried the displays, but it seems that the buttons is not pressed.

In the Gui editor I have set for the button:

left click : run script
Click:        High_up_Click

I have only one room at the moment.

I am afraid it is something stupid.

I have the HV value declared in the global script (since I process them there by the button-click events)
From the global script I export it to the room script.

I try to clikc with a mouse.Mode = 6 (pointer). Also the mdes for walking, looking do not work ...

other suggestions??




Ashen

The cursor mode shouldn't affect clicking the GUI buttons (unless you mean look and walk aren't working anywhere?)
Do you have any other buttons (or other controls) on the GUI, and if so, do they work?

Is it possible that there's something (e.g. a transparent GUI) under the mouse, blocking the clicks? Could the GUI be set as not 'Clickable'?
I know what you're thinking ... Don't think that.

spook1

 :-[
Gui was set as not clickable.
:-[
Very stupid indeed. Sorry to have bothered you.
That is why I could not find the answer in the forums. The question was too stupid ;-)

Thanks for helping, suggesting these extreme simple things is really clever.
Regards,

Martijn

SMF spam blocked by CleanTalk