[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[paragui-dev] Hello
From: |
Manfred Hoppe |
Subject: |
[paragui-dev] Hello |
Date: |
Sun, 31 Jul 2005 19:02:45 +0200 |
User-agent: |
Mozilla Thunderbird 1.0 (Windows/20041206) |
Hello,
i have found a problem with the view engine.
When delete a PG_Widget (PG_Button) and the function 'Show' or 'Hide' of
the widget is call before,
then ends the application complete.
A sample of the problem is send with the email.
You must move the mouse by testing the sample,
then generate the error.
Greatings
Manfred
#include "paragui.h"
#include "pgapplication.h"
#include "pgbutton.h"
#include "pgwidgetlist.h"
#include "pglabel.h"
#include "pgwindow.h"
#include "pgmaskedit.h"
#include "pgscrollbar.h"
#include "pgprogressbar.h"
#include "pgradiobutton.h"
#include "pgthemewidget.h"
#include "pgcheckbutton.h"
#include "pgslider.h"
#include "pglistbox.h"
#include "pgcolumnitem.h"
#include "pgdropdown.h"
#include "pgpopupmenu.h"
#include "pgspinnerbox.h"
#include "pglog.h"
#include "pgmenubar.h"
#include "pgtheme.h"
#include "pgtimerobject.h"
#include <iostream>
#define RESX 800
#define RESY 600
class Test: public PG_TimerObject {
public:
//the constructor
Test(int resx,int resy)
{
xw = resx/32;
yw = resy/32;
sh = true;
for(int x=0; x<33; x++) {
for(int y=0; y<33; y++) {
b[x][y] = new PG_Button(NULL, PG_Rect(x*xw,
y*yw, xw, yw),"Hello");
b[x][y]->Show();
}
}
PG_TimerObject::AddTimer(1000);
}
//the destructor
~Test(){}
Uint32 eventTimer(PG_TimerObject::ID id, Uint32 interval)
{
if(sh)
for(int x=0; x<33; x++) {
for(int y=0; y<33; y++) {
//if(sh)b[x][y]->Hide();
//else b[x][y]->Show();
delete b[x][y];
b[x][y] = 0;
}
}
if(!sh)
for(int x=0; x<33; x++) {
for(int y=0; y<33; y++) {
b[x][y] = new PG_Button(NULL,
PG_Rect(x*xw, y*yw, xw, yw),"Hello");
b[x][y]->Show();
}
}
sh = !sh;
PG_TimerObject::eventTimer(id, interval);
return interval;
}
/*
//Another test function generate a blit error by move the mouse
Uint32 eventTimer(PG_TimerObject::ID id, Uint32 interval)
{
for(int x=0; x<33; x++) {
for(int y=0; y<33; y++) {
if(sh)b[x][y]->Hide();
else b[x][y]->Show();
}
}
sh = !sh;
PG_TimerObject::eventTimer(id, interval);
return interval;
}
*/
PG_Button* b[33][33];
bool sh;
int xw;
int yw;
};
bool handle_exit(PG_Pointer clientdata) {
PG_Application* app = (PG_Application*)clientdata;
app->Quit();
return true;
}
int main(int argc, char* argv[]) {
char theme[20];
strcpy(theme, "default");
// initial flags for screensurface
Uint32 flags = SDL_SWSURFACE;
int bpp = 0;
int resx = RESX, resy = RESY;
// construct the application object
PG_Application app;
app.SetEmergencyQuit(true);
for(int c=1; c<argc; c++) {
if(argv[c][0] != '-') {
strcpy(theme, argv[c]);
}
if(strcmp(argv[c], "-f") == 0) {
flags |= SDL_FULLSCREEN;
}
if(strcmp(argv[c], "-bpp") == 0) {
bpp = atoi(argv[++c]);
}
if(strcmp(argv[c], "-x") == 0) {
resx = atoi(argv[++c]);
}
if(strcmp(argv[c], "-y") == 0) {
resy = atoi(argv[++c]);
}
}
if(!app.LoadTheme(theme)) {
PG_LogERR("Unable to load theme \"%s\"", theme);
return -1;
}
if(!app.InitScreen(resx, resy, bpp, flags)){
printf("Resolution %dx%d not supported\n", resx, resy);
exit(-1);
}
Test t(resx,resy);
// Enter main loop
app.Run();
return EXIT_SUCCESS;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [paragui-dev] Hello,
Manfred Hoppe <=