paragui-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [paragui-users] New Wid get´s from a callback.


From: Ulf Lorenz
Subject: Re: [paragui-users] New Wid get´s from a callback.
Date: Thu, 23 Oct 2003 01:14:24 +0200
User-agent: Mutt/1.4i

On Mon, Oct 20, 2003 at 02:10:00AM +0200, juri wrote:
>  Hi again,
> 
> i have another question (and i hope it doesn´t sound trivial ). How do i 
> "return" a widget to main() ?
> I made a few working message-callback´s. I want to make knew 
> buttons/listboxes/.. when something is klicked.
> Of course,the new items appear only for a very short time,as they 
> disappear when i leave the function.
> like:
> 
> PARAGUI_CALLBACK(handleabuttonklicked) {
>   PG_ListBox newlistbox(NULL, PG_Rect(310,168,300,600));   
>   newlistbox.Show();
> return true;
> }   
> 
> I thought by adding it to NULL it should be always visible ?    
> newlistbox.Show(); doesn´t work in main().
> 
> Or is there no possibility to do it this way ? What would you do ?
I think you have a basic problem here. If you have a function and define a
variable,this variable is destroyed when the function exits. If you want it to
stay persistent, you have to use a pointer like in this example:

PARAGUI_CALLBACK(handleabuttonklicked) {
  PG_ListBox* newlistbox = new PG_ListBox(NULL, PG_Rect(310,168,300,600));   
  newlistbox->Show();
return true;
}

However, it is wuite difficult to access the listbox later on, so better use
globl pointers *gulp* or store the pointer as private data of a class.

> thx a lot.
Ulf

-- 
Windle shook his head sadly. Five exclamation marks, the sure sign of an insane
mind.
(Reaper Man)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]