Re: [gtkmm] Passing a pointer to a class using D&D
- From: "Timothy M. Shead" <tshead k-3d com>
- To: "Miller, Ryan D" <MilleRD kscems ksc nasa gov>
- Cc: gtkmm-list gnome org
- Subject: Re: [gtkmm] Passing a pointer to a class using D&D
- Date: Thu, 05 Aug 2004 09:24:14 -0700
Miller, Ryan D wrote:
Another question for the great readers of gtkmm list. I need to access
several fields of information from a class after a user performs a drag
from that class onto another one. (Both classes are derived from
EventBoxes). I figured out how to pass a single value, such as a
string, based on the examples by casting the string into a guchar* and
then using get_data_as_string on the receiving end. In order to pass
more than one thing, I was hoping to pass the address of the passing and
then create a pointer to the passing class on the receiving end and use
that to access what I need. Is this a feasible way to do this? In a
more concise manner: I would like to pass a pointer to "this" using D&D.
The code I have right now is below, but I end up with different values
for the addresses on both ends. Does anyone know how to do this?
Remember that in the general case, drag-and-drop can be between
different processes, each with its own address-space. As a consequence,
you cannot pass-by-reference with dnd - it is implicitly making a copy
of your data. So depending on the complexity of your data, you could
serialize it to a single delimited text string and use the UTF8 target,
or use XML and UTF8, or you can create your own custom target and let
dnd make a copy of your binary structure, but you will have to ensure
that your binary structure is Plain Old Data without any pointers or
references.
Cheers,
Tim
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]