Hi.
What I'm doing is:
- creating a list of buttons dynamically

To do so I have a panel pointer globally defined which I'll assign a panel to through pan_create.
So far it works fine in the first run.

Now I have another function that unloads that list and removes all pointers of the strings (used as labels for the buttons), a text object and the panel object.

If I know "re-create" the list everything looks fine again BUT the panel's buttons do not react on mouse over. However they react if I click them.

I used the search but couldn't come up with a topic that covers this.
If there is one, please point me to it.

Here is the code that might be of interest:
Code:
FONT* arial_16 = "Arial#16";

TEXT* editor_list;
PANEL* editor_listpan;

void editor_ShowList(TEXT* _txt,_lines)
{
	STRING* pan_str = "";
	STRING* editor_temp = "";
	
	editor_StatusList = 1;
	
	if(_lines > 10)
	{
		_lines = 10;
	}
	
	editor_list = txt_create(10,12);
	
	int i;
	for(i=0; i<_lines; i++)
	{
		if((editor_list.pstring)[i])
		{
			str_cpy((editor_list.pstring)[i],(_txt.pstring)[i]);
			
			str_for_num(editor_temp,16*i+20);
			str_cat(pan_str,"button(5,");
			str_cat(pan_str,editor_temp);
			str_cat(pan_str,",btn_Small2,btn_Small1,btn_Small2,NULL,NULL,NULL;");
		}
	}
	
	str_cat(pan_str,"button(393,1,btn_close2,btn_close1,btn_close2,editor_exitList,NULL,NULL);");
	
	editor_listpan = pan_create(pan_str,10);
	
	editor_listpan.red = 128;
	editor_listpan.green = 128;
	editor_listpan.blue = 128;
	
	editor_listpan.size_x = 410;
	editor_listpan.size_y = 25 + _lines*16;
	
	editor_listpan.pos_x = (screen_size.x - editor_listpan.size_x) / 2;
	editor_listpan.pos_y = 150;
	
	editor_list.pos_x = editor_listpan.pos_x + 10;
	editor_list.pos_y = editor_listpan.pos_y + 20;
	
	editor_list.font = arial_16;
	
	set(editor_listpan,SHOW|LIGHT);
	set(editor_list,SHOW);
}

void editor_unloadList()
{
	int i;
	
	reset(editor_list,SHOW);
	reset(editor_listpan,SHOW);
	
	for(i=0; i<editor_list.strings; i++)
	{
		if((editor_list.pstring)[i])
		{
			ptr_remove((editor_list.pstring)[i]);
		}
	}
	
	ptr_remove(editor_list);
	ptr_remove(editor_listpan);
}


Thanks for any ideas!

ps: uncommenting the ptr_remove(editor_listpan); line doesn't affect that whole misbehaviour at all.

Last edited by Xarthor; 03/29/09 20:27.