[fxruby-users] intercepting messages from FXScrollBar toFXScrollArea

Lyle Johnson lyle at knology.net
Wed Mar 29 08:33:34 EST 2006

On Mar 29, 2006, at 1:47 AM, Dirk Schwendemann wrote:

> I've created a little app that is used on a PC with a touch screen. To 
> ease
> hitting the keys, the keys and the scrollbars are really big (45 
> pixels). So
> the ScrollCorner is also really big and I just wanted to use this 
> space by
> moving the ScrollDown Botton down to the position of the ScrollCorner 
> (like
> the attachment shows)

Ah, OK!

> The code looks like this (it seems to work unless that you can't use 
> the
> scrollbar afterward):
>     textField.verticalScrollBar.connect(SEL_CONFIGURE){
>       textField.scrollCorner.destroy()
>       width = textField.verticalScrollBar.width
>       height = textField.height
>       textField.verticalScrollBar.resize(width, height)
>     }
> The connect method has changed the target of the ScrollBar and so the
> ScrollArea doesn't get any further messages from the ScrollBar. How 
> can I
> avoid that connect prevents the ScrollArea from receiving messages?

Hmmm. You can always just reassign the verticalScrollBar's original 
target and message id after you've handled the SEL_CONFIGURE message, 

	textField.verticalScrollBar.connect(SEL_CONFIGURE) {
		... everything as listed above ...
		textField.verticalScrollBar.target = textField
		textField.verticalScrollBar.selector = FXWindow::ID_VSCROLLED

but then the *next* time the scroll bar sends a SEL_CONFIGURE message, 
you wouldn't get it. Maybe you could write a little class that would 
handle the SEL_CONFIGURE message and forward any other messages back to 
the FXScrollArea?

Hope this helps,


More information about the fxruby-users mailing list