<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
</style>
</head>
<body class='hmmessage'>
Hi Lyle,<br><br>I'm grateful for your patience. <br><br>> Date: Tue, 17 Feb 2009 14:04:56 -0600<br>> From: lyle@lylejohnson.name<br>> <br>> No. Generally speaking, the FXLabel widget doesn't respond to SEL_COMMAND.<br>> <br>> > I've used this approach in my code before...<br>> <br>> Right. The FXButton widget *does* respond to SEL_LEFTBUTTONPRESS and<br>> SEL_LEFTBUTTONRELEASE messages. But it's a different widget than the<br>> FXLabel widget. Different behavior.<br>> <br><br>Oh, I overlooked the selector TYPE. I was looking for how to add selector ID and I found it,<br>but I've forgotten about selector TYPE. Please forgive my stupidity.<br><br>> > I tried to replace that Label with FXButton which will print something when<br>> > it is clicked. It does print it when I click it, but simulating a click still doesn't do<br>> > it.<br>> <br><br>After some tinkering, I found how to simulate that b1 click to trigger that 'puts "button1"'<br><br>b1 = FXButton.new(self, "Button1")<br>b1.connect(SEL_COMMAND) { puts "button1" }<br><br># This never triggers b1 SEL_COMMAND<br>FXButton.new(self, "Button2").connect(SEL_COMMAND) { b1.handle self, FXSEL(SEL_COMMAND,0), nil }<br><br># This does<br>FXButton.new(self, "Button2").connect(SEL_COMMAND) do<br> b1.handle self, FXSEL(SEL_LEFTBUTTONPRESS,0), nil<br> b1.handle self, FXSEL(SEL_LEFTBUTTONRELEASE,0), nil<br>end<br><br>> Could we back up a step or two? What is it that you're actually trying<br>> to accomplish? Are you trying to change the label's text whenever a<br>> button is pressed, or what?<br><br>In part, I'm exploring what I can or can't do. This particular issue caught my interest because it<br>looks like I have incorrect understanding and I wish to be corrected.<br><br>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.<br><br>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.<br><br>-andre<br><br /><hr />Stay up to date on your PC, the Web, and your mobile phone with Windows Live. <a href='http://clk.atdmt.com/MRT/go/msnnkwxp1020093185mrt/direct/01/' target='_new'>See Now</a></body>
</html>