paragui-users
[Top][All Lists]
Advanced

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

Re: [paragui-users] Set/Get UserData from a widget


From: Steffen Blume
Subject: Re: [paragui-users] Set/Get UserData from a widget
Date: Tue, 6 Aug 2002 20:29:21 +0200

I don't have any sources at the moment, but I think Get/SetUserData of 
PG_widget copy the data given by the pointer to new allocated memory. If you 
call GetUserData, you have to make sure, that you allocated memory where the 
data can be copied to.
Perhaps I'm completely wrong. Use the source!

Am Dienstag, 6. August 2002 19:39 schrieben Sie:
> 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

Try something like this:

PG_Rect* temp;
(void*)temp = malloc(itr->second->GetUserDataSize());
itr->second-GetUserData((void*)temp);

!!!Didn't test the code!!!

> here

In PG_ListBoxBaseItem the two methods are overwritten and act the way I 
expected them to: They save the pointer.

Steffen



reply via email to

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