[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [paragui-users] Listbox select and add
From: |
Eric Ross |
Subject: |
Re: [paragui-users] Listbox select and add |
Date: |
Sat, 17 Aug 2002 17:02:08 -0400 (CLT) |
On Wed, 7 Aug 2002, Andrew Ford wrote:
> Thanks Craig,
> I'll take a look when I get a chance. Eric,
> perhaps you would like to try it?
>
> > Andrew,
> > Here is the code that works if there are no
> > items in the listbox selected. When an item is
> > selected and access violation occurs. This happens
> > when the function is exited, and the return value
> > set true/false doesn't fix it. The variable b tries
> > to get the item that is selected and unselect it.
> > This doesn't work.
I've doing some tests, but i didnt find any problems.
Craig: can you test the following program, and tell us if you find any
problem ?
--------------->8-----------------------
#include "paragui.h"
#include "pgapplication.h"
#include "pglistbox.h"
#include "pglistboxitem.h"
PARAGUI_CALLBACK(handle_click) {
static int counter = 1;
PG_ListBox* l = reinterpret_cast<PG_ListBox*>(clientdata);
char text[20];
sprintf(text,"nuevo %i", counter++);
l->AddItem(new PG_ListBoxItem(25, text));
l->Update();
return true;
}
int main( int argc, char **argv )
{
PG_Application app;
app.LoadTheme( "default" );
app.InitScreen( 640, 480, 0 );
app.SetEmergencyQuit(true);
PG_ListBox listbox(NULL, PG_Rect(10,10,300,400));
listbox.AddItem(new PG_ListBoxItem(25, "Item1"));
listbox.AddItem(new PG_ListBoxItem(25, "Item2"));
listbox.AddItem(new PG_ListBoxItem(25, "Item3"));
listbox.AddItem(new PG_ListBoxItem(25, "Item4"));
listbox.AddItem(new PG_ListBoxItem(25, "Item5"));
listbox.AddItem(new PG_ListBoxItem(25, "Item6"));
listbox.AddItem(new PG_ListBoxItem(25, "Item7"));
listbox.AddItem(new PG_ListBoxItem(25, "Item8"));
listbox.AddItem(new PG_ListBoxItem(25, "Item9"));
listbox.AddItem(new PG_ListBoxItem(25, "Item10"));
listbox.Show();
PG_Button b(NULL, 101, PG_Rect(400,10,110,30), "TEST");
b.SetEventCallback(MSG_BUTTONCLICK, handle_click, &listbox);
b.Show();
app.Run();
return 0;
}
--------------------8<-------------------
This thing is very simple: just a listbox and a button. Press the button
to add a new item to the listbox.
Good luck.
--