[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [paragui-users] Set/Get UserData from a widget
From: |
Eric Ross |
Subject: |
Re: [paragui-users] Set/Get UserData from a widget |
Date: |
Sat, 17 Aug 2002 02:39:15 -0400 (CLT) |
On Tue, 6 Aug 2002, Andrew Ford wrote:
> Did you run it under the debugger to check exactly
> what's going on? I don't even know what these
> functions are supposed to be used for :)
>
> --- Keith Swyer <address@hidden> wrote:
> > hey, just wondering if anyone has used the
> > SetUserData or GetUserData
> > members of PG_Widget. I keep getting access
> > violations when trying to get
> > the userdata, being a PG_Rect*.
> >
> > This may not make much sense, but...
> >
> > //temp is a PG_Button
> > temp->SetUserData((void*)temp->GetClipRect(),
> > sizeof(PG_Rect*));
> >
> > PG_Rect *temp;
> > if (itr->second->GetUserDataSize())
> > itr->second->GetUserData((void*)temp);
> > //access violation here
Well.. according to the comments in the code, GetUserData must be
called with pre allocated space to copy the data into the buffer.
I think that could be useful to have some functions to set/get data, but
without the copy. I think something like gtk:
void SetUserData(const string& key, void *data);
void *GetUserData(const string& key);
All indexed by some arbitrary string.
What do you think ? It seems pretty easy to implement.. any volunteer ? :)
--