[fxruby-users] non-modal dialogs

Joel VanderWerf vjoel at PATH.Berkeley.EDU
Wed Dec 15 14:28:02 EST 2004


lyle at knology.net wrote:
> On Wed, 15 Dec 2004 01:23:13 -0800, Joel VanderWerf
> <vjoel at path.berkeley.edu> wrote :
> 
> 
>>I had to convert some modal dialogs to non-modal, and I abstracted out 
>>some of what I was doing. The result is a mixin that uses closures to 
>>make non-modal dialogs almost as easy to implement as modal ones...
> 
> 
> Joel,
> 
> I haven't even looked at the code but I think I understand what you're
> describing, and it's a great idea. Are you OK with me incorporating this in
> the next release of FXRuby, with of course attribution to you?
> 
> Thanks,
> 
> Lyle

Lyle, I'd be honored. Feel free to change the name from 
#execute_nonmodal, if you can think of anything better.

For paralellism with modal dialogs, maybe #execute could also take a 
block, with roughly the same semantics as #execute_nonmodal: the block 
is passed an _accepted_ value (true or false) when the dialog closes. 
This could be added to my code in the form of an #execute_modal method:

     def execute_modal(placement = PLACEMENT_CURSOR, &block)
       @__FTNonModal_block = block
       execute(placement)
     end

This would make it really easy to convert code from modal to nonmodal 
(of course there may be other implications you have to worry about, but 
that's not FXDialogBox's concern). If you use the block form, you avoid 
having to check for the numeric result (0 or 1), which I sometimes 
forget to do.

BTW, I didn't see your message on fxruby-users, and I'm guessing the 
reason is that the address was in the cc field. I think I've seen this 
before.


More information about the fxruby-users mailing list