button wont work

Posted By: enrike

button wont work - 07/24/09 12:01

hi

I must be doing really stupid but i cannot make my button respond to a click. This is the code

////
function test(button_number,panel)
{
printf("on");
}


PANEL* pTest =
{
pos_x = 10; pos_y = 10;
size_x = 150; size_y = 300;

button(10, 10, "boton2.bmp", "boton1.bmp", NULL, test, NULL, NULL);

red = 128;
green = 128;
blue = 128;
flags = LIGHT | VISIBLE;
}
///

The button is there but it never calls the test() function, also it never changes to bmapOn. I tried setting panel and button possition to 0 but does not work. Also I defined the function like this but it did not help.
function test()
{
printf("on");
}

i cannot really see what i am doing wrong. thanks

enrike
Posted By: Widi

Re: button wont work - 07/24/09 12:18

You starts in window-mode? At Fullscreen the message don`t show up. Try sys_exit instead fprint.
Posted By: enrike

Re: button wont work - 07/24/09 12:21

no i am opening a window with no borders but not fullscreen. I have tried to open different type of windows and it never worked.I also tried to set a global variable from the function and it never change its value. I changed the bitmaps to pcx as well, and set mouse_mode to different values. I am using Vindows Vista with A7 version 7.02.4
Posted By: Widi

Re: button wont work - 07/24/09 12:26

UPDATE !!!!!
Posted By: enrike

Re: button wont work - 07/24/09 12:27

common ... that cannot be the reason for this issue smile
Posted By: Widi

Re: button wont work - 07/24/09 12:31

Yes, that it is...
Posted By: enrike

Re: button wont work - 07/24/09 12:32

really??? wow! thats a nasty bug then. I just tried with latest demo version and does the same. i mean it does not work either
Posted By: Widi

Re: button wont work - 07/24/09 12:38

Try to set the layer to 1 or higher
Posted By: EvilSOB

Re: button wont work - 07/24/09 12:46

mouse_mode must be greater than zero (or something like that)
Posted By: enrike

Re: button wont work - 07/27/09 06:30

just tried with layer=5 and mouse_mode = 1 and 3 and it does not work either. This is a simple version of my script. It does not work for me.

#include <acknex.h>
#include <default.c>

var watch ;

function test()
{
watch = 1234;
printf("on");
}



PANEL* pTest =
{
pos_x = 10; // CONTROL PANEL POSITION IN WINDOW
pos_y = 10;
size_x = 150;
size_y = 300;

layer = 2;

button(10, 10, "boton2.bmp", "boton1.bmp", NULL, test, NULL, NULL);

red = 128;
green = 128;
blue = 128;
flags = LIGHT | VISIBLE;
}



function main()
{
video_mode = 6;
while(1) wait(1);
}
Posted By: hopfel

Re: button wont work - 07/27/09 06:59

try this:

#include <acknex.h>
#include <default.c>

var watch ;




PANEL* pTest =
{
pos_x = 10; // CONTROL PANEL POSITION IN WINDOW
pos_y = 10;
size_x = 150;
size_y = 300;

layer = 2;

button(10, 10, "boton2.bmp", "boton1.bmp", NULL, test, NULL, NULL);

red = 128;
green = 128;
blue = 128;
flags = LIGHT | VISIBLE;
}

function test()
{
watch = 1234;
printf("on");
}

function main()
{
video_mode = 6;
mouse_mode=2;
while(1)
{
mouse_pos.x=mouse_cursor.x;
mouse_pos.y=mouse_cursor.y;

wait(1);
}}
Posted By: enrike

Re: button wont work - 07/27/09 07:22

THANKS!!!! it works!

but having to do this is really weird ...

mouse_pos.x = mouse_cursor.x;
mouse_pos.y = mouse_cursor.y;
© 2024 lite-C Forums