hi there..

i´ve written this codes:
Code:
PANEL* pan_objectlist =
{
	pos_y  = 61;
	pos_x  = 0;
	layer  = 90;
	bmap   = bm_listbutt_0;
	size_y = 1920;
	flags = SHOW;
}


void create_listbuttons(var typus)
{
	var izahl, igoalzahl;
	igoalzahl = 1001;
	if(typus == 1)
	{
		for(izahl=0; izahl<igoalzahl; izahl++)
		{
			pan_setdigits(pan_objectlist, 0,    -400, izahl*bmap_height(bm_listbutt_on), "%s", arialing, 1, "leer");
			pan_setbutton(pan_objectlist, 0, 0, -400, izahl*bmap_height(bm_listbutt_on), bm_listbutt_on, bm_listbutt_off, bm_listbutt_over, bm_listbutt_off, NULL, NULL, NULL);
			wait(1);
		}
	}
	else
	{
		for(izahl=0; izahl<igoalzahl; izahl++)
		{
			pan_setdigits(pan_objectlist, izahl,    -400, izahl*bmap_height(bm_listbutt_on), "%s", arialing, 1, "leer");
			pan_setbutton(pan_objectlist, izahl, 0, -400, izahl*bmap_height(bm_listbutt_on), bm_listbutt_on, bm_listbutt_off, bm_listbutt_over, bm_listbutt_off, NULL, NULL, NULL);
			wait(1);
		}
	}
}


void addto_objectlist(var objektnummer)
{
	pan_setdigits(pan_objectlist, objektnummer,    0, objektnummer*bmap_height(bm_listbutt_on), "%s", arialing, 1, (objektnamen.pstring)[objektnummer]);
	pan_setbutton(pan_objectlist, objektnummer, 0, 0, objektnummer*bmap_height(bm_listbutt_on), bm_listbutt_on, bm_listbutt_off, bm_listbutt_over, bm_listbutt_off, NULL, NULL, NULL);
	wait(1);
}



the panel bitmap has a height of 20, and a width of 200. So it should be repeated with a y size of 1920.
The first function creates the buttons or resets them (see variable switch).

The second fucntion makes a panel visible and enables mouseclick for the user, by pushing its pos_x to 0.

What i do is:
on startup (after 2 frames waiting after level_load):
Code:
create_listbuttons(1); //initialize the buttons and digits



on object_loading (reaout folder and make a list):
Code:
//reset buttons to X = -400, to hide them all.
create_listbuttons(0);
	wait_for(create_listbuttons);


The object_loader is called just once, when changing the category.

and for when an object is listed:
Code:
addto_objectlist(entitycounter);




if you need the object loader too:
Click to reveal..

Code:
void load_files()
{
	//reset buttons to X = -400, to hide them all.
	create_listbuttons(0);
	wait_for(create_listbuttons);
	
	var ilt, objectcount, fhandle, entitycounter;
	entitycounter = 0;
	for(ilt=0; ilt<4000; ilt++)
	{
		str_cpy((ordnerinhalt.pstring)[ilt], "");
		str_cpy((objekteigenschaften.pstring)[ilt], "");
		str_cpy((objektnamen.pstring)[ilt], "");
	}
	txt_for_dir(ordnerinhalt, "Models\\Map\\*.mdl");
	for(ilt=0; ilt<4000; ilt++)
	{
		if((ordnerinhalt.pstring)[ilt] != NULL)
		{
			if(str_stri((ordnerinhalt.pstring)[ilt], ".mdl") && str_stri((ordnerinhalt.pstring)[ilt], themenname))
			{
				objectlist[entitycounter] = ent_create(NULL, vector(-9000,-9000,-9000), NULL);
				objectlist[entitycounter].string1 = str_create((ordnerinhalt.pstring)[ilt]);
				str_cpy((objektnamen.pstring)[entitycounter], objectlist[entitycounter].string1);
				str_trunc((ordnerinhalt.pstring)[ilt], 3);
				str_cat((ordnerinhalt.pstring)[ilt], "nymph");
				
				if(file_exists((ordnerinhalt.pstring)[ilt]))
				{
					objectlist[entitycounter].string2 = str_create((ordnerinhalt.pstring)[ilt]);
					fhandle = file_open_read((ordnerinhalt.pstring)[ilt]);
					file_close(fhandle);
				}
				else
				{
					objectlist[entitycounter].string2 = str_create("NoSetup");
				}
				
				//Add object to the button list
				addto_objectlist(entitycounter);
				wait(1);
				entitycounter += 1;
				auswahlobjekte = ilt+1;
			}
		}
	}
}





My problem now:

When i use:
Code:
PANEL* pan_objectlist =
{
	pos_y  = 61;
	pos_x  = 0;
	layer  = 90;
	bmap   = bm_listbutt_0;
	size_y = 1920;
	flags = SHOW;
}


Engine crashes with "Acknex is not working" windows message
When i hide the "flags = SHOW;" in a comment like "//flags = SHOW;", it works ._.

Wheres the problem? Did i make something wrong in the Panel definition?

Last edited by Espér; 04/05/12 13:59.

Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<