[fxruby-users] intercepting messages from FXScrollBar toFXScrollArea

Jeroen van der Zijp jeroen at fox-toolkit.org
Thu Mar 30 21:03:46 EST 2006


On Wednesday 29 March 2006 07:33, Lyle Johnson wrote:
> 
> 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, 
> e.g.
> 
> 	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?

My advice is to try and overload the layout() routine which places the scrollbars.

If this is FXText [I assume that it is], you STILL will want to keep FXText's
own layout [which calls FXScrollArea's layout()].  Therefore, if you subclass
FXText, your overloaded layout() should first call FXText::layout() and then
afterward "fix" the placement of the vertical scrollbar.

Its probably going to be a bit tricky but I expect it to work...


		- Jeroen



-- 
+----------------------------------------------------------------------------+
| Copyright (C) 20:00 03/30/2006 Jeroen van der Zijp.   All Rights Reserved. |
+----------------------------------------------------------------------------+
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/fxruby-users/attachments/20060330/34e0857b/attachment.bin 


More information about the fxruby-users mailing list