I'm trying to make a reusable menupanel system, that only use system
resourses when called for, but I've reached a dead end....

Please tell What am I doing wrong? .. or is this bugs? (using LiteC V1.02)


Approach structure example 1:

Code:

PANEL* onfly;

function firstpan() {
onfly = pan_create("bmap=\"background.bmp\";
button = 20,0,\"ubutt.png\",\"sbutt.png\",\"hbutt.png\",NULL,NULL,NULL;
button = 60,0,\"ubutt.png\",\"sbutt.png\",\"hbutt.png\",VideoPan,NULL,NULL;
",1);
onfly.flags = VISIBLE;
}

function VideoPan() {
pan_remove(onfly);
onfly = pan_create("bmap=\"background.bmp\";
button = 20,0,\"ubutt.png\",\"sbutt.png\",\"hbutt.png\",GamePan,NULL,NULL;
button = 60,0,\"ubutt.png\",\"sbutt.png\",\"hbutt.png\",NULL,NULL,NULL;
",1);
onfly.flags = VISIBLE;
}

usw...




This will bring up the panel but click on the button for VideoPan
(and call for the VideoPan() ) won't work. Actually no buttons work
this way, seems something not getting initialized internally.


Approach structure example 2:

Code:

PANEL* onfly = {bmap="background.bmp";
button = 20,0,"ubutt.png","sbutt.png","hbutt.png",NULL,NULL,NULL;
button = 60,0,"ubutt.png","sbutt.png","hbutt.png",VideoPan,NULL,NULL;
}

usw...

onfly.flags = VISIBLE;




-> Mousepick button for VideoPan works and following executes

Code:

function VideoPan() {
pan_remove(onfly);
onfly = pan_create("bmap=\"background.bmp\";
button = 20,0,\"ubutt.png\",\"sbutt.png\",\"hbutt.png\",GamePan,NULL,NULL;
button = 60,0,\"ubutt.png\",\"sbutt.png\",\"hbutt.png\",NULL,NULL,NULL;
",1);
onfly.flags = VISIBLE;
}



-> Now button function for GamePan are not updated, the initial pan creation
(internal structure) remains (NULL in this case), and GamePan() will never be called for.


Whoever has the gold makes the rules.