<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Feb 17, 2009, at 6:25 PM, Andreas S wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><div class="hmmessage" style="font-size: 10pt; font-family: Verdana; ">The other part is my users asked me to improve my tool by allowing them to define bind keys.<br>This got me looking at FXAccel. The following sample is from FXAccel#addAccel rdoc:<br><pre>hotKey = fxparseAccel("Ctrl+S")<br>accelTable.addAccel(hotKey, doc, FXSEL(SEL_COMMAND, MyDocument::ID_SAVE))<br></pre>Seems like I can only associate a hot key with a message, not a block. That's why I'm looking<br>into adding message selectors and handlers and my curiosity, for why my message handler doesn't<br>work, won't leave my mind at peace. (I haven't been successful using FXAccelTable, but that's a<br>different issue)<br><br>My understanding was, given a list of selector types and ids, supported by a widget, widget#handle<br>for FXSEL(TYPE,ID) will cause the widget to send FXSEL(TYPE,ID) to its target. But from what I<br>gathered, one cannot be certain about that, as my button example shows.</div></span></blockquote><div><br></div>Your understanding is correct; the problem is that the FXButton widget doesn't respond to FXSEL(SEL_COMMAND, 0). This fact is unfortunately not documented anywhere (other than in the FOX source code itself). FXButton does, in contrast, respond to FXSEL(SEL_LEFTBUTTONPRESS, 0) and FXSEL(SEL_LEFTBUTTONRELEASE, 0).</div><div><br><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><div class="hmmessage" style="font-size: 10pt; font-family: Verdana; ">I might not be able to rely on FXAccelTable to define bind keys, since #addAccel can only associate<br>one hot key to one message type-id.</div></span></blockquote><br></div><div>I know that I ran into some problem trying to support FXAccel#addAccel with blocks. I think the problem was that FXAccelTable#addAccel expects two arguments at the end (one for the "down" keypress and one for the "up" keypress), but we can only pass one block, and so I wasn't sure how to handle the association. It occurs to me that I *might* be able to offer a different-looking API, something like:</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>addAccelUp(hotKey, target) do |sender, sel, ptr|<br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>&nbsp;&nbsp; ...</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>end<br></div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>addAccelDown(hotKey) do |sender, sel, ptr|<br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>&nbsp;&nbsp;...<br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>end<br></div><div><br></div><div>or something like that...</div><div><br></div><div>Hope this helps,</div><div><br></div><div>Lyle</div></body></html>