Button Click function, correct version

Posted By: Ness

Button Click function, correct version - 05/17/09 16:31

hullo,
i made a small example and can someone explain me ,why i cant click on the button?

Click to reveal..

function main()
{
level_load("questimage.wmb");
camera.ambient = 100;
mouse_mode = 2;
enable_mouse = 1;

}



Panel motherbutton
{
pos_X = 55;
pos_y = 55;
flags =refresh,visible,d3d;
button(0,0,motherboardpush,motherboardnormal,motherboardnormal,openmother,NULL,NULL);
}


All images are correctly imported! BUT i cant see the "clicked" Button Form,if i click! how can i disable this? AND it doesnt react to nothing if i enter code on clicked function!!!
Would be nice if someone could help me!


EDIT: DONT think that i forgot something like button_clicked() on the upper part of the code! i didnt included it!
Posted By: Ottawa

Re: Button Click function, correct version - 05/17/09 22:48

Hi!

Are you using Lite-C?

Try : flags = VISIBLE; // capital letters for all flags.

Is your panel after main or before main?

Ottawa smile
Posted By: Cowabanga

Re: Button Click function, correct version - 05/18/09 14:05

Quote:
Try : flags = VISIBLE;

Or: flags = SHOW; // if you're using GS 7.66 and up
Posted By: Jaeger

Re: Button Click function, correct version - 06/06/09 08:15

I think this is kind of old, but oh well.. maybe he/she still needs help. Why don't you try this:

Code:
function main()
{
level_load("questimage.wmb");
camera.ambient = 100;
mouse_mode = 2;
enable_mouse = 1;

}



PANEL* motherbutton =
{
pos_x = 55;
pos_y = 55;
FLAGS = OVERLAY | VISIBLE;
button(0,0,motherboardpush,motherboardnormal,motherboardnormal,openmother,NULL,NULL);
}


I'm assuming this is only PART of your code, right? If this is all of it, you don't have a function openmother() defined, which would obviously be a problem. I've never seen "flags = d3d" or "flags = refresh" used on panels before... ever... I suggest you download the Lite-C workshops and read through the manual as you work. It will help a LOT. laugh

EDIT: Wait, are you using C-Script or Lite-C? I re-wrote the code for Lite-C. If you're just beginning programming, you should just go ahead and learn Lite-C, instead of C-script.
© 2024 lite-C Forums