[gtkmm] Passing a pointer to a class using D&D
- From: "Miller, Ryan D" <MilleRD kscems ksc nasa gov>
- To: <gtkmm-list gnome org>
- Subject: [gtkmm] Passing a pointer to a class using D&D
- Date: Thu, 5 Aug 2004 09:12:11 -0400
Greetings everyone,
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?
In drag_data_get(..) in my passing class:
Selection_data.set( selection_data.get_target(), 8, (const guint8
*)this, sizeof(this));
In drag_data_received(..) in my receiving class (templateBoxTarget):
templateBoxTarget *t = (templateBoxTarget *)
selection_data.get_data();
And I have also tried something like this as a shot in the dark, but got
the same results:
void *pVoid = (void *)selection_data.get_data();
templateBoxTarget *t = static_cast<templateBoxTarget *> (pVoid);
Thanks!,
Ryan
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]