I had a second question because they are linked.

If I just change the last function of the code to :
void
{executeAction(AG_Event 
*event)//AG_ObjectFreeChildren(sv);AG_TextMsg(AG_MSG_WARNING, 
AG_ButtonNew(sv, 0, 
AG_WidgetUpdate(sv);
}
So when I put on the button "Ajouter" I should se a new button identified by 
the incremented number "Compteur". But when I test it, the first put on Ajouter 
doesn't make appear any button, the second put makes appear he button 0 whereas 
it should be 1 and each following call make appear the button N-1 with the text 
"Button N added, you should see it". But if I add the button on the window 
directly there is no problem, it happens only when I had it on the scrollview.
 
So I have the same question, is it a bug or a mystake from me ? Is there a 
solution to obtain the result I am waiting (a dynamic content scrollview) ?
 
Thanks a lot for your time, best regards and I wish that my english is 
understandable ;)
JC
"Button %d added, you should see it", compteur);"Foo %d", compteur++); 



________________________________
De : JC <[email protected]>
À : [email protected]
Envoyé le : Sam 2 Janvier 2010, 0 h 00 min 43 s
Objet : [Agar] Scrollview with AG_ObjectFreeChildren


Hello,

I try to do a dynamic scrollview, so for each update I want to clean my 
instance of scrollview, I put what I want in et update. But I get an segment 
fault exception. I have been able to reproduce the problem on the agar demo of 
scrollview wich I have juste a little modified the source code.

So if you compile the code joined to this email you will get a scrollview with 
an "Ajouter" button, if you click on it the exception occurs.

Do I something wrong or is it an Agar bug please ?

Here is the code :

/* Public domain */
/*
* This application demonstrates the use of the AG_Scrollview(3) widget.
*/#include<agar/core.h>#include<agar/gui.h>AG_Scrollview 
*sv;voidexecuteAction(AG_Event *event);intmain(
{
AG_Window *win;
AG_Box *hBox;
fprintf(stderr, 
}
printf(
AG_SetBool(agConfig, 
guiFlags |= AG_VIDEO_OPENGL;
} 
printf(
AG_SetBool(agConfig, 
}
}
fprintf(stderr, 
}
AG_BindGlobalKey(SDLK_ESCAPE, KMOD_NONE, AG_Quit);
AG_BindGlobalKey(SDLK_F8, KMOD_NONE, AG_ViewCapture);
win = AG_WindowNew(0);
AG_ButtonNew(win, 0, 
sv = AG_ScrollviewNew(win, 0);
AG_Expand(sv);
AG_ButtonNewFn(win, 0, 
AG_WindowSetGeometryAlignedPct(win, AG_WINDOW_MC, 50, 50);
AG_WindowShow(win);
AG_EventLoop();
AG_Destroy();
}intargc, char*argv[])intguiFlags = AG_VIDEO_RESIZABLE;intx, 
y;if(AG_InitCore("agar-scrollview-demo", 0) == -1) {"%s\n", 
AG_GetError());return(1);if(argc > 1) {if(strcmp(argv[1], "-g") == 0) {"Forcing 
GL mode\n");"view...opengl", 1);elseif(strcmp(argv[1], "-G") == 0) {"Forcing FB 
mode\n");"view.opengl", 0);if(AG_InitVideo(640, 480, 32, guiFlags) == -1) 
{"%s\n", AG_GetError());return(1);"Foo");"Ajouter", executeAction, 
"");return(0);void
{
AG_ObjectFreeChildren(sv);
AG_WidgetUpdate(sv);
}
 executeAction(AG_Event *event)



      
_______________________________________________
Agar mailing list
[email protected]
http://libagar.org/lists.html

Reply via email to