Hi<div><br></div><div>I have the following code:</div><div><br></div><div><div>(defmacro defonevent (onevent eventtype xstruct)</div><div><div>  `(defmacro ,onevent (&amp;rest body)</div><div>     `(progn</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>(if (null (gethash (window *context*) %event-handlers%))</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>    (setf (gethash (window *context*) %event-handlers%) (make-hash-table)))</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>(setf (gethash ,&#39;,eventtype (gethash (window *context*) %event-handlers%))</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>      #&#39;(lambda (event) </div><div><span class="Apple-tab-span" style="white-space:pre">                </span>  (macrolet ((this (var) `(xpref event &#39;,&#39;,&#39;,xstruct ,var)))</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>    (this window) ; to avoid the warning if the event is not used in the body</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>    ,@body))))))</div>
<div><br></div><div>(defonevent on-expose #$Expose :&lt;XE&gt;xpose&lt;E&gt;vent)</div><div>(defonevent on-buttonpress #$ButtonPress :&lt;XB&gt;utton&lt;E&gt;vent)</div><div>(defonevent on-buttonrelease #$ButtonRelease :&lt;XB&gt;utton&lt;E&gt;vent)</div>
<div>(defonevent on-keypress #$KeyPress :&lt;XK&gt;ey&lt;E&gt;vent)</div><div>(defonevent on-keyrelease #$KeyRelease :&lt;XK&gt;ey&lt;E&gt;vent)</div><div>(defonevent on-clientmessage #$ClientMessage :&lt;XC&gt;lient&lt;M&gt;essage&lt;E&gt;vent)</div>
<div>(defonevent on-mapnotify #$MappingNotify :&lt;XM&gt;ap&lt;E&gt;vent)</div><div><br></div><div><br></div><div>; usage</div><div>(cell ....</div><div>  (on-expose</div><div>     (drawline 0 0 (this width) (this height)))</div>
<div>  ...</div><div> )</div><div><br></div><div><br></div><div>The issue is that I do not know how to implement xpref. The pref macro takes an accessor of the form</div><div>type.field but I need a macro that takes the type of the structure and the field name separately.</div>
<div><br></div><div>Thank you for your help</div><div><br></div><div>Taoufik</div></div></div>