>The widget documentation says this:
>
> typedef struct acall_rec {
> XEvent *event;
> int page;
> int element_id;
> char *text;
> char *href;
> } WbAnchorCallbackData;
>
>So I've defined a typespec as follows:
>
> p_typespec WbAnchorCallbackData {
> event :XEvent,
> page :int,
> element_id :int,
> text :XptString,
> href :XptString,
> };
You need:
p_typespec WbAnchorCallbackData {
event :exptr.:XEvent, ;;; <=== SPOT THE DIFFERENCE
page :int,
element_id :int,
text :XptString,
href :XptString,
};
Explanation:
The version you wrote,
p_typespec WbAnchorCallbackData {
event :XEvent,
...
is equiv. to writing in C:
typedef struct {
XEvent event;
... ^ NOTE: WITHOUT *
i.e. not a pointer to an XEvent structure, but a single X Event structure
whose fields are 'exploded' into the WbAnchorCallbacData structure.
The version I wrote:
p_typespec WbAnchorCallbackData { ;;; (1)
event :exptr.:XEvent,
says that 'event' is an external pointer, oh and by the way it points to an
XEvent structure. You could in fact just get away with:
p_typespec WbAnchorCallbackData { ;;; (2)
event :exptr,
if you were never interested in the event field. The difference between (1)
and (2) is how exacc deals with nested cases. For (1), to get the
event 'type' field from a WbAnchorCallbackData you do:
l_typespec cb :WbAnchorCallbackData;
exacc (exacc cb.event).type =>
whereas with (2) you must specify the :XEvent yourself:
l_typespec cd :WbAnchorCallbackData;
exacc :XEvent (exacc cb.event).type =>
^^^^^^^
Hope thats all clear.
Jon.
|